Ask Your Question
0

Changing camera resolution in Python

asked 2014-11-23 03:13:51 -0600

Jesus151089 gravatar image

Hello,

I´m trying to change my camera resolution to 320X240 on Raspberry Pi using Python. This link http://docs.opencv.org/master/doc/py_tutorials/py_gui/py_video_display/py_video_display.html#display-video says that one can type the following to change the parameters

ret = cap.set(3,320) and ret = cap.set(4,240)

I have not figured out how this work. Has anyone faced the same situation?

edit retag flag offensive close merge delete

Comments

First of all you need to be sure that your camera allows the changing of the resultion through its connection. Secondly I suggest using the correct parameters instead of using integer values. If the changed in the process, then it won't work anymore. Try this code

 ret = cap.set(CV_CAP_PROP_FRAME_WIDTH,320);
 ret = cap.set(CV_CAP_PROP_FRAME_HEIGHT,240);

Good luck!

StevenPuttemans gravatar imageStevenPuttemans ( 2014-11-26 07:49:44 -0600 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2014-11-25 16:35:18 -0600

ret is the return value from the function set(). I assume if successful ret = 1, if unsuccessful ret = 0.

The first parameter states what is being set, 3 = width and 4 = height.

The second parameter states the value to be set to.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-11-23 03:13:51 -0600

Seen: 9,403 times

Last updated: Nov 25 '14