3.4 FPS on Find_Line_Segments example


Recently I purchased an OpenMV and just getting around to using it now. Been experimenting with various options, examples etc… just to get a better idea.

I have noticed that my M7 was running really slow at 3.4 FPS when running the Find_Line_Segments function, if I disabled the video buffer it would only go upto 3.6 FPS. Setting the frame_size to QQQVGA upped the FPS to around 6.7, and QQQQVGA had it upto 22 FPS (but the image had no detail)

I also copied the code from the following video at 3:14:

The camera in the video was running at around 15 FPS with QQVGA size, I was getting 3.4 FPS with the same code. Just updated the firmware to latest as well, any ideas?


Hi, we switched algorithms to using the same one OpenCV uses. It’s called the LSD line segment detection algorithm. There are papers on it along with C code that I ported. To the camera. It’s slow but very accurate. My custom algorithm which you saw on the video is a lot faster but the lines are more jittery.

I think I can make my own algorithm more stable in the future by improving how lines are merged by I’m not focusing on this right now.

If you want the faster algorithm I left the code in the C firmware. Enabling it will require a recompile but otherwise not much work.

Hi Nyamekye,

Thanks for the quick reply.

I would be interested in running your code, can you provide me with more detailed instructions as to how I can recompile it?

Another question that I have is what is the best way to isolate certain areas of the image and only apply processing to those sections?


Just pass the “ROI” argument.

E.g. roi=(0, 0, 40, 40)

To only run the algorithm on the x=0, y=0, w=40, h=40 area of the image.


If possible, I’d greatly appreciate instructions on how to compile your faster code to test out the find_line_segments.


How to build the firmware is here:

Then change the call here:


To using this method:


Note that the two functions don’t exactly accept the same arguments so you’ll need to determine what you want to pass and what’s hardcoded. If you look at the git history for v2.5 you’ll find the old py_image method that called the original function which you can just copy:


I’m following the instructions for how to build openMV and I’m running into an issue at the following:

sudo adduser (username) dialout

Am I supposed to add my github username here? For example: sudo adduser XXXXXXX dialout ?

I keep on getting an error saying that user XXXXXXX does not exist.


Add your unix user name. This is a unix issue for accessing serial ports.

Ahhh, okay thanks for the help. I actually found a pre compiled version of openMV 2.5 and was able to test out the code.