Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 600

How to find frame per second of a dynamic movement?

$
0
0
Here is my code..i am able to extract frames, but how to extract the frames per second for a dynamic movement?? #include "opencv2/opencv.hpp" #include #include #include #include using namespace cv; using namespace std; const char* videofilename = "(online-video-cutter.com).mp4"; VideoCapture cap(videofilename); // open a video file int main(int argc, char** argv) { if (!cap.isOpened()) // check if succeeded { cout << "file " << videofilename << " not found or could not be opened" << endl; return -1; } namedWindow("output"); unsigned long counter = 0; Mat frame; // read frames until end of video: while (cap.read(frame)) { // display frame imshow("output", frame); waitKey(25); // remove this line if you don't need the live output // adjust the filename by incrementing a counter std::stringstream filename(std::stringstream::in | std::stringstream::out); filename << "image" << counter++ << ".jpg"; std::cout << "writing " << filename.str().c_str() << " to disk" << std::endl; // save frame to file: image0.jpg, image1.jpg, and so on... imwrite(filename.str().c_str(), frame); } return 0; }

Viewing all articles
Browse latest Browse all 600

Latest Images

Trending Articles



Latest Images