#include "opencv2/opencv.hpp"
#include <time.h>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
VideoCapture video(0);
double fps = video.get(cv::CAP_PROP_FPS);
cout << "Frames per second using video.get(CV_CAP_PROP_FPS) : " << fps << endl;
int num_frames = 120;
time_t start, end;
Mat frame;
cout << "Capturing " << num_frames << " frames" << endl ;
time(&start);
for(int i = 0; i < num_frames; i++)
{
video >> frame;
}
time(&end);
double seconds = difftime (end, start);
cout << "Time taken : " << seconds << " seconds" << endl;
fps = num_frames / seconds;
cout << "Estimated frames per second : " << fps << endl;
video.release();
return 0;
}