Dear OpenMV team,
recently I came back to your great project, looking for fast implementation of optical flow. Find_displacement() function was looking promising, so I grab “old” M4 board laying around from couple of years.
According to: http://forums.openmv.io/viewtopic.php?f=6&t=944 you have dropped support for M4, which in my opinion is slightly disappointing, so I decide to check if it is possible to run find_displacement() with all its dependencies on my old board until waiting for newly purchased couple of M7.
Getting deeper in your implementation, admire your work of clean coding. Although there are clean definitions of used modules, I would suggest following same concept for all used / unused modules, so slightly more advanced user can decide which module to use and fit even on “restricted” space revisions.
I have found that some math functions used by find_displacement() are in apriltags.c behind definition #define IMLIB_ENABLE_APRILTAGS, so probably not best place for those…
Finally find_displacement() works satisfactory on M4 board achieving approx. 25FPS on B64X64.
I am attaching couple of rough modifications if anyone is interested in running find_displacement() on older M4 boards.
apriltag_OPENMV2.c (433 KB)
imlib_config_OPENMV2.h (2.46 KB)
py_image_OPENMV2.c (266 KB)
Rename and replace according files for OPENMV2 in:
Running fft analysis for finding translation, rotation, scale is pretty advanced approach, although running fft on small bins is inaccurate to achieve acceptable accuracy.
For my purposes I have implemented new function compute_flow() which gives better results for robust and fast optical flow estimation at approx. 90FPS on M7.
If anyone is interested, I can share how to include new functions into micropython and OpenMV (it would be great if there is such tutorial)
Keep up good work!