Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi,

you can calculate the extreme points of the contour.

leftmost = tuple(cnt[cnt[:,:,0].argmin()][0])
rightmost = tuple(cnt[cnt[:,:,0].argmax()][0])
topmost = tuple(cnt[cnt[:,:,1].argmin()][0])
bottommost = tuple(cnt[cnt[:,:,1].argmax()][0])

See OpenCV documentation