[libcamera-devel] CCM from CCT: why not mired?

Jack Hogan jack.hogan77 at gmail.com
Mon Jun 8 12:35:36 CEST 2020


Hello David,

Thanks for your comments.  I hear you about the interpolation.

With regards to the saturation correction matrices, the values shown are a
relic of the old CRT days.  Today we live in a much more standardized,
linear world.
The CCM presumably takes black-subtracted, white-balanced, linear raw data
to sRGB.  As such it performs three functions in one.  We could break the
one matrix down into the three component matrices: projection of the raw
data to XYZ [cam2xyz(cct)], chromatic adaptation to D65 [xyz(cct)2xyz(D65)]
and projection to the sRGB color space [xyz(D65)2sRGB].

In that case the 'Y' in the saturation correction matrices is correctly
obtained by undoing the last step.  The inverse of the xyz(D65)2sRGB matrix
results in Y = 0.2126729R + 0.7151522G + 0.0721750B as can be seen in the
following page for instance
http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html .

Anyways, just my 2 cents, I am sure you know all this already.
Keep up the good work!

Jack

On Mon, Jun 8, 2020 at 9:55 AM David Plowman <david.plowman at raspberrypi.com>
wrote:

> Thanks for the comments.
>
> Indeed, looking at the matrices in apply_saturation, I actually have no
> recollection where those numbers come from. Actually I suspect it makes no
> difference mathematically (unless saturation were changed by different
> amounts on the U and V axes), but I agree it would make sense to use the
> "official" numbers there.
>
> As regards the interpolation, the behaviour is intended to match the way
> the AWB works (so that the two algorithms "agree" about exactly where on
> the CT curve they are, rather than caring particularly about the reported
> value). That said, the AWB might do better to work in mireds too, and then
> this would be changed to match. It would make no difference to the actual
> white point chosen (in terms of red/blue gains), but the colour temperature
> number reported in between the calibrated locations might be less
> approximate. I'll put it on the list of things to look at!
>
> Thanks again and best regards
>
> David
>
> On Mon, 8 Jun 2020 at 07:35, Jack Hogan <jack.hogan77 at gmail.com> wrote:
>
>> Thanks Laurent, I look forward to hearing their thoughts.
>>
>> Jack
>>
>> On Sun, Jun 7, 2020 at 3:01 AM Laurent Pinchart <
>> laurent.pinchart at ideasonboard.com> wrote:
>>
>>> Hi Jack,
>>>
>>> On Sat, Jun 06, 2020 at 04:58:00PM +0200, Jack Hogan wrote:
>>> > Hello,
>>> >
>>> > I am not a programmer but I was perusing the calculate_ccm module in
>>> ccm.ccp
>>> > and I noticed that the interpolation factor lambda is computed
>>> directly off
>>> > correlated color temperature values in deg K.  Normally this is done
>>> in mired
>>> > units, that is the interpolation factor is computed using one over
>>> each of the
>>> > cct's, see for instance the DNG SDK.  Is there a reason why it was not
>>> done
>>> > this way?
>>> >
>>> > Also the matrices in apply_saturation the coefficients look incorrect
>>> (from the
>>> > 601 standard instead of 709).
>>> >
>>> > Hope it helps.
>>>
>>> Thanks a lot for the feedback. I've added David and Naush in CC, as the
>>> authors of the code I'm sure they know better than I do :-)
>>>
>>> --
>>> Regards,
>>>
>>> Laurent Pinchart
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20200608/d6482786/attachment.htm>


More information about the libcamera-devel mailing list