c++ - Opencv consecutive frames capture from webcam -


i'm developing realtime opticalflow app opencv (c++). don't understand how capture 2 consecutive frames apply lucas-kanade tracking method.

this don't work:

cvcapture* capture = cvcapturefromcam(1); iplimage *imga=cvqueryframe( capture ); iplimage *imgb=cvqueryframe( capture ); 

i have tried this, program not exit loop:

cvcapture* capture = cvcapturefromcam(1); iplimage *imga=cvqueryframe( capture ); iplimage *imgb=cvcreateimage(cvsize(imga),ipl_depth_32f,3); while(cvnorm(imga,imgb)==0)     imgb=cvqueryframe( capture ); 

any ideas? hope isn't stupid question, suspect :/ sorry in advance. thanks!!

cv::mat m1, m2; cv::videocapture cap(0);  if(!cap.isopened())     ;// ... throw error here  cap >> m1; cap >> m2;  // m1 , m2 contain consecutive frames. 

Comments