1 | initial version |
cv2.drawContours
expects an array of contours, if you give it a single one, it will still try to access it as an array of arrays, and yea, bad result.
blame python's non-existing type system for making such an error possible.
2 | No.2 Revision |
your code here:
for index,cnt in enumerate(contours):
cv2.drawContours(blank2, cnt, -1, (255, 50, 255), 1)
is simply wrong.
cv2.drawContours
expects an array of contours, if you give it a single one, it will still try to access it as an array of arrays, and yea, bad result.
blame python's non-existing type system for making such an error possible.
3 | No.3 Revision |
your code here:
for index,cnt in enumerate(contours):
cv2.drawContours(blank2, cnt, -1, (255, 50, 255), 1)
is simply wrong.
cv2.drawContours
expects an array of contours, if you give it a single one, it will still try to access it as an array of arrays, and yea, bad result.
blame python's non-existing type system for making such an error possible.
if you want to use a loop, it has to be like this:
for index, _ in enumerate(contours):
cv2.drawContours(blank2, contours, index, (255, 50, 255), 1)
4 | No.4 Revision |
your code here:
for index,cnt in enumerate(contours):
cv2.drawContours(blank2, cnt, -1, (255, 50, 255), 1)
is simply wrong.
cv2.drawContours
expects an array of contours, if you give it a single one, it will still try to access it as an array of arrays, and yea, bad result.
blame python's non-existing type system for making such an error possible.
if you want to use a loop, it has to be like this:this (use all the contours and an index):
for index, _ in enumerate(contours):
cv2.drawContours(blank2, contours, index, (255, 50, 255), 1)