First time here? Check out the FAQ!
answered 2016-03-22 12:19:26 -0600
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;