maurosanjo
Posts: 1
Joined: Fri Jun 28, 2019 8:41 pm

AWB Off does not work and fixed whitebalance gains cannot be set

Wed Jul 31, 2019 8:18 pm

Hello,

I'm testing a Raspicam NoIR v2.1 8Mp with a Raspberry Pi Zero W, and I can't manage to fix the whitebalance gains not with raspistill and neither with my custom MMAL driver based on userland repo examples.

For instance check the output below, it starts in a white balance values for R and B depending on what the camera is capturing, and when I place an object in the field of view you can see the white balance changing when it should be OFF.

Code: Select all

raspberrypi0-wifi:~$ raspistill -set -awb off -awbg 3.0,1.0 -t 0 -ex off -ss 5000 -o test.png
Camera control callback  cmd=0x48435045mmal: Exposure now 5000, analog gain 256/256, digital gain 256/256
mmal: AWB R=310/256, B=817/256
Camera control callback  cmd=0x48435045mmal: Exposure now 5000, analog gain 256/256, digital gain 256/256
mmal: AWB R=310/256, B=817/256
Camera control callback  cmd=0x48435045mmal: Exposure now 5000, analog gain 256/256, digital gain 256/256
mmal: AWB R=387/256, B=477/256
Regards

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 24934
Joined: Sat Jul 30, 2011 7:41 pm

Re: AWB Off does not work and fixed whitebalance gains cannot be set

Fri Aug 09, 2019 9:24 am

We have a fix for this, and it will be in rpi-update in the next few days.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I own the world’s worst thesaurus. Not only is it awful, it’s awful."

roelfraspi
Posts: 8
Joined: Wed Jun 26, 2019 9:46 pm

Re: AWB Off does not work and fixed whitebalance gains cannot be set

Sat Aug 10, 2019 5:33 pm

Seems to have to do with the new awb setting -awb greyworld . Just updated the firmware with rpi-update.and it works fine again and the greyworld option as added value.

I take that back, works not for the color, only the color of the thumbnails.

Budman65
Posts: 2
Joined: Tue Aug 27, 2019 2:28 pm

Re: AWB Off does not work and fixed whitebalance gains cannot be set

Tue Aug 27, 2019 2:33 pm

I have a pi4 with a NOIR camera and the latest firmware update as of today. I am developing and application the required awb_gains control, but, can not set.

camera.awb_mode = 'off'
camera.awb_gains(1.0,3.0)


has no effect.

regards,

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 24934
Joined: Sat Jul 30, 2011 7:41 pm

Re: AWB Off does not work and fixed whitebalance gains cannot be set

Tue Aug 27, 2019 5:32 pm

We are aware and a fix is being prepared.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I own the world’s worst thesaurus. Not only is it awful, it’s awful."

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 24934
Joined: Sat Jul 30, 2011 7:41 pm

Re: AWB Off does not work and fixed whitebalance gains cannot be set

Wed Sep 04, 2019 9:33 am

This fix should now be in rpi-update - not sure about apt, may not have made it there yet. rpi-update brings in beta software, so should be used with case. Perhaps try an "sudo apt update" first, if that doesn't fix it, try an "rpi-update" on a test system.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I own the world’s worst thesaurus. Not only is it awful, it’s awful."

arau
Posts: 4
Joined: Wed Sep 04, 2019 6:58 pm

Re: AWB Off does not work and fixed whitebalance gains cannot be set

Wed Sep 04, 2019 7:03 pm

Hi all,
I've also been experiencing this problem with a Picamera V2 with added M12 lens (from a third party seller) and Pi Model 3B. I tried implementing the fix by running sudo rpi-update, however, am still seeing my problem. When I set AWB gains to fixed and then set the gains (with sleep times after) I take a preview against a white background and see that when I move an object close to the camera (within a foot), the edges of the image change and look red.
How can I test to see if this is an AWB problem or another problem with my setup?
Thanks!

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

Re: AWB Off does not work and fixed whitebalance gains cannot be set

Wed Sep 04, 2019 8:25 pm

arau wrote:
Wed Sep 04, 2019 7:03 pm
Hi all,
I've also been experiencing this problem with a Picamera V2 with added M12 lens (from a third party seller) and Pi Model 3B. I tried implementing the fix by running sudo rpi-update, however, am still seeing my problem. When I set AWB gains to fixed and then set the gains (with sleep times after) I take a preview against a white background and see that when I move an object close to the camera (within a foot), the edges of the image change and look red.
How can I test to see if this is an AWB problem or another problem with my setup?
Thanks!
If using raspistill or raspivid, then add -set to the command line. This will print out all changes to exposure time, analogue gain, digital gain, or AWB red and blue gains to stderr. See if they change.
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.

Budman65
Posts: 2
Joined: Tue Aug 27, 2019 2:28 pm

Re: AWB Off does not work and fixed whitebalance gains cannot be set

Wed Sep 04, 2019 8:48 pm

The PiCamera fix that was reference as available 4 Sept 2019 does indeed allow the gain to be adjusted manually on the Pi 4, but, setting gain controls back to auto after setting gains manually now does not work(gains stay fixed). Also setting the camera mode up to use ISO above 200 now produces strange artifacts in the image???

arau
Posts: 4
Joined: Wed Sep 04, 2019 6:58 pm

Re: AWB Off does not work and fixed whitebalance gains cannot be set

Thu Sep 05, 2019 2:57 am

6by9 wrote:
Wed Sep 04, 2019 8:25 pm
arau wrote:
Wed Sep 04, 2019 7:03 pm
Hi all,
I've also been experiencing this problem with a Picamera V2 with added M12 lens (from a third party seller) and Pi Model 3B. I tried implementing the fix by running sudo rpi-update, however, am still seeing my problem. When I set AWB gains to fixed and then set the gains (with sleep times after) I take a preview against a white background and see that when I move an object close to the camera (within a foot), the edges of the image change and look red.
How can I test to see if this is an AWB problem or another problem with my setup?
Thanks!
If using raspistill or raspivid, then add -set to the command line. This will print out all changes to exposure time, analogue gain, digital gain, or AWB red and blue gains to stderr. See if they change.
Thank you,I used the command: raspivid -t 20000 -o test2.mp4 -w 1232 -h 1640 -awb off -awbg 1.5,1.5 -set. The gains printed did not change throughout the video recording, however the color still changed. Could the reported AWB be off or is it more likely something else is going on?
Thanks!

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

Re: AWB Off does not work and fixed whitebalance gains cannot be set

Fri Sep 06, 2019 9:12 am

arau wrote:
Thu Sep 05, 2019 2:57 am
Thank you,I used the command: raspivid -t 20000 -o test2.mp4 -w 1232 -h 1640 -awb off -awbg 1.5,1.5 -set. The gains printed did not change throughout the video recording, however the color still changed. Could the reported AWB be off or is it more likely something else is going on?
Thanks!
I suspect you're seeing the automatic lens shading correction trying to compensate for a lens it has no idea over.
Seeing as you've changed the lens you should really be providing your own lens shading tables - see https://www.raspberrypi.org/forums/view ... 3&t=190586
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.

arau
Posts: 4
Joined: Wed Sep 04, 2019 6:58 pm

Re: AWB Off does not work and fixed whitebalance gains cannot be set

Tue Sep 10, 2019 12:14 am

6by9 wrote:
Fri Sep 06, 2019 9:12 am
arau wrote:
Thu Sep 05, 2019 2:57 am
Thank you,I used the command: raspivid -t 20000 -o test2.mp4 -w 1232 -h 1640 -awb off -awbg 1.5,1.5 -set. The gains printed did not change throughout the video recording, however the color still changed. Could the reported AWB be off or is it more likely something else is going on?
Thanks!
I suspect you're seeing the automatic lens shading correction trying to compensate for a lens it has no idea over.
Seeing as you've changed the lens you should really be providing your own lens shading tables - see https://www.raspberrypi.org/forums/view ... 3&t=190586
Thanks 6by9, I am trying to implement it now but before I go through the work to implement the lens shading table I want to see if this issue is improved by disabling the ISP processing block for custom lens shading. I'm having trouble doing so because it seems like the code provided in https://www.raspberrypi.org/forums/view ... 1&start=25 is for C, but I am using python and PiCamera. Is there python code for this?

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

Re: AWB Off does not work and fixed whitebalance gains cannot be set

Tue Sep 10, 2019 6:14 am

arau wrote:
Tue Sep 10, 2019 12:14 am
Thanks 6by9, I am trying to implement it now but before I go through the work to implement the lens shading table I want to see if this issue is improved by disabling the ISP processing block for custom lens shading. I'm having trouble doing so because it seems like the code provided in https://www.raspberrypi.org/forums/view ... 1&start=25 is for C, but I am using python and PiCamera. Is there python code for this?
Please read the documentation that is provided https://picamera.readthedocs.io/en/late ... isp_blocks

And there is a pr for adding lens shading tables to picamera too https://github.com/waveform80/picamera/pull/470
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.

arau
Posts: 4
Joined: Wed Sep 04, 2019 6:58 pm

Re: AWB Off does not work and fixed whitebalance gains cannot be set

Tue Sep 10, 2019 7:25 pm

6by9 wrote:
Tue Sep 10, 2019 6:14 am
arau wrote:
Tue Sep 10, 2019 12:14 am
Thanks 6by9, I am trying to implement it now but before I go through the work to implement the lens shading table I want to see if this issue is improved by disabling the ISP processing block for custom lens shading. I'm having trouble doing so because it seems like the code provided in https://www.raspberrypi.org/forums/view ... 1&start=25 is for C, but I am using python and PiCamera. Is there python code for this?
Please read the documentation that is provided https://picamera.readthedocs.io/en/late ... isp_blocks

And there is a pr for adding lens shading tables to picamera too https://github.com/waveform80/picamera/pull/470
Thank you for this, but I'm not able to install a version of picamera that supports this command- I have tried uninstalling and reinstalling using both apt-get and pip and upgrading using pip as well and I only seem to get version 1.13, is there something different I have to do?

presish
Posts: 109
Joined: Mon Nov 17, 2014 9:40 pm

Re: AWB Off does not work and fixed whitebalance gains cannot be set

Thu Nov 28, 2019 2:03 am

Budman65 wrote:
Wed Sep 04, 2019 8:48 pm
The PiCamera fix that was reference as available 4 Sept 2019 does indeed allow the gain to be adjusted manually on the Pi 4, but, setting gain controls back to auto after setting gains manually now does not work(gains stay fixed). Also setting the camera mode up to use ISO above 200 now produces strange artifacts in the image???
did your awb testing work on raspistill? I have done update, upgrade, and rpi-update and awb still unable to be set

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

Re: AWB Off does not work and fixed whitebalance gains cannot be set

Thu Nov 28, 2019 1:30 pm

Looking at the code you are correct that once the flag for manual gains has been set, it is only cleared when the camera is shut down. I'll sort out a fix.
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.

-Dal-
Posts: 2
Joined: Fri Jan 17, 2020 11:48 am

Re: AWB Off does not work and fixed whitebalance gains cannot be set

Fri Jan 17, 2020 12:40 pm

Hi.
Is this fixed now?
It doesn't seem to work for me.

I run the camera through a python script:

Code: Select all

from datetime import datetime
from datetime import date
from picamera import PiCamera
from time import sleep

dato = datetime.now().strftime('%Y%m%d_%H%M%S')

camera = PiCamera()
#camera.start_preview()
#camera.exposure_mode = "night"
camera.ISO = 200
camera.resolution = (3280, 2464)
camera.awb_mode = "cloudy"
#camera.shutter_speed = 2000000
camera.start_preview()
sleep(10)
camera.capture ('/mnt/Fileserver/'+dato+'.jpg')
camera.stop_preview()
But AWB gets always set to Auto.
I have run rpi-update (today), but no changes.

Thanks.

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

Re: AWB Off does not work and fixed whitebalance gains cannot be set

Fri Jan 17, 2020 3:58 pm

-Dal- wrote:
Fri Jan 17, 2020 12:40 pm
Hi.
Is this fixed now?
It doesn't seem to work for me.
Annoyingly no.
I had fixed it, but had stashed the change instead of committing it :(
I'll make up the patch now.
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.

-Dal-
Posts: 2
Joined: Fri Jan 17, 2020 11:48 am

Re: AWB Off does not work and fixed whitebalance gains cannot be set

Sun Jan 19, 2020 8:55 am

Excellent news!

But how do I apply the patch when it's released?

Run run rpi-update again?

Thank you

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

Re: AWB Off does not work and fixed whitebalance gains cannot be set

Sun Jan 19, 2020 9:05 am

-Dal- wrote:
Sun Jan 19, 2020 8:55 am
Excellent news!

But how do I apply the patch when it's released?

Run run rpi-update again?

Thank you
Yes.
At the moment it's pushed for review internally. As it's only a one line change it should be fairly swift, although I have to create a patch for pi 0-3 as well (the firmwares are currently in different branches)
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.

LaTheiere
Posts: 1
Joined: Fri Jan 24, 2020 8:39 am

Re: AWB Off does not work and fixed whitebalance gains cannot be set

Fri Jan 24, 2020 10:22 am

Any update on the peer review? I'd love to see this one ticked off the list asap please, as I'm sure many others would also. Is there an alpha branch which contains the fix?

hadronmade
Posts: 1
Joined: Wed Feb 12, 2020 9:02 pm

Re: AWB Off does not work and fixed whitebalance gains cannot be set

Thu Feb 13, 2020 6:20 pm

I am also in need of a solution to the problem of re-enabling 'auto' awb_mode.

I'm tasked with fixing a few hundred systems that use these cameras and require that awb be toggled between 'auto' and 'off' on demand.
Based on a my searching thus far, today this thread seems to have the most current info with regards to this issue. Any update about when the fix will be released or any other useful references would be a great help.

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

Re: AWB Off does not work and fixed whitebalance gains cannot be set

Thu Feb 13, 2020 7:11 pm

https://github.com/Hexxeh/rpi-firmware/ ... e5b1e848dd
firmware: isp/tuner: Resetting to a lamp mode cancels manual_gains_used_

I'm not sure if the patch got picked across to the pi 0-3 branch, so it may only be on pi4 at present.
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.

Return to “Camera board”