需要处理来自网络摄像头的帧,我选择了OpenCV。所以,这个读取程序报错:
CaptureVideo.exe 中 0x00007FF959C7E5BC (ntdll.dll) 处未处理的异常:0xC000000D:传递给服务或函数的参数无效。
窗口显示条带而不是图像。
编码:
#include <opencv\cv.h>
#include <opencv\highgui.h>
int main() {
cvNamedWindow("Output", 0);
CvCapture* capture = cvCreateCameraCapture(0);
//assert(capture != NULL);
IplImage* frame = cvQueryFrame(capture);
cvShowImage("Output", frame);
//cvSaveImage("filename.png", frame);
cvWaitKey (2000);
cvDestroyWindow("Output");
return 0;
}
问题在于:
CvCapture* capture = cvCreateCameraCapture(0);
值为零时,会发生错误,而对于其他常量 ( СV_CAP_*),则既没有图像也没有错误。以防万一:笔记本电脑相机。在 Skype 以及网站上,摄像头可以正常工作。
1 个回答