Ask Your Question

cilem's profile - activity

2014-01-22 06:09:33 -0600 received badge  Supporter (source)
2014-01-22 06:09:29 -0600 received badge  Scholar (source)
2014-01-22 05:53:29 -0600 commented answer cannot get two different frames from the video

Thank you for your excellent reply. Since I stick to definitions, I could not see this. Great, again.

2014-01-22 02:44:36 -0600 received badge  Editor (source)
2014-01-22 02:43:37 -0600 asked a question 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.