I am trying to use contours without using the standard openCV contour functions.
At the moment I am trying to take out the first "line" and the last "line" in each contour and I have got a bit stuck on how to read the numpy array correctly. After a lot of messing about this is the current state of the code which doesn't work. Can anyone provide an example of how I should be doing this?
contours,hierarchy = cv2.findContours(mask, 1, 2)
for cnt in contours:
#draw first line
img = cv2.line(img,(cnt[0][0],cnt[0][1]),(cnt[1][0], cnt[1][1]),(255,0,0),2)
#draw last line
img = cv2.line(img,(cnt[cnt.size-1][0],cnt[cnt.size-1][1]),(cnt[cnt.size-1][0], cnt[cnt.size-1][1]),(255,0,0),2)