Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manual ISO changes do not take effect, but can be triggered by flipping image #86

Open
larsjuhljensen opened this issue Dec 29, 2020 · 16 comments
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed

Comments

@larsjuhljensen
Copy link

Using the new camera-ctl tool (on release 1.70) with ISO Sensitivity, Auto set to Manual, changes to ISO Sensitivity do not take effect. However, doing a Horizontal Flip of the image (and back again) is sufficient to make the ISO change take effect.

I am running the 1.70 release on a Raspberry Pi Zero with the HQ camera.

@dgsiegel
Copy link
Contributor

dgsiegel commented Jan 1, 2021

Hmm.. I can't really reproduce this here. What are your initial settings?

@larsjuhljensen
Copy link
Author

larsjuhljensen commented Jan 1, 2021

It does not seem to matter with other settings for me. However, it is easier to see if you turn Auto Exposure off and set an Exposure Time, Absolute. With fixed exposure time, it is immediately obvious when the new ISO takes effect, due to the change in image brightness.

Here is a dump of my camera.txt:
saturation=5
red_balance=2000
blue_balance=2750
horizontal_flip=1
vertical_flip=1
video_bitrate_mode=1
video_bitrate=25000000
auto_exposure=1
exposure_time_absolute=200
white_balance_auto_preset=0
iso_sensitivity=2
iso_sensitivity_auto=0

@dgsiegel
Copy link
Contributor

dgsiegel commented Jan 4, 2021

Oh, now I got you: You need to set the preferred ISO, then doing a horizontal flip to see any changes, right?

@larsjuhljensen
Copy link
Author

Precisely! Whenever setting a new ISO value, it has no effect until I do a flip.

@dgsiegel
Copy link
Contributor

dgsiegel commented Jan 4, 2021

Alright, I think we need to move this upstream in this case. Would you mind reporting this to https://github.com/raspberrypi/linux ?

Additionally we would be happy to add some kind of workaround until we get this fixed. Open for any ideas or suggestions.

@larsjuhljensen
Copy link
Author

I am not sure what to report to the upstream here, since I do know what exactly your code does.

Regarding workaround, I think it could be done pretty easily. I have just noticed that if auto_exposure is set to 0, ISO changes appear to take effect immediately. So in camera-ctl (or whichever tool it calls downstream), when a user wants to change iso_sensitivity, simply set auto_exposure to 0, then apply the iso_sensitivity change, and set auto_exposure back to its original value. That should be all it takes to work around this bug.

@dgsiegel
Copy link
Contributor

dgsiegel commented Jan 4, 2021

I am not sure what to report to the upstream here, since I do know what exactly your code does.

Exactly what you reported here :) We're basically just using the kernel's v4l2 module which uses the Raspberry's MMAL interface.

Regarding workaround, I think it could be done pretty easily. I have just noticed that if auto_exposure is set to 0, ISO changes appear to take effect immediately. So in camera-ctl (or whichever tool it calls downstream), when a user wants to change iso_sensitivity, simply set auto_exposure to 0, then apply the iso_sensitivity change, and set auto_exposure back to its original value. That should be all it takes to work around this bug.

Noted, that should be easy enough to add to camera-ctl.

@larsjuhljensen
Copy link
Author

It looks like the issue is precisely what has been reported in 2016 and closed without being solved. Not sure what to do about that:
raspberrypi/linux#1440

It was pointed out in 2018 that, despite it being closed, this is a real issue. This sounds identical to what I describe:
raspberrypi/linux#1440 (comment)

@dgsiegel
Copy link
Contributor

dgsiegel commented Jan 4, 2021

It seems that they think that this is not really what's going on here: raspberrypi/linux#1440 (comment)

@larsjuhljensen
Copy link
Author

And us reporting again, what others have already reported will likely not change anything. The comment from dstarke describes exactly what I see as well, but it seems like nobody even responded to him.

@dgsiegel
Copy link
Contributor

dgsiegel commented Jan 4, 2021

Sure, but he might also be right. In other words: It could be that EV, analog/digital gain and other automations will be triggered when flipping the image, but the ISO change was effective in all cases?

@larsjuhljensen
Copy link
Author

I'm running with auto_exposure turned off and fixed exposure_time_absolute precisely to do manual exposure and not have any automation get it wrong. Flipping the image or changing auto_exposure on and back off triggered the ISO change in all cases for me.

@kbingham
Copy link

kbingham commented Jan 4, 2021

Open a new issue on https://github.com/raspberrypi/linux and reference the closed one, with a description that is fully reproducible.

The response on the closed issue probably got ignored ... because it was already closed.

@biasedlogic
Copy link

I have submitted a new bug report raspberrypi/linux#4081

@dgsiegel
Copy link
Contributor

Until this gets resolved, we might think about some workarounds, e.g. flipping the webcam every time after we change some settings. I've discovered that it also sometimes resets the settings, when you use the webcam for a new stream.

@dgsiegel
Copy link
Contributor

From further testing it seems that settings get reset, but can be re-applied with flipping the image. Any patches are welcome.

@dgsiegel dgsiegel pinned this issue Apr 20, 2021
@dgsiegel dgsiegel added documentation Improvements or additions to documentation help wanted Extra attention is needed labels Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants