Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Assuming you just wan to show the processed frame, here is what your loop could look like.

Mat in_frame, res_frame;
VideoWriter result_video(......); //use parameters that suit your need
while(true)
{

 cap >> in_frame;
 if(in_frame.empty())
    break;

res_frame = myFrameProcessor(in_frame);
result_video.write(res_frame);

imshow( "Frame", res_frame );

char c=(char)waitKey(25);
if(c==27)
  break;
}

Ideally you would want to create a different thread that does the showing part by creating a shared queue of cv::Mat objects...