Ask Your Question
0

how to create and run video at the same time.

asked 2019-01-02 01:54:46 -0600

elax89 gravatar image

I extracted the frame from the video and made a color conversion. I want to show the process. However, an error occurs when playing the video. I do not know how to get the video to play at the same time it is created. I would really appreciate it if you could help. ps. It can be shown to be somewhat aggressive because it is asking through the translator. I need help urgently.

edit retag flag offensive close merge delete

Comments

please show us, what you tried, so far.

berak gravatar imageberak ( 2019-01-02 01:56:03 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2019-01-02 07:28:32 -0600

MxBx gravatar image

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

edit flag offensive delete link more

Comments

Thank you very much.!!!

elax89 gravatar imageelax89 ( 2019-01-07 19:32:45 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2019-01-02 01:54:46 -0600

Seen: 92 times

Last updated: Jan 02 '19