Ask Your Question

How can I find the center of a blob?

asked 2012-01-23 13:53:03 -0500

anonymous user


I am looking at trying to detect an object and return it's center position and angle so I can pick it up with a pick and place unit.

I have gotten to the point that I can detect a blob. But I am having trouble using centroid to find it's center location. Am I even on the right track with this method? If I am what would be the proper use of cnetroid to get it to return a center position that I could use. I am hoping for a coordinate that I can apply via serial.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-01-23 13:58:13 -0500

Nate Oostendorp gravatar image

blob.coordinates() will give you back the middle of the bounding area, while blob.centroid() will give you back the centroid (mass-weighted center), and blob.angle() will give you the angle from -90 to +90

You may need to pull from master if you get a illegal division by zero error when calling centroid -- they've updated the interfaces to image moments in OpenCV recently.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-01-23 13:53:03 -0500

Seen: 4,840 times

Last updated: Jan 23 '12