Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version
Try
int FPS = (int)cap.get(CAP_PROP_FPS);

if it doesn't work try :

  VideoCapture cap(YOUR_CAM_INDEX)
  time_t cap_start, cap_end;
  Mat frame;
  MAX_FRAM_NUM = 100;
  time(&start);
  for(int n = 0; n < MAX_FRAM_NUM n++){cap >> frame;}
  time(&end);
  double fps = fps  = MAX_FRAM_NUM / difftime (end, start);

  

Try
int FPS = (int)cap.get(CAP_PROP_FPS);

if it doesn't work try :

  VideoCapture cap(YOUR_CAM_INDEX)
  time_t cap_start, cap_end;
  Mat frame;
  MAX_FRAM_NUM = 100;
  time(&start);
  for(int n = 0; n < MAX_FRAM_NUM n++){cap >> frame;}
  time(&end);
  double fps = fps  = MAX_FRAM_NUM / difftime (end, start);

  
I also checked code you posted and you're modifying width & height from source before calculating fps.