Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hey, the problem is that CV_CAP_PROP_FPS isn´t implemented yet. If you look at highgui/src/cap_libv4l2.cpp you´ll find this switch case in function icvGetPropertyCAM_V4L ...

  switch (property_id) {
case CV_CAP_PROP_FRAME_WIDTH:
case CV_CAP_PROP_FRAME_HEIGHT:
  CLEAR (capture->form);
  capture->form.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
  if (-1 == xioctl (capture->deviceHandle, VIDIOC_G_FMT, &capture->form)) {
      /* display an error message, and return an error code */
      perror ("VIDIOC_G_FMT");
    if (v4l1_ioctl (capture->deviceHandle, VIDIOCGWIN, &capture->captureWindow) < 0) {
      fprintf (stderr, "HIGHGUI ERROR: V4L:cap_libv4l: Unable to determine size of incoming image\n");
      icvCloseCAM_V4L(capture);
      return -1;
    } else {
      int retval = (property_id == CV_CAP_PROP_FRAME_WIDTH)?capture->captureWindow.width:capture->captureWindow.height;
      return retval / 0xFFFF;
    }
  }
  return (property_id == CV_CAP_PROP_FRAME_WIDTH)?capture->form.fmt.pix.width:capture->form.fmt.pix.height;
case CV_CAP_PROP_BRIGHTNESS:
  sprintf(name, "Brightness");
  capture->control.id = V4L2_CID_BRIGHTNESS;
  break;
case CV_CAP_PROP_CONTRAST:
  sprintf(name, "Contrast");
  capture->control.id = V4L2_CID_CONTRAST;
  break;
case CV_CAP_PROP_SATURATION:
  sprintf(name, "Saturation");
  capture->control.id = V4L2_CID_SATURATION;
  break;
case CV_CAP_PROP_HUE:
  sprintf(name, "Hue");
  capture->control.id = V4L2_CID_HUE;
  break;
case CV_CAP_PROP_GAIN:
  sprintf(name, "Gain");
  capture->control.id = V4L2_CID_GAIN;
  break;
case CV_CAP_PROP_EXPOSURE:
  sprintf(name, "Exposure");
  capture->control.id = V4L2_CID_EXPOSURE;
  break;
case CV_CAP_PROP_FOCUS:
  sprintf(name, "Focus");
  capture->control.id = V4L2_CID_FOCUS_ABSOLUTE;
  break;
default:
  sprintf(name, "<unknown property string>");
  capture->control.id = property_id;

....

As you can see your error is the default case. But you can modify this file. But i think it is easy to implement, try:

    case CV_CAP_PROP_FPS:
  sprintf(name, "Focus");
  return capture->GetFrameRate() ;

I´ve did the same with CV_CAP_PROP_FOCUS an it works fine.

Best