- 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.