adaptation between old video capture card and new version opencv
My boss let me write a simple monitoring program which could record video only when people appear. But the equipment we have, outdated commputer and three simulation video cameras with a capture card, are both bought many years ago. I don't know how to use opencv(2.4.12) to play video from old capture card(connect PC via USB). All methods I tried are failed. My code is as follows:
CvCapture *capture1 = cvCreateCameraCapture(0);
IplImage* img1;
cvNamedWindow("a", CV_WINDOW_AUTOSIZE);
while (1)
{
img1 = cvQueryFrame(capture1);
if (!img1)break;
cvShowImage("a", img1);
}
The result of it is " ERROR:SampleCB() - buffer sizes do not match". Someone said if add " CV_CAP_DSHOW", " videoinput" mode woud be used. However, the code doesnot work well.
CvCapture *capture1 = cvCreateCameraCapture(CV_CAP_DSHOW);
IplImage* img1;
cvNamedWindow("a", CV_WINDOW_AUTOSIZE);
while (1)
{
img1 = cvQueryFrame(capture1);
if (!img1)break;
cvShowImage("a", img1);
}
The result is still " ERROR:SampleCB() - buffer sizes do not match". How to solve the adaption problem? Please give me some help. Thanks!