gpt4 book ai didi

opencv - 如何在 OpenCV 中设置相机 FPS? CV_CAP_PROP_FPS 是假的

转载 作者:太空宇宙 更新时间:2023-11-03 20:38:49 25 4
gpt4 key购买 nike

如何设置相机FPS?

可能是cvSetCaptureProperty(cameraCapture, CV_CAP_PROP_FPS, 30);?

但它是返回HIGHGUI 错误: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;
}

如何解决?

最佳答案

使用 opencv 的 python 包装器,我可以将变量引用为:

cap = cv2.VideoCapture(1)
cap.set(cv2.cv.CV_CAP_PROP_FPS, 60)

我正在使用 python 2.7.3 和 opencv 2.4.8

相机是PS3 Eye

关于opencv - 如何在 OpenCV 中设置相机 FPS? CV_CAP_PROP_FPS 是假的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7039575/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com