Attention! This forum will be made read-only by Dec-20. Please migrate to https://forum.opencv.org. Most of existing active users should've received invitation by e-mail.
Ask Your Question
0

how to save current frame and previous frame

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

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

 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 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

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

Seen: 2,651 times

Last updated: Feb 26 '14