I want to find the center of a contour without doing so much calculations. Is there a built in function for that in opencv?
for the 'geometric center', get the boundingRect() of the contour, then:
cx = br.x+br.width/2; cy = br.y+br.height/2;
for the 'center of mass' get the moments() of the contour, then:
cx = m.m10 / m.m00; cy = m.m01 / m.m00;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With