ESP32 motion
|
More information in Doxygen documentation
The purpose of this library is to implement robust motion estimation algorithm for the ESP32cam and other embedded chip. Motion estimation is the process of finding motion vectors that define the translation from one image to another. This can be resolved by differennt approach:
At the moment, I have implemented Lucas-kanade, ARPS and EPZS (FFMPEG + AVC/MPEG4 paper).
First thing first create a motion estimation context :
table of correspondance :
macro | val | function called |
---|---|---|
LK_OPTICAL_FLOW_8BIT | 0 | lucas kanade (out 8-bit uchar) |
LK_OPTICAL_FLOW | 1 | lucas kanade (out 16-bit vector) |
BLOCK_MATCHING_ARPS | 2 | ARPS (out 16-bit vector) |
BLOCK_MATCHING_EPZS | 3 | EPZS (out 16-bit vector) |
Next allocate motion vectors:
Now you can call motion_estimation
method and pass current and previous images buffer.
Now motion vectors will be stored in me_ctx.mv_table[0]
with the maximum being me_ctx.max
.
Note : in case of EZPS algorithm, mv_table
acts as a FIFO which means each time you perform an estimation it will push the FIFO :
EZPS algorithm need previous motion vectors as a way of prediction to the next generated.
In epzs.c
changing #define FFMPEG 0
to 1
will use ffmpeg version instead of paper
In lucas_kanade_optical_flow.c
changing #define NOSMOOTH 1
to 0
will enable isotropic smooth causing an increase in latency.