Ask Your Question
0

how to save current frame and previous frame

asked 2014-02-26 00:09:59 -0600

Amit gravatar image

i want to save the current frame and previous frame in some directory from video in opencv. i am using C++ and opencv 2.4.8 library.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2014-02-26 04:25:20 -0600

 VideoCapture cap(0);
 Mat curr, prev;
 if(!cap)return -1;
 cap>>curr;
 curr.copyTo(prev);
 while(1)
 {
      cap>>curr;
      imwrite("current.png",curr);
      imwrite("previous.png", prev);
      curr.copyTo(prev);
      if(waitKey(5)==27)break; //Esc pressed
 }
edit flag offensive delete link more

Comments

thanks hristov, its working.... good day.......

Amit gravatar imageAmit ( 2014-02-26 22:46:51 -0600 )edit

Question Tools

Stats

Asked: 2014-02-26 00:09:59 -0600

Seen: 4,443 times

Last updated: Feb 26 '14