Circle Detection and Differentiating circle size

Discussion related to "under the hood" OpenMV topics.
21tlte
Posts: 5
Joined: Fri Jul 13, 2018 11:30 am

Circle Detection and Differentiating circle size

Postby 21tlte » Fri Jul 13, 2018 11:44 am

Hi,
I want to use Circle Detection to detect circles, which I did. But the thing is that I want to detect the largest one out of for example 5 circles. Or at least get values for largest one. Can you help me in any way? If you can I would appreciate your help.


Thanks for your time.
User avatar
kwagyeman
Posts: 2406
Joined: Sun May 24, 2015 2:10 pm

Re: Circle Detection and Differentiating circle size

Postby kwagyeman » Sat Jul 14, 2018 3:08 pm

Have you tried out the find_circles example under feature detection in the IDE? If so, you just have to choose the circle from the list of circle objects that has the largest radius. Please see the find circles example to get started.
Nyamekye,
21tlte
Posts: 5
Joined: Fri Jul 13, 2018 11:30 am

Re: Circle Detection and Differentiating circle size

Postby 21tlte » Sun Jul 15, 2018 8:01 am

I indeed was using that function for detecting circles. But I can't find that list you are talking about. Are you talking about set "c" and if you are talking about it isn't that set updated every time for loop is "updated"? But still thanks for your time. :D
User avatar
kwagyeman
Posts: 2406
Joined: Sun May 24, 2015 2:10 pm

Re: Circle Detection and Differentiating circle size

Postby kwagyeman » Sun Jul 15, 2018 1:11 pm

Hi, the find_circles method returns a list of circle objects. If you want to get the max sized circle from that list you simply do:

Code: Select all

circles = img.find_circles(...)
    if circles:
        largest_circles = max(circles, key = lambda x: x.r())
Or something like that. Um, if you need help with the python code just google for how to find the largest object in a list of objects, etc using python.
Nyamekye,
21tlte
Posts: 5
Joined: Fri Jul 13, 2018 11:30 am

Re: Circle Detection and Differentiating circle size

Postby 21tlte » Mon Jul 16, 2018 6:48 am

Thank you for helping. Didn't know that!!
21tlte
Posts: 5
Joined: Fri Jul 13, 2018 11:30 am

Re: Circle Detection and Differentiating circle size

Postby 21tlte » Mon Jul 16, 2018 7:42 am

And is there a way for the camera to receive data or commands from UART and if it can, how??

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

Re: Circle Detection and Differentiating circle size

Postby kwagyeman » Mon Jul 16, 2018 1:41 pm

See the Examples -> Pixy Emulation -> UART Color Tracking script for UART control examples.
Nyamekye,
21tlte
Posts: 5
Joined: Fri Jul 13, 2018 11:30 am

Re: Circle Detection and Differentiating circle size

Postby 21tlte » Tue Jul 17, 2018 3:16 am

Ok thanks!

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 9 guests