How to get fps / frames per second of a video capture object

I am using a video capture object to capture and process video frames in opencv / javacv. I do not know how to get the frame rate. I need a timer that runs in the background while capturing live video. He must suspend face detection and continue it later. Because of the processing of the haarcascade file, it takes a long time to process each step. How to adjust the frame rate.

   System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
   VideoCapture camera = new VideoCapture(0);
+4
source share
2 answers

You can extract various parameters from VideoCapture, such as frame rate, frame height, frame width, etc.

cv::VideoCapture input_video;
 if(input_video.open(my_device))
 {
    std::cout<<"Video file open "<<std::endl;
 }
 else
 {
    std::cout<<"Not able to Video file open "<<std::endl;

 }
int fps = input_video.get(CV_CAP_PROP_FPS);
int frameCount = input_video.get(CV_CAP_PROP_FRAME_COUNT);
double fheight = input_video.get(CV_CAP_PROP_FRAME_HEIGHT);
double fwidth = input_video.get(CV_CAP_PROP_FRAME_WIDTH);
+2
source

answer . Thre - . getC(). Ex. videoCapture.get(5), FPS .

0

Source: https://habr.com/ru/post/1527507/


All Articles