问题描述
我正在使用OpenCV python绑定来组合快速script/prototype
,但是出于某些奇怪的原因,
I'm using the OpenCV python bindings to put together a quick script/prototype
, but for some odd reason,
camera.set(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT, 640.0)
...什么都不做.这样,我的意思是它返回True
,但是帧高是恒定的.不,返回常量不是错误,因为camera.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT)
将返回240.0
作为默认值.
...does nothing at all. By this, I mean it returns True
, but the frame height is constant. No, returning a constant is not a fault, as camera.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT)
will return 240.0
as the default value.
我不知道为什么会失败.有什么想法吗?
I don't have any clue on why is this failing. Any ideas?
对于它的价值,我正在windows 8.1
上运行此代码.
For what it's worth, I'm running this code on windows 8.1
.
推荐答案
您必须同时设置 WIDTH 和 HEIGHT 才能更改相机分辨率.有人说更改高度会自动调整宽度,但这对我没有用.
You have to set both WIDTH and HEIGHT in order to change camera resolution. Some says that changing the height automatically adjusts the width, but this did not worked for me.
有关此主题,请参阅我的其他答案.
See my other answer on this topic.
这篇关于无法在OpenCV中更改框架的高度和宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!