grenadier
grenadier

Reputation: 413

Unable to change frame height, width in OpenCV

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) 

...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?

For what it's worth, I'm running this code on windows 8.1.

Upvotes: 3

Views: 2582

Answers (2)

asif
asif

Reputation: 1015

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.

Upvotes: 1

Martin Beckett
Martin Beckett

Reputation: 96109

It's often not possible to change the camera settings through openCV.

It depends on how well the camera implements the interface to Microsoft's Directshow. Since Directshow is difficult to understand, poorly documented and hard to test and cameras are cheaply made.....

Upvotes: 1

Related Questions