0
votes

error Traceback (most recent call last) in () ----> 1 gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

error: /Users/travis/build/skvark/opencv-python/opencv/modules/imgproc/src/color.cpp:10638: error: (-215) scn == 3 || scn == 4 in function cvtColor

1
Your image is not a 3 or 4 channel image. print its shapeMiki
can you tell me how to do it?Shrinidhi Goswami
a little effort plase... stackoverflow.com/a/19098258/5008845Miki

1 Answers

1
votes

One possibility is that the image you are trying to read is not in the path you provided. OpenCV doesn't throw an error in this case but just returns a none type.

Now, when you try to convert the none type to a gray image, you get the above error.

Check out the image i have posted. In this code, 'a.jpg' does not exist in the default path.