I want to extract frames from a video file.But how will i know at what fps to extract the frames? I have been using the code below but
long frameCounter = 0;
std::time_t timeBegin = std::time(0);
int tick = 0;
cv::Mat frame;
while (1)
{
cam.read(frame);
cv::imshow("Img", frame);
cv::waitKey(1);
frameCounter++;
std::time_t timeNow = std::time(0) - timeBegin;
if (timeNow - tick >= 1)
{
tick++;
cout << "Frames per second: " << frameCounter << endl;
frameCounter = 0;
}
}