Ask Your Question

Revision history [back]

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();
  std::cout << "I am working at " << 1.0/t << " FPS" << std::endl;

}

Hope this helps

click to hide/show revision 2
fixed error with time units

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();
cv::getTickFrequency();// elapsed time in ms
  std::cout << "I am working at " << 1.0/t 1000/t << " FPS" << std::endl;

}

Hope this helps

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/t 1000.0/t << " FPS" << std::endl;

}

Hope this helps