开发者

i have tried using cvCaptureFromCAM for 2.2 and i am told cv::Mat won't work with it

开发者 https://www.devze.com 2023-03-15 18:58 出处:网络
If cvCaptureFromCAM is the 2.0-2.1 version of the camera capture then what is the 2.2 version? If this can still work on 2.2 then why am i getting the error? Thank you for you开发者_如何转开发 help in

If cvCaptureFromCAM is the 2.0-2.1 version of the camera capture then what is the 2.2 version? If this can still work on 2.2 then why am i getting the error? Thank you for you开发者_如何转开发 help in advance.


cv::VideoCapture


The problem is that you are mixing the C++ inteface of OpenCV with the C interface. Choose one of them and stick with it all the way.

On the C interface, cvCaptureFromCAM() returns a CvCapture* that must be used to retrieve frames through cvQueryFrame(), and the this function returns a IplImage* not a cv::Mat.

CvCapture* capture = cvCaptureFromCAM(CV_CAP_ANY);

IplImage* frame = cvQueryFrame(capture);
// ... code to process frame ...

If you choose the C++ interface, check the reference Martin gave you.

0

精彩评论

暂无评论...
验证码 换一张
取 消