1 | initial version |
2 | retagged |
import numpy as np
import cv2
cap=cv2.VideoCapture(0) while(True): ret,frame=cap.read() gray = cv2.cvtColor(frame ,cv2.COLOR_BGR2GRAY) cv2.imshow('frame',gray) if cv2.waitKey(1) : break cap.release() cv2.destroyAllWindows()
and the error is: OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cv::cvtColor, file C:\build\master_winpack-bindings-win64-vc14-static\opencv\modules\imgproc\src\color.cpp, line 9748 Traceback (most recent call last): File "D:/python/examples_with_pyCharm/untitled2/Lesson3_VIDEO.py", line 7, in <module> gray = cv2.cvtColor(frame ,cv2.COLOR_BGR2GRAY) cv2.error: C:\build\master_winpack-bindings-win64-vc14-static\opencv\modules\imgproc\src\color.cpp:9748: error: (-215) scn == 3 || scn == 4 in function cv::cvtColor
import numpy as np import cv2
cap=cv2.VideoCapture(0)
while(True):
ret,frame=cap.read()
gray = cv2.cvtColor(frame ,cv2.COLOR_BGR2GRAY)
cv2.imshow('frame',gray)
if cv2.waitKey(1) :
break
cap.release()
and the error is:
is:
OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cv::cvtColor, file C:\build\master_winpack-bindings-win64-vc14-static\opencv\modules\imgproc\src\color.cpp, line 9748
Traceback (most recent call last):
File "D:/python/examples_with_pyCharm/untitled2/Lesson3_VIDEO.py", line 7, in <module>
gray = cv2.cvtColor(frame ,cv2.COLOR_BGR2GRAY)
cv2.error: C:\build\master_winpack-bindings-win64-vc14-static\opencv\modules\imgproc\src\color.cpp:9748: error: (-215) scn == 3 || scn == 4 in function cv::cvtColorcv::cvtColor