Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Midpoint on my line is wrong

Hey guys, i'm trying to get the midpoint of my line using this code but it seems wrong. Can anyone advice me please?

M = cv2.moments(ske)

centroid_x = int(M['m10']/M['m00'])

centroid_y = int(M['m01']/M['m00'])

cv2.circle(ske,(centroid_x,centroid_y), 5, (127,0,0), -1)

image description

click to hide/show revision 2
No.2 Revision

updated 2018-01-02 02:34:51 -0600

berak gravatar image

Midpoint on my line is wrong

Hey guys, i'm trying to get the midpoint of my line using this code but it seems wrong. Can anyone advice me please?

M = cv2.moments(ske)

centroid_x = int(M['m10']/M['m00'])

centroid_y = int(M['m01']/M['m00'])

cv2.circle(ske,(centroid_x,centroid_y), 5, (127,0,0), -1)

image description