vic*_*234 15 camera opencv frame-rate
如何设置相机FPS?
可能是cvSetCaptureProperty(cameraCapture,CV_CAP_PROP_FPS,30); ?
但它返回HIGHGUI ERROR:V4L2:无法获取属性(5) - 参数无效
因为highgui/cap_v4l.cpp中没有实现
static int icvSetPropertyCAM_V4L( CvCaptureCAM_V4L* capture,
int property_id, double value ){
static int width = 0, height = 0;
int retval;
/* initialization */
retval = 0;
/* two subsequent calls setting WIDTH and HEIGHT will change
the video size */
/* the first one will return an error, though. */
switch (property_id) {
case CV_CAP_PROP_FRAME_WIDTH:
width = cvRound(value);
if(width !=0 && height != 0) {
retval = icvSetVideoSize( capture, width, height);
width = height = 0;
}
break;
case CV_CAP_PROP_FRAME_HEIGHT:
height = cvRound(value);
if(width !=0 && height != 0) {
retval = icvSetVideoSize( capture, width, height);
width = height = 0;
}
break;
case CV_CAP_PROP_BRIGHTNESS:
case CV_CAP_PROP_CONTRAST:
case CV_CAP_PROP_SATURATION:
case CV_CAP_PROP_HUE:
case CV_CAP_PROP_GAIN:
case CV_CAP_PROP_EXPOSURE:
retval = icvSetControl(capture, property_id, value);
break;
default:
fprintf(stderr,
"HIGHGUI ERROR: V4L: setting property #%d is not supported\n",
property_id);
}
/* return the the status */
return retval;
}
Run Code Online (Sandbox Code Playgroud)
怎么解决?
小智 17
使用opencv的python包装器,我可以将变量称为:
cap = cv2.VideoCapture(1)
cap.set(cv2.cv.CV_CAP_PROP_FPS, 60)
Run Code Online (Sandbox Code Playgroud)
我使用的是python 2.7.3和opencv 2.4.8
相机是PS3 Eye
CV_CAP_PROP_FPS 不是假的.请参阅OpenCV github repo中的cap_libv4l.cpp(1).关键是要确保在配置OpenCV时使用libv4l over v4l.为此,在运行cmake之前,请安装libv4l-dev
sudo apt-get install libv4l-dev
Run Code Online (Sandbox Code Playgroud)
现在,在使用cmake配置OpenCV时,启用选项,WITH_LIBV4L.如果一切顺利,在配置状态下,您将看到类似于下面的内容
V4L/V4L2:使用libv4l1(ver)/ libv4l2(ver)
然后在构建OpenCV代码时,您必须链接libv4l1/libv4l2/libv4lconvert.
您选择的分辨率下的仲裁FPS值不需要您的网络摄像头支持.您可以使用图形工具(如奶酪)或lsusb(2)等命令检查支持的分辨率/ fps