Lab to XYZ

This conversion requires a reference white $(X_r, Y_r, Z_r)$.

$$X = x_r X_r$$ $$Y = y_r Y_r$$ $$Z = z_r Z_r$$

where

$$x_r = \cases{ {f_x}^3 & \text{if }{f_x}^3 \gt \epsilon \\ (116 f_x - 16)/\kappa & \text{otherwise} }$$ $$y_r = \cases{ {((L+16)/116)}^3 & \text{if }L \gt \kappa \epsilon \\ L / \kappa & \text{otherwise} }$$ $$z_r = \cases{ {f_z}^3 & \text{if }{f_z}^3 \gt \epsilon \\ (116 f_z - 16)/\kappa & \text{otherwise} }$$ $$f_x = {{a} \over {500}} + f_y$$ $$f_z = f_y - {{b} \over {200}}$$ $$f_y = (L + 16) / 116$$ $$\epsilon = \cases{ {0.008856} & \text{Actual CIE standard} \\ {216 / 24389} & \text{Intent of the CIE standard} }$$ $$\kappa = \cases{ {903.3} & \text{Actual CIE standard} \\ {24389 / 27} & \text{Intent of the CIE standard} }$$

Implementation Notes:

  1. For an explanation of $\epsilon$ and $\kappa$ click here.
  2. The output XYZ values are in the nominal range [0.0, 1.0].