[v2,2/4] libcamera: Add gamma control id
diff mbox series

Message ID 20240522145438.436688-3-stefan.klug@ideasonboard.com
State Superseded
Headers show
Series
  • libcamera: Add gamma control for rkisp1
Related show

Commit Message

Stefan Klug May 22, 2024, 2:54 p.m. UTC
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@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
---

v1 -> v2:
- small change in description

 src/libcamera/control_ids_core.yaml | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Kieran Bingham May 22, 2024, 10:10 p.m. UTC | #1
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@ideasonboard.com>
> Reviewed-by: Daniel Scally <dan.scally@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@ideasonboard.com>


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

Patch
diff mbox series

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
+
   - Lux:
       type: float
       description: |