Python-OpenCV cv2 OpenCV Error: Assertion failed (scn == 3 || scn == 4) in unknown function, file ..\..\..\modules\imgproc\src\color.cpp
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
.