[PATCH v2 2/4] libcamera: Add gamma control id

Kieran Bingham kieran.bingham at ideasonboard.com
Thu May 23 00:10:54 CEST 2024


Quoting Stefan Klug (2024-05-22 15:54:36)
> A camera gamma of roughly 2.2 is necessary to produce correct output
> images on a standard monitor. Add a control for that.
> 
> Further information is available here:
> https://en.wikipedia.org/wiki/SRGB
> https://www.cambridgeincolour.com/tutorials/gamma-correction.htm
> 
> Signed-off-by: Stefan Klug <stefan.klug at ideasonboard.com>
> Reviewed-by: Daniel Scally <dan.scally at ideasonboard.com>
> ---
> 
> v1 -> v2:
> - small change in description
> 
>  src/libcamera/control_ids_core.yaml | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/libcamera/control_ids_core.yaml b/src/libcamera/control_ids_core.yaml
> index bf1f1a83..303b0d32 100644
> --- a/src/libcamera/control_ids_core.yaml
> +++ b/src/libcamera/control_ids_core.yaml
> @@ -243,6 +243,13 @@ controls:
>          Specify a fixed contrast parameter. Normal contrast is given by the
>          value 1.0; larger values produce images with more contrast.
>  
> +  - Gamma:
> +      type: float
> +      description:  |
> +        Specify a fixed gamma value. Default must be 2.2 which closely mimics 
> +        sRGB gamma. Note that this is camera gamma, so it is applied as 
> +        1.0/gamma

Will this interact with the existing 'Contrast' control at all ? Do they
work independently? Or are they otherwise related?

I see src/ipa/rpi/controller/rpi/contrast provides the ability to modify
the gamma curve based on both a brightness and contrast manual control -
so I think this tells me they are actually independent, and it's just
that the brightness and contrast handling are managed by applying
changes to the gamma curve on top of the configured gamma..

I think I've already convinced myself that this is separate enough...
But I wonder what impact this will have for RPi who currently store a
gamma curve directly in the tuning file. Presumably a manual control for
Gamma in that case would override the configured curve and regenerate a
new Pwl or such based on the gamma value... (not that it has to be
added there, if it's not reported as a supported control ...)

I think I've satisfied myself on this for now, but I am curious to hear
what David/Laurent's feedback will be on this control.


But still ... for me so far...


Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>


> +
>    - Lux:
>        type: float
>        description: |
> -- 
> 2.40.1
>


More information about the libcamera-devel mailing list