nutron
Posts: 8
Joined: Sat Apr 28, 2018 3:36 am

Re: Official V4L2 driver

Wed Aug 28, 2019 8:46 pm

Thanks

drmatt
Posts: 8
Joined: Sat Sep 07, 2019 3:47 am

Re: Official V4L2 driver

Sat Sep 07, 2019 4:17 am

Thank you for all your work on this driver.

The camera's analog and digital gains can be set indirectly via V4L2_CID_ISO_SENSITIVITY, but it looks like there are only a few discrete steps available. This does not, for instance, allow the v2 camera gain to be set to 1, since the lowest ISO of 100 is tuned to about 1.84. It would be useful to be able to have finer-grained control over these parameters.

I've been able to set the gains via MMAL calls in python/picamera, and I believe there is also a pending PR that will allow them to be set directly via the analog_gain and digital_gain members of the PiCamera class.

Is there any plan to directly expose the camera's analog and digital gain parameters via V4L2 (perhaps V4L2_CID_ANALOGUE_GAIN and V4L2_CID_GAIN)?

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

Re: Official V4L2 driver

Sun Sep 08, 2019 7:48 am

I hadn't any plans to add analog and digital gain controls to the v4l2 driver, but it can be done by anyone. Pull requests are always welcome.
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.

drmatt
Posts: 8
Joined: Sat Sep 07, 2019 3:47 am

Re: Official V4L2 driver

Mon Sep 09, 2019 1:12 am

I hadn't any plans to add analog and digital gain controls to the v4l2 driver, but it can be done by anyone. Pull requests are always welcome.
Understood, thanks. Digging around a bit in the raspberry pi linux repo, it looks like a good place to start would be drivers/staging/vc04_services/bcm2835-camera/ (specifically controls.c, bmc2835-camera.h, mmal-parameters.h). So I'll next read up on how to build and test.

bhjel
Posts: 17
Joined: Tue Jan 01, 2019 2:00 am

Re: Official V4L2 driver

Thu Sep 12, 2019 2:43 am

Any thoughts on adding a 4x4 binning, 320x240 "mode 8" to the v4l2 driver for the imx219? This would be immensely useful for our computer vision application.

FPSUsername
Posts: 4
Joined: Tue Oct 31, 2017 9:08 pm

Re: Official V4L2 driver

Mon Sep 23, 2019 3:30 pm

6by9 wrote:
Sun Jul 26, 2015 8:14 pm
gjimenez wrote:Hi, Is roi supported now on the official v4l2 driver?
Not yet. I got the initial part working following on from byterg's initial patch, but need to ensure that it is the correct way within the V4L2 framework and gets advertised correctly.
Hello,

I developed a driver for a sensor that supports ROI modes, yet it doesn't seem that the V4L2 driver has any information regarding this.
If you did implement ROI mode, did you crop a ROI from a full frame or did you actually implement the sensor's ROI mode?
Do you have a source code that I could look at?

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

Re: Official V4L2 driver

Mon Sep 23, 2019 3:53 pm

bhjel wrote:
Thu Sep 12, 2019 2:43 am
Any thoughts on adding a 4x4 binning, 320x240 "mode 8" to the v4l2 driver for the imx219? This would be immensely useful for our computer vision application.
There is an open offer that if someone provides a full register set in a shape that can be merged into raspiraw then I would look at merging it into the firmware. There is a half attempt at https://github.com/6by9/raspiraw/pull/21, but it's not as a new mode that I can integrate easily.
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.

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

Re: Official V4L2 driver

Mon Sep 23, 2019 5:03 pm

FPSUsername wrote:
Mon Sep 23, 2019 3:30 pm
6by9 wrote:
Sun Jul 26, 2015 8:14 pm
gjimenez wrote:Hi, Is roi supported now on the official v4l2 driver?
Not yet. I got the initial part working following on from byterg's initial patch, but need to ensure that it is the correct way within the V4L2 framework and gets advertised correctly.
Hello,

I developed a driver for a sensor that supports ROI modes, yet it doesn't seem that the V4L2 driver has any information regarding this.
If you did implement ROI mode, did you crop a ROI from a full frame or did you actually implement the sensor's ROI mode?
Do you have a source code that I could look at?
Using what framework?
This thread is about the bcm2835-v4l2 driver that makes use of the (closed source) firmware drivers for accessing the camera. There is also the bcm2835-unicam (open source) CSI2 driver that allows adding of Linux kernel drivers for sensors

I don't see how you can have done the former.
The latter doesn't have the g_selection and s_selection ops implemented, but they're trivial to do. I suspect it's pretty much a copy paste of unicam_s_edid/unicam_g_edid in just forwarding the request straight through to the sensor subdev in https://github.com/raspberrypi/linux/bl ... 5-unicam.c
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.

hazeii
Posts: 31
Joined: Sat Apr 25, 2015 8:33 am

Re: Official V4L2 driver

Fri Nov 15, 2019 1:40 pm

Hopefully a simple question, is there any automatic gain control or similar going on behind the scenes (i.e. in the firmware)? We're using a lot of Pis with V2 cameras for computer vision in controlled environments (basically closed tanks with fixed LED lighting), and on some of them we're getting occasionaly substantial brightness variations in the camera images, generally over a period of a few seconds.

So far we've tried turning off all the obvious 'auto' controls in v4l2 (gain, iso, exposure etc) but it doesn't seem to fix the issue (which is intermittent and so far been difficult to reproduce locally). I've looked through the driver code and we seem to covered all the controls, hence we were wondering if there's anything in the firmware that could cause it, i.e. some sort of noise reduction or other auto-adjustment? Any pointers or suggestions gratefully received!

Return to “Camera board”