Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Simple Frame code issue

int main() { VideoCapture vid(0); if(!vid.isOpened()) return 1; double rate= vid.get(CV_CAP_PROP_FPS); Mat frame,temp; namedWindow("temp"); int delay=2000; bool stop(false); vid>>temp; while(!stop) {

    vid>>frame;

imshow("temp",temp);


    if(waitKey(delay)>=0)
        stop=true;

}
imshow("Frame",frame);
imshow("Ex Frame",temp);
Mat dif=(temp - .5 * frame);
imshow("x frame",dif);
vid.release();



waitKey();

return 0;

} <\code> In the above code the 'temp' is acquired before the loop and is shown in the loop and i expected to get only the first frame as output but i get the continuous frame output i just cant figure it out its just as if i've written "imshow("temp",frame);" Please help..silly thing...big headache...

click to hide/show revision 2
No.2 Revision

updated 2013-03-20 09:04:22 -0600

berak gravatar image

Simple Frame code issue

int main() { VideoCapture vid(0); if(!vid.isOpened()) return 1; double rate= vid.get(CV_CAP_PROP_FPS); Mat frame,temp; namedWindow("temp"); int delay=2000; bool stop(false); vid>>temp; while(!stop) {

{


        vid>>frame;

 imshow("temp",temp);


     if(waitKey(delay)>=0)
         stop=true;

 }
 imshow("Frame",frame);
 imshow("Ex Frame",temp);
 Mat dif=(temp - .5 * frame);
 imshow("x frame",dif);
 vid.release();



 waitKey();

 return 0;
}

} <\code> In the above code the 'temp' is acquired before the loop and is shown in the loop and i expected to get only the first frame as output but i get the continuous frame output i just cant figure it out its just as if i've written "imshow("temp",frame);" Please help..silly thing...big headache...