Color correction, comparison sRGB/L*a*b*

This article follows that article about color correction using a QP203 color chart.

After studying more about color spaces I understood that, 1) using sRGB color space works against the linear transformation of the color correction due to the non linearity coming from the gamma correction, 2) using the Euclidean distance as the fitness function works better if the color space is uniform as it equally weights the color difference over the whole space. The L*a*b* color space is supposed to solve these two issues. Well, according do Wikipedia "While the intention behind CIELAB was to create a space that was more perceptually uniform than CIEXYZ using only a simple formula, CIELAB is known to lack perceptual uniformity, particularly in the area of blue hues." but...

The patent of the QP203 color chart gives the reference values in the L*a*b* color space (exactly CIE LAB 1976 D50 2 degrees). I've explained in the article about color spaces how to translate these values to sRGB. Doing so revealed that 9 of the color patches are actually outside the sRGB gamut. On the image below I've punched a "hole" on those patches.

Given that I want to use that color space (it is the one my camera works in), that's a bummer! Anyway there's nothing I can do about it and will ignore those patches and work with the remaining 26 ones instead.

Using L*a*b* I can now revise my method for brightness correction: it's just fixing the L* values in the reference chart to the ones of the image chart. That seems much more accurate than the scaling I was using before.

The color correction algorithm then becomes: start with the L*a*b* reference values, convert the color chart extracted from the image to L*a*b*, if no brightness correction is requested force the L* value in the reference to the one in the extracted chart, find the correction matrix, and finally apply that matrix to the image converted in L*a*b* space. I modified accordingly my color correction tool, leaving the option to choose in which color space the correction matrix calculation is done for comparison.

Results are as follow. Images are, from top to bottom, the original image, the sRGB corrected image, the L*a*b* corrected image, without brightness correction.




For objective comparison I define the similarity value as one minus the average Euclidean distance between the sRGB colors in the image patches and reference patches (higher is better):

imageinitial similarityfinal similarity (sRGB)final similarity (L*a*b*)
#000.95070.97380.9684
#010.92390.95130.9530
#020.94130.97500.9703
#030.84790.93210.9398
#040.92490.97600.9752
#050.94570.97410.9688
#060.68660.93390.9134
#070.78240.95320.9371
#080.89990.96930.9630

If applying brightness correction, the results become as follow.




imageinitial similarityfinal similarity (sRGB)final similarity (L*a*b*)
#000.89790.93970.9353
#010.76660.89980.9012
#020.72870.93780.9312
#030.74290.89030.8910
#040.52360.87950.8697
#050.90070.94080.9355
#060.65930.91050.8795
#070.77200.92890.9106
#080.87420.93390.9315

Using L* to control brightness clearly gives better results. As it is applied for both sRGB and L*a*b* correction, before the correction matrix, it helps in both case. Without brightness correction, the result of correction is visually pleasing, the images were clearly improved in both color spaces. There is no big difference between the two color spaces, but the similarity value shows that the correction made using L*a*b* color space is slightly better except for images #06 and #07. Those are the two images biased toward blue, it makes me wonder if that's related to what they are speaking of in the Wikipedia article.

(edited on 2022/06/28: correction of results and comments after correcting the reference values of the QP203 color chart)

If using brightness correction, results are not quite as I would have expected. According to the similarity value there is an improvement. It is better if sRGB is used rather than L*a*b*. But visually, it isn't pleasing at all.

In conclusion, using L*a*b* was an improvement from the previous implementation from the point of view of brightness matching. To calculate the correction matrix itself it doesn't make a big difference. If color correction does work as expected, brightness correction doesn't and needs to be improved.

This article is followed by another one where I explore another idea: using Bezier surface instead of correction matrix.

2022-04-12
in All, Computer graphics,
104 views
Copyright 2021-2024 Baillehache Pascal