3.4 FPS on Find_Line_Segments example

Discussion related to "under the hood" OpenMV topics.
s1000rr
Posts: 10
Joined: Wed Jan 31, 2018 12:33 am

3.4 FPS on Find_Line_Segments example

Postby s1000rr » Wed Jan 31, 2018 12:43 am

Hi,

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:

https://www.youtube.com/watch?v=oXexWgi3ldg

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?

Thanks
User avatar
kwagyeman
Posts: 1407
Joined: Sun May 24, 2015 2:10 pm

Re: 3.4 FPS on Find_Line_Segments example

Postby kwagyeman » Wed Jan 31, 2018 1:18 am

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.
Nyamekye,
s1000rr
Posts: 10
Joined: Wed Jan 31, 2018 12:33 am

Re: 3.4 FPS on Find_Line_Segments example

Postby s1000rr » Wed Jan 31, 2018 11:56 am

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?

Thanks
User avatar
kwagyeman
Posts: 1407
Joined: Sun May 24, 2015 2:10 pm

Re: 3.4 FPS on Find_Line_Segments example

Postby kwagyeman » Wed Jan 31, 2018 1:01 pm

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.
Nyamekye,
s1000rr
Posts: 10
Joined: Wed Jan 31, 2018 12:33 am

Re: 3.4 FPS on Find_Line_Segments example

Postby s1000rr » Thu Feb 01, 2018 6:52 pm

Hi,

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

Thanks
User avatar
kwagyeman
Posts: 1407
Joined: Sun May 24, 2015 2:10 pm

Re: 3.4 FPS on Find_Line_Segments example

Postby kwagyeman » Fri Feb 02, 2018 12:09 am

How to build the firmware is here:

https://github.com/openmv/openmv/wiki

Then change the call here:

https://github.com/openmv/openmv/blob/m ... ge.c#L2895

To using this method:

https://github.com/openmv/openmv/blob/m ... ugh.c#L762

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:

https://github.com/openmv/openmv/blob/2 ... ge.c#L2442
Nyamekye,
s1000rr
Posts: 10
Joined: Wed Jan 31, 2018 12:33 am

Re: 3.4 FPS on Find_Line_Segments example

Postby s1000rr » Fri Feb 02, 2018 10:29 pm

Hi,

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.

Thanks
User avatar
kwagyeman
Posts: 1407
Joined: Sun May 24, 2015 2:10 pm

Re: 3.4 FPS on Find_Line_Segments example

Postby kwagyeman » Sat Feb 03, 2018 1:27 am

Add your unix user name. This is a unix issue for accessing serial ports.
Nyamekye,
s1000rr
Posts: 10
Joined: Wed Jan 31, 2018 12:33 am

Re: 3.4 FPS on Find_Line_Segments example

Postby s1000rr » Sat Feb 03, 2018 3:23 pm

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.

Thanks

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests