Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I think you are looking for the image moments.

Moments mom=moments(segm_image);
int area,xc,yc;
area=mom.m00; //area of the ball in pixels
xc=mom.m10/mom.m00; //x and y center of the ball
yc=mom.m01/mom.m00;