读取摄像头还麻烦不断,原因不明,上网查,说是可以用CameraDs,但是必须和VS搭配使用,不想换VS,无奈继续查,终于找到方法
找到解压后的文件sources/modules/highgui/src/cap_dshow.cpp
打开cap_dshow.cpp,找到3198行
将
if (VI.getPixels( index, (uchar*)frame->imageData, false, true ))
return frame;
else
return NULL;
替换为
VI.getPixels( index, (uchar*)frame->imageData, false, true );
return frame;
重新编译得到用于mingw的库就可以打开并读取摄像头了
转载来源:http://answers.opencv.org/question/17836/problems-with-webcam-in-windows-7-opencv-246/
据老外的意思,直接使用 2.4.5也是行得通的