Visual Computing in Life Science: Color Spaces

Jeheonpark
5 min readAug 29, 2020

--

Picking colors and display colors on the monitor is an important part of the visualization and it is still true in Life Science. Color spaces help us do these processes.

Primary Colors

If we properly mix the primary colors, then we can get any colors we want. The color used to mix is called primary colors. Typical primary colors in computer science or other fields are Red, Green, and Blue. Physical property is different between mixed wavelength light and the pure one wavelength light. However, we perceive them as the same color, we call this metamers.

To make the same color we need to mix primary colors.

But, there is a limitation to copy the pure wavelength for our perception. Mathematics told us somehow we need to subtract specific wavelengths in primary colors. Researchers came up with a nice idea to solve this. The idea is to add the specific wavelength to the target wavelength and make it look the same because it is impossible to subtract the wavelength.

Grassman’s Law

Grassman’s Law

It explains we can make any color by mixing the primary colors but the color is not saturated. This law is called Grassman’s Law.

Now, we can think of the primary colors as the basis vectors of the 3D vector space and we can change the basis. If we adopt these concepts, then we can think every color is able to be expressed by changing coefficients of the basis vectors. Now, we can share the colors within monitors by adjusting the coefficient of the basis vectors.

Color Space

In 1931, the CIE provided the first mathematical definition of color space and it is based on ‘standard observer’, an abstraction from matching pure spectral colors with three primaries.

efficacy function of color space

Primaries they suggested is R=700nm, G=546nm, and B=436nm. As I mentioned above, we need to subtract a specific wavelength that is 500nm. Even though we pick other primaries, it is impossible to avoid the negative coefficient at a specific wavelength.

RGB cannot express every visible color space.

We still have a problem to express the color space with the RGB basis vector because actual visible color space has the curvature and RGB makes a triangle. It is unable to cover every area with RGB basis vectors. CIE suggested the virtual XYZ primaries to express every color space without a negative contribution. We solved the negative coefficient problem.

XYZ efficacy function curve, there is no negative contributions.

X and Z have no luminance but it only indicates the shift of hues and Y is in charge of the luminance.

Chroma

Chroma of CIE XYZ, RGB triangle is in the curvature.

This chroma is defined by normalizing by the overall amount of light(X+Y+Z). This is unaffected by changes in luminance. This is the combination of the artist’s view of colors and physicist’s view of colors.
But, does it reflect the perceptual differences? No.

The distance between colors is similar but perception is totally different.

Do you think watermelon and the school bus has the same color difference with the frog? Totally no. We need to adjust the difference.

McAdam ellipses illustrating just noticeable differences in color.

CIELAB

CIE proposed two perceptually more uniform color spaces, CIELAB and CIELUV, it does not mean it is perfectly uniform, it means more uniform than XYZ space.

CIELAB space
Function in CIELAB

Xn, Yn, and Zn are reference white. L is calculating normalized luminance. calculate the difference between normalized X and Y, normalized Y, and Z. It calculates how much it closes to green or red. f(t) is to be designed with the power-law of luminance and brightness, you can see cube root to cancel out the power-law. Another constant is from experiments.

CIELUV

CIELUV
Equation of CIELUV

CIE recommends it for (additive) color display and it uses subtraction the white reference instead of dividing like CIELAB. Luminance is the same formula as CIELAB. It subtracts white reference to normalize the basis. Therefore, it becomes harder to perceive differences in color at lower lightness.

RGB color space

Actually, our monitor doesn’t use the CIELAB or CIELUV. Many modern devices map sRGB to device-specific RGB. sRGB is created by HP and Microsoft in 1996 and it is optimized for monitors, printers, and the internet.

HSV Color Space

HSV color space

It is useful to select the color in the HSV color space.

This is how it makes HSV from RGB color space

The circle represents the full saturated colors. Saturation represents colorful vs gray and Value represents dark vs bright.

This is the whole process.

This is published on 29/8/2020.

--

--

Jeheonpark
Jeheonpark

Written by Jeheonpark

Jeheon Park, Software Engineer at Kakao in South Korea

No responses yet