Trying to find center of contour using color-blob-detection

asked 2013-10-28 17:55:05 -0500

saevar gravatar image

updated 2013-10-28 18:19:03 -0500

berak gravatar image

Hello every one.

I'm sorry for this lame question but I´m looking for a quick fix.

As an open project at my uni I´m building an object tracking robot.

I have limited amount of time and resources. The plan is to use my android phone to find x-coordinates of a ball on the floor. Then sending them via USB to an Arduino that controls the rest of robot. I've been trying to teach myself something in both Android development and OpenCV but with limited luck on the OpenCV half.

The OpenCV sample color-blob-detection is working fine but I would love to get the x and y coordinates of the center of contour.

Is there an easy way to do this or should I just keep looking at tutorials and try to build a code from scratch?

With hope of an answer, Saevar.

edit retag flag offensive close merge delete

Comments

2

just get the boundingrect of your contour, and get the center from that

berak gravatar imageberak ( 2013-10-28 18:17:58 -0500 )edit

Thank you, that worked

saevar gravatar imagesaevar ( 2013-10-29 03:50:53 -0500 )edit