
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Get FPS Value in OpenCV Using C++
To get the FPS value, we used the 'get()' command of and 'CAP_PROP_FPS' as the argument of the 'get()'. This argument returns the FPS in integer form.
At the starting of the program, we have taken an integer variable named 'FPS'. Then we used FPS = cap.get(CAP_PROP_FPS); to store the FPS value in the variable.
The following program gets the FPS of a video and shows it in the console window.
Example
#include<opencv2/opencv.hpp>//OpenCV header to use VideoCapture class// #include<iostream> using namespace std; using namespace cv; int main() { int FPS;//Declaring an integer variable to store the number of total frames// VideoCapture cap("video1.mp4");//Declaring an object to capture stream of frames from default camera// FPS = cap.get(CAP_PROP_FPS);//Getting the total number of frames// cout << "Total Number of frames are:" << FPS << endl;//Showing the number in console window// system("pause");//Pausing the system to see the result cap.release();//Releasing the buffer memory// return 0; }
After launching this program, we will get the FPS value in the console window.
Output
Advertisements