open cv error: (-215) scn == 3 || scn == 4 in function cvtColor
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm currently in Ubuntu 14.04, using python 2.7 and cv2. When I run this code: import numpy as np import cv2 img = cv2.imread('2015-05-27-191152.jpg',0) gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) it returns: File "face_detection.py", line 11, in gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) cv2.error: /home/arthurckl/Desktop/opencv-3.0.0-rc1/modules/imgproc/src/color.cpp:7564: error: (-215) scn == 3 || scn == 4 in function cvtColor I already searched here and one answer said that I could be loading my photo the wrong way, because it should