Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

cannot get two different from the video

- Hi to everyone. I am quite new on OpenCV. My goal is getting two frames from the video at any time wanted(like one from 10 msec and the other one is 1000 msec). I write this simple code below.

int main( int argc, char* argv[] ) { Mat frame1,frame2; VideoCapture capt("drop.avi"); if(!capt.isOpened()) { cout<<"cannot open file"<<endl; return="" (-1);="" }="" capt.set(cv_cap_prop_pos_msec,10);="" capt.read(frame1);="" capt.set(cv_cap_prop_pos_msec,1000);="" capt.read(frame2);="" if="" i="" comment="" out="" this="" line,="" frame1="" is="" ok="" namedwindow("w1",cv_window_autosize);="" namedwindow("w2",cv_window_autosize);="" imshow("w1",frame1);="" imshow("w2",frame2);<="" p="">

waitKey(2000);

return 0;

}

Within this code, I get two exactly same frames that belongs to 1000 msec of the video. When I comment out "capt.read(frame2)" line, frame1 is ok(shows the frame at 10msec). I also try set frames but the result is same,unfortunately. By the way, I am using OpenCV 245 on VS2010.Is there anything I miss? Any helps would be appreciated.

cannot get two different from the video

- Hi to everyone. I am quite new on OpenCV. My goal is getting two frames from the video at any time wanted(like one from 10 msec and the other one is 1000 msec). I write this simple code below.

int main( int argc, char* argv[] ) { Mat frame1,frame2; frame1,frame2;

VideoCapture capt("drop.avi"); capt("drop.avi");

if(!capt.isOpened()) { cout<<"cannot open file"<<endl; return="" (-1);="" }="" capt.set(cv_cap_prop_pos_msec,10);="" capt.read(frame1);="" capt.set(cv_cap_prop_pos_msec,1000);="" capt.read(frame2);="" if="" i="" comment="" out="" this="" line,="" frame1="" is="" ok="" namedwindow("w1",cv_window_autosize);="" namedwindow("w2",cv_window_autosize);="" imshow("w1",frame1);="" imshow("w2",frame2);<="" }<="" p="">

waitKey(2000);

capt.set(CV_CAP_PROP_POS_MSEC,10);

capt.read(frame1);

capt.set(CV_CAP_PROP_POS_MSEC,1000);

capt.read(frame2); //if I comment out this line, frame1 is ok

namedWindow("w1",CV_WINDOW_AUTOSIZE);

namedWindow("w2",CV_WINDOW_AUTOSIZE);

imshow("w1",frame1);

imshow("w2",frame2);

waitKey(2000);

return 0;

}

Within this code, I get two exactly same frames that belongs to 1000 msec of the video. When I comment out "capt.read(frame2)" line, frame1 is ok(shows the frame at 10msec). I also try set frames but the result is same,unfortunately. By the way, I am using OpenCV 245 on VS2010.Is there anything I miss? Any helps would be appreciated.

cannot get two different from the video

- Hi to everyone. I am quite new on OpenCV. My goal is getting two frames from the video at any time wanted(like one from 10 msec and the other one is 1000 msec). I write this simple code below.

int main( int argc, char* argv[] ) { {

Mat frame1,frame2;

VideoCapture capt("drop.avi");

if(!capt.isOpened()) { cout<<"cannot open file"<<endl; return="" (-1);="" }<="" p="">

capt.set(CV_CAP_PROP_POS_MSEC,10);

capt.read(frame1);

capt.set(CV_CAP_PROP_POS_MSEC,1000);

capt.read(frame2); //if I comment out this line, frame1 is ok

namedWindow("w1",CV_WINDOW_AUTOSIZE);

namedWindow("w2",CV_WINDOW_AUTOSIZE);

imshow("w1",frame1);

imshow("w2",frame2);

waitKey(2000);

return 0; }

Within this code, I get two exactly same frames that belongs to 1000 msec of the video. When I comment out "capt.read(frame2)" line, frame1 is ok(shows the frame at 10msec). I also try set frames but the result is same,unfortunately. By the way, I am using OpenCV 245 on VS2010.Is there anything I miss? Any helps would be appreciated.

cannot get two different from the video

- Hi to everyone. I am quite new on OpenCV. My goal is getting two frames from the video at any time wanted(like one from 10 msec and the other one is 1000 msec). I write this simple code below.

int main( int argc, char* argv[] ) {

Mat frame1,frame2;

frame1,frame2;
VideoCapture capt("drop.avi");

VideoCapture capt("drop.avi");

capt.set(CV_CAP_PROP_POS_MSEC,10);
capt.read(frame1);

if(!capt.isOpened()) { cout<<"cannot open file"<<endl; return="" (-1);="" }<="" p=""> capt.set(CV_CAP_PROP_POS_MSEC,1000);

capt.set(CV_CAP_PROP_POS_MSEC,10);

capt.read(frame1);

capt.set(CV_CAP_PROP_POS_MSEC,1000);

capt.read(frame2); //if I comment out this line, frame1 is ok

ok
namedWindow("w1",CV_WINDOW_AUTOSIZE);

namedWindow("w1",CV_WINDOW_AUTOSIZE);

namedWindow("w2",CV_WINDOW_AUTOSIZE);
imshow("w1",frame1);

namedWindow("w2",CV_WINDOW_AUTOSIZE);

imshow("w2",frame2);
waitKey(2000);

imshow("w1",frame1);

imshow("w2",frame2);

waitKey(2000);

return 0; }

Within this code, I get two exactly same frames that belongs to 1000 msec of the video. When I comment out "capt.read(frame2)" line, frame1 is ok(shows the frame at 10msec). I also try set frames but the result is same,unfortunately. By the way, I am using OpenCV 245 on VS2010.Is there anything I miss? Any helps would be appreciated.

cannot get two different frames from the video

- Hi to everyone. I am quite new on OpenCV. My goal is getting two frames from the video at any time wanted(like one from 10 msec and the other one is 1000 msec). I write this simple code below.

int main( int argc, char* argv[] ) {

Mat frame1,frame2;
VideoCapture capt("drop.avi");
capt.set(CV_CAP_PROP_POS_MSEC,10);
capt.read(frame1);
capt.set(CV_CAP_PROP_POS_MSEC,1000);
capt.read(frame2); //if I comment out this line, frame1 is ok
namedWindow("w1",CV_WINDOW_AUTOSIZE);
namedWindow("w2",CV_WINDOW_AUTOSIZE);
imshow("w1",frame1);
imshow("w2",frame2);
waitKey(2000);
return 0; }

Within this code, I get two exactly same frames that belongs to 1000 msec of the video. When I comment out "capt.read(frame2)" line, frame1 is ok(shows the frame at 10msec). I also try set frames but the result is same,unfortunately. By the way, I am using OpenCV 245 on VS2010.Is there anything I miss? Any helps would be appreciated.

cannot get two different frames from the video

- Hi to everyone. I am quite new on OpenCV. My goal is getting two frames from the video at any time wanted(like one from 10 msec and the other one is 1000 msec). I write this simple code below.

int main( int argc, char* argv[] )
{

{ Mat frame1,frame2;
VideoCapture capt("drop.avi");
capt.set(CV_CAP_PROP_POS_MSEC,10);
capt.read(frame1);
capt.set(CV_CAP_PROP_POS_MSEC,1000);
capt.read(frame2); //if I comment out this line, frame1 is ok
namedWindow("w1",CV_WINDOW_AUTOSIZE);
namedWindow("w2",CV_WINDOW_AUTOSIZE);
imshow("w1",frame1);
imshow("w2",frame2);
waitKey(2000);
return 0; }

}

Within this code, I get two exactly same frames that belongs to 1000 msec of the video. When I comment out "capt.read(frame2)" line, frame1 is ok(shows the frame at 10msec). I also try set frames but the result is same,unfortunately. By the way, I am using OpenCV 245 on VS2010.Is there anything I miss? Any helps would be appreciated.