Skip to content
Advertisement

Python showing an OpenCV Assertion error for finding contours

I was trying to draw contours in an image using Python OpenCV. My code is the following:

JavaScript

I am getting an error while compiling this code. The error is the following:

JavaScript

How can I avoid this error?

Advertisement

Answer

The problem should be that cv2.drawContours (and in general all opencv “drawing” functions in python) have output equal to None. Try this way:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement