14 inline double F(
double input)
18 return std::cbrt(input);
20 return ((
double(841.0) / 108.0) * input +
24 inline void RGBtoXYZ(
double R,
double G,
double B,
double &X,
double &Y,
double &Z)
30 R = ((R > 0.0404482362771076) ? std::pow((R + 0.055) / 1.055, 2.4) : (R / 12.92)) ;
31 G = ((
G > 0.0404482362771076) ? std::pow((
G + 0.055) / 1.055, 2.4) : (
G / 12.92));
32 B = ((B > 0.0404482362771076) ? std::pow((B + 0.055) / 1.055, 2.4) : (B / 12.92));
40 X = 0.412396 *R + 0.357583*
G + 0.180493*B;
41 Y = 0.212586*R + 0.71517*
G + 0.0722005*B;
42 Z = 0.0192972*R + 0.119184 *
G + 0.950497*B;
47 inline void XYZtoLab(
double X,
double Y,
double Z,
double *lab)
56 const double Xo = 0.950456;
57 const double Yo = 1.000000;
58 const double Zo = 1.088754;
60 lab[0] = 116.0 *
F(Y / Yo) - 16.0;
61 lab[1] = 500.0 * (
F(X / Xo) -
F(Y / Yo));
62 lab[2] = 200.0 * (
F(Y / Yo) -
F(Z / Zo));
67 inline void rgb_to_lab(
double R,
double G,
double B,
double *lab)