on-internet
← Community

How to calculate the fps of a video (with processing) using opencv

Stack Overflow ·

I can't seem to figure out what is wrong with the code fragment I have...it keeps on outputting over 200 fps for some reason. I tested with OpenCV and the unprocessed video is about 30 fps. int n_frame = 0; Mat previous; auto start = chrono::high_resolution_clock::now(); while (m_cap.isOpened()) { if (n_frame % 100 == 1) { auto end = chrono::high_resolution_clock::now(); auto time = chrono::duration_cast<chrono::seconds>(end - start); cout << "the fps is: " << 1.0 / (static_cast<double>(time.count()) / n_frame) << endl; //cin.ignore(1000, '\n'); } n_frame++; cout << "frame number: " << n_frame

Comments

Sign in or sign up to comment and upvote.

No comments yet.