c++ - How to show different Frame per second of video in two window in opencv -
i using opencv show frames camera. want show frames in 2 separation windows. want show real frame camera first window (show frames after every 30 mili-seconds) , show frames in second window delay (that means show frames after every 1 seconds). possible task. tried code not work well. please give me 1 solution task using opencv , visual studio 2012. in advance
this code
videocapture cap(0); if (!cap.isopened()) { cout << "exit" << endl; return -1; } namedwindow("window 1", 1); namedwindow("window 2", 2); long count = 0; mat face_algin; while (true) { mat frame; mat original; cap >> frame; if (!frame.empty()){ original = frame.clone(); cv::imshow("window 1", original); } if (waitkey(30) >= 0) break;// delay 30ms first window }
you write loop display frames in single function video file name argument , call them simultaneously multi-threading.
the pseudo code like,
void* play_video(void* frame_rate) { // play @ specified frame rate } main() { create_thread(thread1, play_video, normal_frame_rate); create_thread(thread2, play_video, delayed_frame_rate); join_thread(thread1); join_thread(thread2); }
Comments
Post a Comment