添加保存图像的部分后出现此错误,是否知道如何修复此错误? This answer it doesn't help and it is in c++
for co in range(1, 5):
fsize = cv2.resize(roi_gray, (100, 100))
............................................... ............................
errorTraceback (most recent call last)
<ipython-input-1-86e0bb6aa30e> in <module>()
62
63 if __name__ == "__main__":
---> 64 create()
<ipython-input-1-86e0bb6aa30e> in create()
21 ret, frame = camera.read()
22
---> 23 gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
24
25 faces = faceCascade.detectMultiScale(
error: C:\build\2_4_winpack-bindings-win64-vc14-static\opencv\modules\imgproc\src\color.cpp:3739: error: (-215) scn == 3 || scn == 4 in function cv::cvtColor
答案 0 :(得分:1)
作为|&#39; L&#39; |已经说过,你的相机拍摄灰度图像可能会出现同样的问题,因此转换不起作用。 另一种可能性是你指出错误的相机。 mac的前置摄像头是camercapture(1),而0是窗口,尝试改变它。