OpenCV – visualize polygonal curve(s) extracted with cv2.approxPolyDP()

The problem is in visualization only: drawContours expects array (list in case of python) of contours, not just one numpy array (which is returned from approxPolyDP).

Solution is the following: replacing

cv2.drawContours(canvas, approx, -1, (0, 0, 255), 3)

to

cv2.drawContours(canvas, [approx], -1, (0, 0, 255), 3)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)