You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
New AWB algorithm breaks AWB gains after resolution change #1215
Describe the bug
When using the new AWB algorithm, setting AWB gains is broken after changing the camera resolution (and possibly other properties?). Upon changing the resolution, the AWB gains seem to reset to their Auto values, and changing them back is broken.
To reproduce
Easiest to demonstrate in Python
import picamera as cam
import time
c = cam.PiCamera()
c.start_preview()
# Set the AWB mode to change the gains
c.awb_mode = "tungsten"
time.sleep(2)
# Show, and store, the gains it settled on
print(c.awb_gains)
g = c.awb_gains
# Turn auto AWB off, fixing the gains
c.awb_mode = "off"
time.sleep(2)
# Store the current resolution
r=c.resolution
# Apply a "new" resolution
c.resolution=r
print("At this point, the AWB gains will have reset if using the new AWB algorithm")
time.sleep(1)
# Try to set the AWB gains back
c.awb_gains = g
# Note: it didn't work
print(c.awb_gains)
# Wait for it to work...
time.sleep(2)
# It still doesn't work...
print(c.awb_gains)
print(c.awb_mode)
c.stop_preview()
Expected behaviour
Changing resolution shouldn't reset the AWB gains
AWB gains should be changeable after this anyway, if AWB is off.
Actual behaviour
Changing resolution resets AWB gains, seemingly to their values when AWB is set to "auto"
Turning the AWB off and trying to set new AWB gains after this point silently fails. AWB gains remain fixed at their reset values.
For anyone else experiencing this, this work-around shared by @6by9 works well for me. Run this code before running raspistill, raspivid, or using picamera.
sudo vcdbg set awb_mode 0 Note next comment @6by9 regarding updating to latest rpi-update.
The fix for the issue is in the latest rpi-update firmware.
sudo vcdbg set awb_mode 0 just switches back to the old algorithm, which doesn't help on a Pi4 as the old algorithm can't work due to the change in 3D hardware. Whilst it will work in the short term, it can not be recommended longer term.
With the new firmware and the new awb algorithm I also note the following behavior:
When I try the different modes (sunlight, cloudy, ...) it's OK
When I go to awb_mode off and I fix the gains it's OK
But after I can't change awb_mode which stays off
The behavior is normal if I return to the old algorithm with sudo vcdbg set awb_mode 0
Note: from Python with Picamera 1.13
Regards
@ 6by9
Thank you for answering.
I did rpi-update is that enough?
Here is what uname -a gives
Linux raspberrypi 4.19.113-v7+ #1300 SMP Thu Mar 26 16:53:09 GMT 2020 armv7l GNU/Linux
Not really blocking for me but I wanted to report
Anyway in my case the awb auto algorithm did not really give satisfactory results. Do you think the new algorithm is better? @JamesH65
is there a trick to use "Greyworld with the Picamera library?
Blast. Sorry, we have two firmware source branches at present, one for Pi0-3, and one for Pi4. The fix is only on the Pi4 branch. I'll pull it across to the other one.
Re using greyworld, see waveform80/picamera#576.
I know waveform80 is busy on other stuff at present, but we'll look at what can be done to get it merged.
Actually if you want an interim fix on a non-critical Pi, then sudo BRANCH=next rpi-update will get a test firmware where the Pi0-3 fw is built from the same tree as Pi4. See https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=267576 for more info.
Cherry-pick done, so all being well a fix would be in the next "normal" rpi-update anyway.
@6by9
It also seems to me that there is a change in behavior with the AGC algorithm. I posted in the raspberry forum, I don't know if I should open an issue?
Thanks for your help and best regards.
@dgalland Your comment is totally unrelated to AWB changing, therefore does not belong on this issue at all.
If you have a reproducable test case then raise an issue, but seeing as you've posted on the forums it'd be nice if you left more than 5 minutes for someone to have a chance to reply before cross posting here. And always add a link if you have asked the question on the forums so that we don't cover the same ground twice.
@6by9 thanks for the updates on this. Has the updated pi3 firmware been officially released now? We're currently still using the old AWB debug mode for our microscopes, but I'm keen to move away from that ASAP.
Hexxeh/rpi-firmware@837c245 firmware: isp/tuner: Resetting to a lamp mode cancels manual_gains_used_ (master)
But also note Hexxeh/rpi-firmware@b6e327e firmware: Switch to building from common firmware branch
so all Pi variants from that point on are now built off the same firmware tree.
I checked many comments, but my Pi and camera don't work well. I can't stop AWB.
I check AWB with seeing picture(movie) using red paper covering lens on/off.
camera.exposure_mode = 'off' works well.
Activity
kernel: Bump to 4.19.68
kernel: Bump to 4.19.68
JeffJassky commentedon Aug 31, 2019
For anyone else experiencing this, this work-around shared by @6by9 works well for me. Run this code before running raspistill, raspivid, or using picamera.
Note next comment @6by9 regarding updating to latest rpi-update.sudo vcdbg set awb_mode 06by9 commentedon Aug 31, 2019
The fix for the issue is in the latest rpi-update firmware.
sudo vcdbg set awb_mode 0just switches back to the old algorithm, which doesn't help on a Pi4 as the old algorithm can't work due to the change in 3D hardware. Whilst it will work in the short term, it can not be recommended longer term.JeffJassky commentedon Aug 31, 2019
@6by9 thank you!
And for anyone interested - you can switch back to the new algorithm using
sudo vcdbg set awb_mode 1dgalland commentedon Mar 30, 2020
With the new firmware and the new awb algorithm I also note the following behavior:
The behavior is normal if I return to the old algorithm with sudo vcdbg set awb_mode 0
Note: from Python with Picamera 1.13
Regards
JamesH65 commentedon Mar 30, 2020
vcdbg set_awb_mode is no longer recommended (and will be removed at some point). Use the greyworld AWB option.
6by9 commentedon Mar 30, 2020
Resuming AWB after having switched off was fixed in Hexxeh/rpi-firmware@1526192 - 30 Jan 2020.
Is your firmware after that date? If not, then update.
dgalland commentedon Mar 30, 2020
@ 6by9
Thank you for answering.
I did rpi-update is that enough?
Here is what uname -a gives
Linux raspberrypi 4.19.113-v7+ #1300 SMP Thu Mar 26 16:53:09 GMT 2020 armv7l GNU/Linux
Not really blocking for me but I wanted to report
Anyway in my case the awb auto algorithm did not really give satisfactory results. Do you think the new algorithm is better?
@JamesH65
is there a trick to use "Greyworld with the Picamera library?
6by9 commentedon Mar 30, 2020
Blast. Sorry, we have two firmware source branches at present, one for Pi0-3, and one for Pi4. The fix is only on the Pi4 branch. I'll pull it across to the other one.
Re using greyworld, see waveform80/picamera#576.
I know waveform80 is busy on other stuff at present, but we'll look at what can be done to get it merged.
6by9 commentedon Mar 30, 2020
Actually if you want an interim fix on a non-critical Pi, then
sudo BRANCH=next rpi-updatewill get a test firmware where the Pi0-3 fw is built from the same tree as Pi4. See https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=267576 for more info.Cherry-pick done, so all being well a fix would be in the next "normal" rpi-update anyway.
dgalland commentedon Apr 2, 2020
@6by9
It also seems to me that there is a change in behavior with the AGC algorithm. I posted in the raspberry forum, I don't know if I should open an issue?
Thanks for your help and best regards.
6by9 commentedon Apr 2, 2020
@dgalland Your comment is totally unrelated to AWB changing, therefore does not belong on this issue at all.
If you have a reproducable test case then raise an issue, but seeing as you've posted on the forums it'd be nice if you left more than 5 minutes for someone to have a chance to reply before cross posting here. And always add a link if you have asked the question on the forums so that we don't cover the same ground twice.
jtc42 commentedon Apr 28, 2020
@6by9 thanks for the updates on this. Has the updated pi3 firmware been officially released now? We're currently still using the old AWB debug mode for our microscopes, but I'm keen to move away from that ASAP.
Thanks.
6by9 commentedon Apr 28, 2020
Hexxeh/rpi-firmware@837c245
firmware: isp/tuner: Resetting to a lamp mode cancels manual_gains_used_ (master)But also note Hexxeh/rpi-firmware@b6e327e
firmware: Switch to building from common firmware branchso all Pi variants from that point on are now built off the same firmware tree.
yujiayabe commentedon Jun 15, 2020
I checked many comments, but my Pi and camera don't work well. I can't stop AWB.
I check AWB with seeing picture(movie) using red paper covering lens on/off.
camera.exposure_mode = 'off' works well.
Description: Raspbian GNU/Linux 10 (buster)
Release: 10
Codename: buster
Regards.