megasoft
Posts: 11
Joined: Wed Feb 18, 2015 12:55 pm

Camera settings and configuration with OpenCV

Wed Feb 18, 2015 12:59 pm

Is there a programmatic way to control camera settings? Assuming OpenCV needs to use one of the RaspiCam drivers (the official V4L or unofficial user space driver), how can I change the white balance for example?

Thanks

megasoft
Posts: 11
Joined: Wed Feb 18, 2015 12:55 pm

Re: Camera settings and configuration with OpenCV

Wed Feb 18, 2015 3:48 pm

Ok, I found here: http://www.linux-projects.org/modules/s ... e&artid=14

That there is a config file at: /etc/uv4l/uv4l-raspicam.conf and I believe I can use the awb option.

Is there such a conf file for the official driver as well?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8931
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Camera settings and configuration with OpenCV

Wed Feb 18, 2015 5:01 pm

megasoft wrote:Is there such a conf file for the official driver as well?
No, as the correct way to set that sort of thing is via the V4L2 API and control V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE. Whether OpenCV provides suitable controls to set that is another question.

You can use v4l2-ctl from the command line instead

Code: Select all

v4l2-ctl --set-ctrl=auto_n_preset_white_balance=N
where N is 0 to 9 for the different modes (search http://hverkuil.home.xs4all.nl/spec/media.html for V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE and it lists them in order, starting with 0 being manual).
V4L2 caches all settings, so once the driver is loaded and you change the setting once, it should persist until the driver is unloaded or the device rebooted.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

megasoft
Posts: 11
Joined: Wed Feb 18, 2015 12:55 pm

Re: Camera settings and configuration with OpenCV

Thu Feb 19, 2015 7:03 am

Thanks a lot!

Return to “Camera board”