How to do curve fitting on detected blob

General discussion about topics related to OpenMV.
avanish
Posts: 5
Joined: Tue Jul 17, 2018 7:35 am

How to do curve fitting on detected blob

Postby avanish » Tue Jul 17, 2018 7:45 am

Hi All,
I want to build an application using OpenMV Cam7. In my application I am suppose to find size of the bright object detected by the camera sensor.
The bright object will have Gaussian distribution. So in my application I am suppose to measure the centroid of the bright object, fit Gaussian function, on the line profile along the centroid for both the planes and find the sigma.
Kindly suggest if such an application possible with OpenMV libraries?

Thank you.
User avatar
kwagyeman
Posts: 2111
Joined: Sun May 24, 2015 2:10 pm

Re: How to do curve fitting on detected blob

Postby kwagyeman » Tue Jul 17, 2018 7:37 pm

Have you see the find_blobs() method? https://docs.openmv.io/library/omv.imag ... find_blobs
Nyamekye,
avanish
Posts: 5
Joined: Tue Jul 17, 2018 7:35 am

Re: How to do curve fitting on detected blob

Postby avanish » Wed Jul 18, 2018 2:02 am

Hi kwagyeman,
Thank you for your reply. I have seen find_blobs api. However my understanding is, it will return the number of blobs and their area (coordinates). But I am supposed to do curve fitting on the detected blobs to calculate sigma of Gaussian profile.
Can you suggest me how I will be able to do the curve fitting after detecting Blobs?
User avatar
kwagyeman
Posts: 2111
Joined: Sun May 24, 2015 2:10 pm

Re: How to do curve fitting on detected blob

Postby kwagyeman » Wed Jul 18, 2018 2:05 am

Mmm, so, we really just have that and:

https://docs.openmv.io/library/omv.imag ... regression

Would you be okay with calling get regression on multiple blob clusters to get mx/my values between multiple clusters and then do the rest in python yourself?
Nyamekye,
avanish
Posts: 5
Joined: Tue Jul 17, 2018 7:35 am

Re: How to do curve fitting on detected blob

Postby avanish » Wed Jul 18, 2018 7:41 am

Hi kwagyeman,
Thank you for your reply. I used OpenCV (cv2.moments) for centroid calculation and scipy.optimize.curve_fit for curve fitting.
Will I have to write these codes in micropython modules for my application?
User avatar
kwagyeman
Posts: 2111
Joined: Sun May 24, 2015 2:10 pm

Re: How to do curve fitting on detected blob

Postby kwagyeman » Wed Jul 18, 2018 12:06 pm

Hi, find_blobs() gives you the centroids of things. So, you just need to write scipy.optimize.curve_fit for curve fitting.

Please understand the OpenMV Cam is a microcontroller without an OS and doesn't have every feature desktop apps have. That said, the C code is fully programmable if you want to edit something.
Nyamekye,
avanish
Posts: 5
Joined: Tue Jul 17, 2018 7:35 am

Re: How to do curve fitting on detected blob

Postby avanish » Thu Jul 19, 2018 8:33 am

Hi kwagyeman,
Can you suggest any tutorial or document to follow, that can be used to include scipy.optimize.curve_fit for OpenMV environment?

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 4 guests