Output video-file has the same FPS as source video-stream. Exit from demo by ESC.

This commit is contained in:
AlexeyAB
2018-06-19 15:00:36 +03:00
parent e1e5abe191
commit 7f0079dec5
4 changed files with 43 additions and 7 deletions

View File

@ -248,6 +248,22 @@ IplImage* get_webcam_frame(CvCapture *cap) {
}
return src;
}
int get_stream_fps_cpp(CvCapture *cap) {
int fps = 25;
try {
cv::VideoCapture &cpp_cap = *(cv::VideoCapture *)cap;
#ifndef CV_VERSION_EPOCH // OpenCV 3.x
fps = cpp_cap.get(CAP_PROP_FPS);
#else // OpenCV 2.x
fps = cpp_cap.get(CV_CAP_PROP_FPS);
#endif
}
catch (...) {
std::cout << " Can't get FPS of source videofile. For output video FPS = 25 by default. \n";
}
return fps;
}
// ----------------------------------------
extern "C" {
image ipl_to_image(IplImage* src); // image.c