Custom contour extreme points detection?
I'm still a beginner so please explain what's happening here. I know its my knowledge gap of python which is the problem here, this could even be asked on StackOverFlow.
I have created a custom contour using
contour_coordinates = np.empty(shape=[0,2])
Adding each point like
contour_coordinates = np.append(contour_coordinates, [[x,y]], axis=0)
Example points added
[[584 298]
[592 298]
[598 299]
[605 301]
[611 304]
[616 308]
[619 312]
[622 316]]
When I try this command leftmost = tuple(contour_coordinates[:,:,0].argmin())
using this Contour Properties
I'm getting this error
leftmost = tuple(contour_coordinates[:,:,0].argmin())
IndexError: too many indices for array
I know its a python indexing problem but can't seem to be finding out what the issue is as this is how the OpenCV store the detected contour
Contour Stored by OpenCV
[[[ 729 1244]]
[[ 729 1245]]
[[ 729 1246]]
[[ 729 1247]]
[[ 729 1248]]
[[ 728 1249]]
[[ 728 1250]]
[[ 728 1251]]
[[ 727 1252]]]
Explain please?....