I am trying to learn contours in python using cv2.
I tried the following code given in a tutorial guide:
import cv2
import numpy as np
from matplotli
It says your input image should have 3 or 4 channels before applying the function cv2.cvtColor
.
so check your image shape before applying the function by print im.shape
. if the result is None type
(most of the times, this is the problem), your image is not loaded correctly, most probably because your path is not correct.
The point is that your image should have 3 dimensions, rows
, columns
and depth
.