findcountours and minAreaRect

Discussion related to "under the hood" OpenMV topics.
OutoftheBOTS
Posts: 85
Joined: Tue May 29, 2018 4:15 am

findcountours and minAreaRect

Postby OutoftheBOTS » Tue Jun 05, 2018 5:59 pm

Does OpenMV have similar functions as findContours and minAreaRect as found in OpenCV.

It is for another project that I have not yet started but plan to.

See first 2 mins of this video https://www.youtube.com/watch?v=o2ul4KrLT-s&t=1s
Last edited by OutoftheBOTS on Tue Jun 05, 2018 6:05 pm, edited 1 time in total.
User avatar
kwagyeman
Posts: 2042
Joined: Sun May 24, 2015 2:10 pm

Re: findcountours and minAreaRect

Postby kwagyeman » Tue Jun 05, 2018 6:04 pm

Please use find_blobs() it finds all color blobs in the image and each color blob has a bounding box and etc.

Find_blobs() is our flag ship feature.
Nyamekye,
OutoftheBOTS
Posts: 85
Joined: Tue May 29, 2018 4:15 am

Re: findcountours and minAreaRect

Postby OutoftheBOTS » Tue Jun 05, 2018 6:07 pm

Yes find blob will find bounding rectangle of all blobs but I want to find minAreaRect i.e to rotation on the rect as well as it's position

see first 2 mins of this video https://www.youtube.com/watch?v=o2ul4KrLT-s&t=1s
User avatar
kwagyeman
Posts: 2042
Joined: Sun May 24, 2015 2:10 pm

Re: findcountours and minAreaRect

Postby kwagyeman » Tue Jun 05, 2018 6:11 pm

Find blobs gives you the rotation of the blob along with it's centroid. From your video these are the same two values you are getting with OpenCV.

See the rotation() attribute of the returned blob object.
Nyamekye,
OutoftheBOTS
Posts: 85
Joined: Tue May 29, 2018 4:15 am

Re: findcountours and minAreaRect

Postby OutoftheBOTS » Tue Jun 05, 2018 6:20 pm

Thanks I will have a play with it :)
User avatar
kwagyeman
Posts: 2042
Joined: Sun May 24, 2015 2:10 pm

Re: findcountours and minAreaRect

Postby kwagyeman » Tue Jun 05, 2018 6:58 pm

Note that rotation is computed using the standard blob rotation metric involving the cross correlation of x and y pixels and some atan2 stuff. I forget where the link for the method is. I think there's a Wikipedia page on image moments that has the info. Note that rotation is valid only from 0 to 180 degrees and then it loops.
Nyamekye,

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 5 guests