将Black Magic Mini Recorder(Thunderbolt连接)的视频输入到OpenCV Mat(Python)的最佳方法是什么?
我使用的是Mac OS X El Capitan,Blackmagic Desktop Video SDK 10.7和OpenCV 3.0.0。
修改
我试过像这样使用VideoCapture:
cap = cv2.VideoCapture(0)
while(True):
ret, frame = cap.read()
cv2.imshow('frame',frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
它给了我以下错误:
(我认为这是因为cap
是空的)
OpenCV Error: Assertion failed (size.width>0 && size.height>0) in imshow, file /tmp/opencv3-20160626-61731-v18vfg/opencv-3.1.0/modules/highgui/src/window.cpp, line 281
Traceback (most recent call last):
File "file.py", line 69, in <module>
cv2.imshow('frame',frame)
cv2.error: /tmp/opencv3-20160626-61731-v18vfg/opencv-3.1.0/modules/highgui/src/window.cpp:281: error: (-215) size.width>0 && size.height>0 in function imshow
QTKit didn't find any attached Video Input Devices!
Warning, camera failed to properly initialize!
Cleaned up camera.
谢谢!