Skip to content

Evaluate CIECAM02 / CIECAM16 #9

@Brankale

Description

@Brankale

Chromatic adaptation is the the approach which simulate a how the human eye perceives colors under a different white point.

Currently only full chromatic adaptation with the Bradford matrix is implemented. However, is very unlikely that the human eye fully adapts to specific white point, hence full adaptation doesn't achieve real "perceptual accuracy".

Partial chromatic adaptation, which is how the human eye works, is described by CAM (Color Appearance Model). The most recent CAM models from the CIE are the CIECAM02 (https://en.wikipedia.org/wiki/CIECAM02) and CIECAM16.

Full chromatic adaptation only involves operations with the CAT matrices which are just a part of a CAM.

code example of CIECAM16 under the assumptions:

  • surrounding environment: dim
  • gray world assumption (i.e. 20% of the maximum luminance on average)
// row major matrix (needs transpose to work with shaders)
const mat3 CIECAT16 = mat3(
    0.401288, 0.650173, -0.051461,
   -0.250268, 1.204414,  0.045854, 
   -0.002079, 0.048952,  0.953127
);

// row major matrix (needs transpose to work with shaders)
const mat3 CIECAT16_INV = mat3(
   1.862068, -1.011255, 0.149187,
   0.387527, 0.621447, -0.008974,
   -0.015841, -0.034123, 1.049964
);

const float Y_SRC = 200; // absolute luminance (cd/m2)
const float L_A = Y_SRC / 5.0; // gray-world assumption

const float F = 0.9; // surround condition: dim
const float e = 2.71828182845904523536;

const float D = F * (1.0 - (1.0/3.6)*pow(e, -(L_A + 42.0) / 92.0));

const float k = 1.0 / (5.0 * L_A + 1.0);
const float F_L = (1.0 / 5.0) * pow(k, 4.0) * (5.0 * L_A) + (1.0 / 10.0) * pow((1.0 - pow(k, 4.0)), 2.0) * pow(5.0 * L_A, 1.0 / 3.0); 

const vec3 W_SRC = vec3(0.989943328, 1.0, 1.287675787);   // example source colorspace white point
const vec3 W_REF = vec3(0.950455927051672, 1.0, 1.08905775075988);   // sRGB white point

// ciecat16 + degree of adaptation
vec3 ciecam16(vec3 xyz) {
   vec3 lms_w = transpose(CIECAT16) * W_SRC;
   vec3 lms_wr = transpose(CIECAT16) * W_REF;

   vec3 lms = transpose(CIECAT16) * xyz;
   vec3 lms_c = ((lms_wr / lms_w) * D + 1.0 - D) * lms;

   return transpose(CIECAT16_INV) * lms_c;
}

full implementation of CIECAM02/16 involves more complex operations:

  • proper L_A simulation instead of the gray-world assumption. This requires an image preprocessing to calculate the average luminance of the background. NB: if the image does have frequent and high average luminance changes, this simulation can cause image flickering (must be verified)
  • proper simulation of the surrounding environment the handheld was played in and the current surrounding environment the image is displayed. This involves a lot of other complex steps which requires calculation of lightness, brightness, chroma, colorfulness, saturation and going through the HPE space.

NB: under the proper assumptions is probably safe to say (this statement must be verified) that the difference between the full CIECAM implementation and the approximated CIECAM is negligible and it's not worth it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions