【记录】opencv调取双目摄像头

若不更改分辨率,则只能显示一个摄像头

若更改分辨率,则读取不到图片,报错如下:

[ WARN:0] global C:\projects\opencv-python\opencv\modules\videoio\src\cap_msmf.cpp (1113) SourceReaderCB::OnReadSample videoio(MSMF): OnReadSample() is called with error status: -2147467263
[ WARN:0] global C:\projects\opencv-python\opencv\modules\videoio\src\cap_msmf.cpp (1125) SourceReaderCB::OnReadSample videoio(MSMF): async ReadSample() call is failed with error status: -2147467263
[ WARN:1] global C:\projects\opencv-python\opencv\modules\videoio\src\cap_msmf.cpp (1159) CvCapture_MSMF::grabFrame videoio(MSMF): can't grab frame. Error: -2147467263
[ WARN:1] global C:\projects\opencv-python\opencv\modules\videoio\src\cap_msmf.cpp (1159) CvCapture_MSMF::grabFrame videoio(MSMF): can't grab frame. Error: -2147483638

其他文章说是版本不兼容,修改代码如下:

cap = cv2.VideoCapture(1, cv2.CAP_DSHOW)

问题解决

你可能感兴趣的:(opencv,计算机视觉,visual,studio)