Color Conversion

<< Click to Display Table of Contents >>

Navigation:  Spectral > Theory Of Operation >

Color Conversion

The spectrum of cubes in the visible range can be converted to a color metric. This library covers XYZ, CIE Lab and sRGB.

As for pre-processing, a normalization is essential to be remove the spectral dependency to the whole setup.

 

Normalization

The spectral density as acquired by a hyperspectral device contains the combination of spectral responses from illumination, environment, optics, spectroscope, sensor and of course sample. To extract the reflectance spectral density of the sample it is necessary to normalize such an image cube. This is done using a white and a black reference. Effectively this gives a relative response with respect to the given white reference.

Therefore, it is important to have a white reference with an uniform reflectance spectrum. The resulting values of the image cube are in the range [0,1]

 

Currently the only available normalization method is NormalizationMethod::AverageReferences1

 ColorConversion-Normalization_01

 

Effectively this gives a relative response with respect to the given white reference. Therefore, it is important to have a white reference with a uniform reflectance spectrum. The resulting values of the image cube are in the range [0,1].

The three cubes S, BRef and WRef need to have the same dimensions for Bands and Samples. In the Lines dimension the Reference Cubes are averaged.

 

Tristimulus XYZ

The tristimululs or XYZ color space is often the starting point for many other color spaces. In this color space the spectral sensitivity of the human eye is applied. The calculations are done using the color matching functions. These functions are curves, which describe the spectral sensitivity of the photoreceptors in the human eye. The CIE standard defines a number of Standard Observer to address this matter.

Reflective or transmissive objects by itself do not emit any light. To calculate the XYZ- tristimulus value for these objects an additional Standard Illumination is needed. For this purpose the CIE standard defines a number of Standard Illuminats.

CMF2006_10deg

StdIlluminant

 

To calculate the XYZ-tristimulus values the following formula is then applied:

 Formula_CMF_x

 Formula_CMF_y

 Formula_CMF_z

                 with                Formula_CMF_N

                                 S_lambda

                                 I_lambda

                                 CMF_xyz

 

Prior to applying this calculation the wavelength grid of the normalized sample S(λ), the Color Matching Functions and the Standard Illuminant need to be aligned. Therefore, an Interpolator is created. It access the meta data Wavelength of the given cube and uses this wavelength grid as the target for color matching functions and Standard Illuminant. This Interpolator then contains the spectral densities of the standard illuminant and the color matching functions in the same grid as the normalized sample cube S(λ).

This Interpolator is then used to calculate the XYZ image.

 

 

CIE Lab Colorspace

The most popular metric to express color is the CIE Lab Color Space defined by the CIE (Commission internationale de l'éclairage). CIE Lab holds the three values L, a and b in the value range [0, 100] [-128, 127] [-128, 127] and is relative to a given white point. This color space is device independent and therefore can be used to compare different colors.

To convert from XYZ-tristimulus to CIE Lab (L*,a*,b*) a reference white point is needed Formula_Whitepoint. Typically, the white point of the standard illuminant D50 or D65 is used.

 

 Formula_L

 Formula_a

 Formula_b

         Formula_f_t              

                 with Formula_f_t_t, Formula_f_t_kappa, Formula_f_t_epsilon

                 Formula_x_r, Formula_y_r, Formula_z_r

Similar to the calculation of the Trisimulus XYZ this calculation requires an Interpolator with the correct wavelength grid.

The Lab image can be calculated using the Cube or by using the XYZ image

 

sRGB

Neither XYZ nor CIE Lab values can be shown on screen properly. For this purpose sRGB is used. Currently the conversion is only defined for sRGB with D65 as standard illuminant.

 Formula_sRGB_linear        

         with Formula_sRGB_Compunding

         Formula_XYZ_RGB_linear

                 with Formula_M_D65

 

The Interpolator is used for the internal intermediate conversion from Lab to XYZ.