So I am trying to get Max top and lowest points in multiple contours. It works when I want to find a the top and bottompoint for the biggest contour:
c = max(contours, key=cv.contourArea)
extTop = tuple(contours[-1][contours[-1][:, :, 1].argmin()][0])
extBot = tuple(contours[-1][contours[-1][:, :, 1].argmax()][0])
Now I try to get the top and bottom point of all the contours together but it doesnt work:
extTop = tuple(contours[contours[:, :, 1].argmin()][0])
extBot = tuple(contours[contours[:, :, 1].argmax()][0])
it gives:
extTop = tuple(contours[contours[:, :, 1].argmin()][0])
TypeError: tuple indices must be integers or slices, not tuple
Anyone knows a solution? I am prety new to coding so it might be a stupid question, but I have been trying for more than a day now.
Edit: tried this first, also didnt work:
c = max(contours, key=cv.contourArea)
extTop = tuple(contours[-1][contours[-1][:, :, 1].argmin()][0])
extBot = tuple(contours[-1][contours[-1][:, :, 1].argmax()][0])