- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to get the 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
- Related Articles
- How to get the value of a specific pixel in OpenCV using C++?
- How to get the position of the current frame in OpenCV using C++?
- How to read the pixel value from the multichannel image in OpenCV using C++?
- What is FPS?
- How to read the pixel value of a single channel image in OpenCV using C++?
- How to access and modify pixel value in an image using OpenCV Python?
- How to get the fourth highest value using MySQL query?
- How to get the value of div content using jQuery?
- How to get pixels (RGB values) of an image using Java OpenCV library?
- How to detect the color using OpenCV in C++?
- How to track the color in OpenCV using C++?
- How to detect the eye in OpenCV using C++?
- How to track the eye in OpenCV using C++?
- How to get environment variable value using PowerShell?
- How to reduce the color using Iterator Method in OpenCV?

Advertisements