我正在尝试使用这段代码读取avi文件:
import numpy as np
import cv2
while(cap.isOpened()):
ret, frame = cap.read()
print ret, frame
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('frame', gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
但我得到了这个输出:
False None
并出现此错误:
error: /Users/travis/build/skvark/opencv-python/opencv/modules/imgproc/src/color.cpp:9748: error: (-215) scn == 3 || scn == 4 in function cvtColor
你有什么建议吗?