Ask Your Question
2

Frame Rate of Live Capture

asked 2012-08-20 12:50:52 -0600

Himanshu gravatar image

Hi,

I know to find frame rate from a video, we can use the capture property and ID:CV_CAP_PROP_FPS.

But how to find the frame rate of a live capture? the capture property (CV_CAP_PROP_FPS) doesn't work for live capture.

Thanks.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2012-08-21 02:28:02 -0600

updated 2012-08-22 01:30:08 -0600

You can always do something like this:

...
//Open camera and so on...
...
while(1)
{

  double t = (double)cv::getTickCount();
  //Capture new frame...
  ...
  // Do your stuff...
  ...
  t = ((double)cv::getTickCount() - t) / cv::getTickFrequency();// elapsed time in ms
  std::cout << "I am working at " << 1000.0/t << " FPS" << std::endl;

}

Hope this helps

edit flag offensive delete link more

Comments

Hi,

Martin, thanks for your reply.

I did what you suggested and i am still getting approx. 0 FPS.

Thanks.

Himanshu gravatar imageHimanshu ( 2012-08-21 10:26:09 -0600 )edit

oooops, my bad! In the end t is expressed in milliseconds!! How about: std::cout << "I am working at " << 1000.0/t << " FPS" << std::endl;

Martin Peris gravatar imageMartin Peris ( 2012-08-22 01:22:05 -0600 )edit

t is expressed in microseconds! so used 1000000/t; but the problem now i am facing is the FPS is varying!

Himanshu gravatar imageHimanshu ( 2012-08-24 14:13:56 -0600 )edit

Question Tools

Stats

Asked: 2012-08-20 12:50:52 -0600

Seen: 6,723 times

Last updated: Aug 22 '12