Changing capture resolution cv2 in python doesn't work

asked 2015-02-13 12:19:19 -0600

Max11 gravatar image

updated 2018-01-07 05:08:34 -0600

Hi,

I am trying to change the capture resolution in cv2 in python. I already looked up some posts about it, like http://opencv-python-tutroals.readthe... , but the command sequence there doesn't seem to work for me.

Here is my piece of code:

channel = 0

camera = _cv2.VideoCapture(channel)

camera.set(_cv2.cv.CV_CAP_PROP_FRAME_WIDTH, 1280)

camera.set(_cv2.cv.CV_CAP_PROP_FRAME_HEIGHT, 1024)

print camera.get(_cv2.cv.CV_CAP_PROP_FRAME_WIDTH)

print camera.get(_cv2.cv.CV_CAP_PROP_FRAME_HEIGHT)

And the print out is:

640.0

480.0

Can anyone help me with this issue?

Thanks in advance!

Max

edit retag flag offensive close merge delete

Comments

1

it means, that your camera driver does not support this resolution.

please check the return value of camera.set(...)

berak gravatar imageberak ( 2015-02-13 12:21:28 -0600 )edit

However, when I use the same camera with a commercially available software, I have a resolution of 1280x1024. So why would this not be supported then?

Max11 gravatar imageMax11 ( 2015-02-16 09:51:34 -0600 )edit