Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The Moments function calculates this, and much more besides.

In this particular case, you want m10/m00 and m01/m00 as the x and y center, or perhaps it's the other way around. Make sure to set the binary image to true, and use the mask. It's much quicker.