Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How do I adjust FPS for a v4l2 camera

How can I adjust the FPS that my v4l2 camera captures at?

How do I adjust FPS for a v4l2 camera

How can I adjust the FPS that my v4l2 camera captures at?

The following patch seems to solve it, but is there any other way? From 0ad873a3682a1d7354b8c233e71fc76c7bb319b1 Mon Sep 17 00:00:00 2001 From: Anders Musikka [email protected] Date: Wed, 13 Feb 2013 08:45:04 +0100 Subject: [PATCH] Add FPS adjust possibility


modules/highgui/src/cap_libv4l.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)

diff --git a/modules/highgui/src/cap_libv4l.cpp b/modules/highgui/src/cap_libv4l.cpp index 63a2ff9..179c90f 100644 --- a/modules/highgui/src/cap_libv4l.cpp +++ b/modules/highgui/src/cap_libv4l.cpp @@ -1665,6 +1665,22 @@ static int icvSetPropertyCAM_V4L(CvCaptureCAM_V4L* capture, int property_id, dou width = height = 0; } break; + case CV_CAP_PROP_FPS: + { + struct v4l2_streamparm streamparm; + struct v4l2_fract *tpf; + memset (&streamparm, 0, sizeof (streamparm)); + streamparm.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + tpf = &streamparm.parm.capture.timeperframe; + tpf->numerator = 1; + tpf->denominator = cvRound(value); + retval=1; + if (ioctl(capture->deviceHandle, VIDIOC_S_PARM, &streamparm) < 0) { + fprintf(stderr,"Failed to set camera FPS: %s\n",strerror(errno)); + retval=0; + } + break; + } default: retval = icvSetControl(capture, property_id, value);

}

1.7.9.5

How do I adjust FPS for a v4l2 camera

How can I adjust the FPS that my v4l2 camera captures at?

The following patch seems to solve it, but is there any other way? From 0ad873a3682a1d7354b8c233e71fc76c7bb319b1 Mon Sep 17 00:00:00 2001 From: Anders Musikka [email protected] Date: Wed, 13 Feb 2013 08:45:04 +0100 Subject: [PATCH] Add FPS adjust possibility


---
 modules/highgui/src/cap_libv4l.cpp |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

insertions(+) diff --git a/modules/highgui/src/cap_libv4l.cpp b/modules/highgui/src/cap_libv4l.cpp index 63a2ff9..179c90f 100644 --- a/modules/highgui/src/cap_libv4l.cpp +++ b/modules/highgui/src/cap_libv4l.cpp @@ -1665,6 +1665,22 @@ static int icvSetPropertyCAM_V4L(CvCaptureCAM_V4L* capture, int property_id, dou width = height = 0; } break; + case CV_CAP_PROP_FPS: + { + struct v4l2_streamparm streamparm; + struct v4l2_fract *tpf; + memset (&streamparm, 0, sizeof (streamparm)); + streamparm.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + tpf = &streamparm.parm.capture.timeperframe; + tpf->numerator = 1; + tpf->denominator = cvRound(value); + retval=1; + if (ioctl(capture->deviceHandle, VIDIOC_S_PARM, &streamparm) < 0) { + fprintf(stderr,"Failed to set camera FPS: %s\n",strerror(errno)); + retval=0; + } + break; + } default: retval = icvSetControl(capture, property_id, value);

}

1.7.9.5

value); } -- 1.7.9.5

How do I adjust FPS for a v4l2 camera

How can I adjust the FPS that my v4l2 camera captures at?

The following patch seems to solve it, but is there any other way? From 0ad873a3682a1d7354b8c233e71fc76c7bb319b1 way?

From 0ad873a3682a1d7354b8c233e71fc76c7bb319b1 Mon Sep 17 00:00:00 2001 2001 From: Anders Anders Musikka [email protected] Date: Wed, 13 Feb 2013 08:45:04 +0100 Subject: [PATCH] Add FPS adjust adjust possibility

---
 modules/highgui/src/cap_libv4l.cpp |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/modules/highgui/src/cap_libv4l.cpp b/modules/highgui/src/cap_libv4l.cpp
index 63a2ff9..179c90f 100644
--- a/modules/highgui/src/cap_libv4l.cpp
+++ b/modules/highgui/src/cap_libv4l.cpp
@@ -1665,6 +1665,22 @@ static int icvSetPropertyCAM_V4L(CvCaptureCAM_V4L* capture, int property_id, dou
             width = height = 0;
         }
         break;
+    case CV_CAP_PROP_FPS:
+    {
+        struct v4l2_streamparm streamparm;
+        struct v4l2_fract *tpf;
+        memset (&streamparm, 0, sizeof (streamparm));
+        streamparm.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+        tpf = &streamparm.parm.capture.timeperframe;
+        tpf->numerator = 1;
+        tpf->denominator = cvRound(value);
+        retval=1;
+        if (ioctl(capture->deviceHandle, VIDIOC_S_PARM, &streamparm) < 0) {
+            fprintf(stderr,"Failed to set camera FPS: %s\n",strerror(errno));
+            retval=0;
+        }
+        break;
+    }
     default:
         retval = icvSetControl(capture, property_id, value);
     }
-- 
1.7.9.5