• No results found

In the previous section, we have determined that the CLUT in the AToBx needs to be updated. The corrective colour transformation is applied on the current colour output in CIE LAB colour space. This is, in the presence of B curves (post-linearisation curves), available at the end of the colour correction chain of an ICC prole transformation. A CLUT value is transformed through the B curves to anL∗a∗b∗ colour value and corrected. This corrected colour value now needs to be transformed back to the CLUT colour space using inverse B curves, and then can nally replace the original CLUT entry.

The B curves are one-dimensional look-up tables per channel. Theoretically, these can assume any shape. Technically though, they only make sense in colour transformation applications if they are monotonously increasing, as they would otherwise lead to meaningless artifacts in the colour space mapping. Due to this fact, these three curves can easily be inverted for our purposes.

The correction of the CLUT entries in the AToBx is outlined in pseudo code in Fig.9.1. In preparation, rst the three B curves need to be inverted for theL∗,a∗andb∗ channels (lines 1214). After that, this ve-step-process is applied for each node to update the whole CLUT:

9.2. PROFILE ADAPTATION PROCESS 135

1 # We have got these transformations available:

2 # transform_B_L(value)

3 # transform_B_a(value)

4 # transform_B_b(value)

5 # each returning a transformed value for the given channel.

7 # Additionally of course the corrective colour transformation:

8 # correction(colour_vector_Lab)

9 # returning a corrected Lab colour vector.

11 # Preparation: Invert "B" curve transformations.

12 tansform_B_L_inv = invert(transform_B_L)

13 tansform_B_a_inv = invert(transform_B_a)

14 tansform_B_b_inv = invert(transform_B_b)

16 # Iterate over all CLUT entries.

17 for node in CLUT_nodes:

18 # Step 1: Get original CLUT destination value.

19 original_value = get_CLUT_value(node)

21 # Step 2: Apply "B" curve transformation.

22 original_Lab.L = transform_B_L(original_value.L)

23 original_Lab.a = transform_B_a(original_value.a)

24 original_Lab.b = transform_B_b(original_value.b)

26 # Step 3: Apply corrective (affine) transformation.

27 corrected_Lab = correction(original_Lab)

29 # Step 4: Apply inverted "B" curve transformation.

30 corrected_value.L = tansform_B_L_inv(corrected_Lab.L)

31 corrected_value.a = tansform_B_a_inv(corrected_Lab.a)

32 corrected_value.b = tansform_B_b_inv(corrected_Lab.b)

34 # Step 5: Update CLUT for this node.

35 set_CLUT_value(node, corrected_value)

Figure 9.1: Pseudo code of the algorithm updating the CLUT values in an ICC prole. 2. Apply B curve transformation to that tuple (lines 2224)

3. Apply corrective transformation to resulting colour tuple (line 27)

4. Apply inverse B curve transformation to adapted colour tuple (lines 3032)

5. Replace the original (colour) tuple in the CLUT with the newly derived one (line 35) The ICC prole with the corrected CLUT can now be written back to a le, or used directly if it is resident in memory.

9.3 Implementation

In order to gain access to the content of the information stored within proles, LCMS [42] is used, as already in Chap.7to create and write proles. Unfortunately, LCMS only provides limited access to prole data in the current line of 1.x versions. The author of LCMS is currently working on the beta of version 2.0, which is to include full (and more convenient) access to all enclosed prole data. However, the information needed to update the CLUT in a prole is already accessible through some tricks using the API of the current version 1.19. For the purpose of this research, the Python bindings library PyLittleCMS [41,44] needed extending to make use of these features, to conveniently access the prole's CLUT(s). Very conveniently, LCMS also provides a fast function for linearisation curve inversion, we are using for the inversion of the B post-linearisation curve.

9.4 Results

All colour transformations that have been determined in Sect.8.2were used for a comparison. In this comparison the base prole was determined for the reference case 65270000, and

applied to every image. A corrective ane transformation was then determined to correct the illumination cases against this reference. From here, we have once corrected the colour images using the ane transformation directly, as well as applied the same correction to the base prole (as described above in Sect. 9.2), which then was used to correct the colour appearance of the original image in one step.

In almost all cases, the appearance of the corrected images was visually indistinguish- able between the pairs of colour correction processes. The cases where correction artifacts were clearly visible, was in areas of extreme over- or under-exposure. These areas could be seen specically for some illumination cases. The CMM (Little CMS) performing the cor- rective transformation used internal sanity checks, to prevent numeric roll-overs beyond the boundaries of the number space (16-bit unsigned integers used internally, within the prole's encoding as well as the CMM). Applying the ane transformation directly to the 16-bit L∗a∗b∗ encoded colours led to these roll-overs, which were not treated explicitly to yield a more realistic output.

Beyond the roll-over artifacts, pixel value dierences were not visibly detectable. They mainly resulted from rounding dierences, due to the dierent process chains when applying a theoretically quantitative equivalent correction.

The base prole used was created with Argyll CMS [50], which has been determined as a good reference in past chapters already. These proles are well optimised and make use of A and B tables by default. Therefore, the full prole adaptation chain had to be put to use as described above, including the post-linearisations (B tables) together with their inversion.

9.5. CONCLUSIONS AND FUTURE WORK FOR PROFILE ADAPTATION 137