When I’ve studying M.sc, my professor asked me to get ready for presentation on color spaces. Now, after 4 years I decide to share my slide shows as an article. First, we discuss about the philosophy of creation of different color spaces as introduction and then introduce following color space:

  • RGB
  • HSV
  • LAB
  • CMYK

Introduction

First computers were created to solve math problem such as calculation or creating network (for example for time sharing and synchronization). By introducing computers as entertainment tools and progress of software developments, data visualization became more important.

We as human describe color something as light red or dark purple. By focusing on these passages, you may ask how light the red is? Or what mixture of red and blue are used or creating purple? In other world these passages are fuzzy. Moreover, performance of first computers was not good enough to handle color conversion overloads. By introducing different peripheral devices such as printers (and variety) bolded this problem.

By progressing hardware, more resources (memory, processor, network bandwidth, etc.) were dedicated to visualization. First monitors use two colors, black and white.

an image in different color depths and different processing [1]

rgb 24bits palette sample image

A

 bilevel 1bit palette sample image

bilevel 1bit palette sample image gimp dithered

B

C

grayscale 2bit palette sample image

grayscale 2bit palette sample image gimp dithered

D

E

Fig1 depicts an image in different color depths and different processing. By assuming Fig1.A is assumed as a real-world input image that we want to show them using 1-bit and 2-bits color space and two different processing types. Fig1.A illustrates a simple depiction of the input image. This can be done using very simple (or adaptive) thresholding method. As it can be seen, only two color or levels of grays have been used, black and while (1 or 0) but it seems that Fig1.C uses more than two colors (it uses just black and white). Fig1.C uses a technique of image processing for enhancement of appearance and make illusion into our eyes named dither. By comparing Fig1.B and Fig1.C you can find out more details of shadows and texture in Fig1.B. By using two bits and quad thresholding, we can save 4 colors as it is depicted in Fig1.D. We can enhance the depiction using dither algorithm. Now, we can easily see that how processing and memory size used for depiction is important.

Previously, it is said indirectly that different devices use different color spaces. This is because of processing power, costs, or intrinsic properties of device. For example, if you mix red and blue, you might not achieve purple. This is why CMYK is created. Moreover, printing a simple text (black and white) without a black color might not be cost effective.

RGB

I can say that RGB is most famous color space. It is created base on our vision. Our eyes use two different types of cells to sense electromagnetic spectrum, rods and cones.

Fig2. an image in different color depths and different processing [2]

cone cells of the eye diagram there are four different kinds each containing a that absorbs light one type is found in rods

cone cells of the eye diagram there are four different kinds each containing a that absorbs light one type is found in cones

Fig2 depicts two different types of cells used in human vision. Rods are only responsible for sensing intensity of light and can not sense color. They are active in low and high intensity of light. Cones are only active in high intensities and responsible for sensing different colors. There are three types of cones, red, green, blue. In Other words using these three types, we can see color.


 Figure 36 05 06

Fig 3. three different rod and can cone cells and their respond to different wavelengths [3] 

Fig 3. depicts three different rod and can cone cells and their respond to different wavelengths. S, M, and L denote short, medium, and long wavelength, respectively. Short, medium, and long wavelengths are responsible for blue, green, and red colors [3]. Also, activity range of rod cells is shown. As it can be seen, range of activity of each cell is overlapped with others. This is because when you see something in different may be seen in different colors!

HSV

Human do not percept colors as RGB colors. For example, I do not buy my shirt by telling a seller my favorite color in mixture of red, green, and blue. RGB color is also noisier when you try color processing. By changing a component color may be changed a lot. Also, when try to process color (making a histogram of color), intensity of color makes it hard to calculate.

hsv cone 

Fig 4. HSV cone [4]

Fig 4 depicts HSV cone used for depiction of HSV color space.

  • Hue: The type of color (i.e, red, blue, yellow). Range from 0 to 360 (in some applications it is normalized from 0 to 100%). If you track arrow of hue, you can see these colors in order:

-> yellow -> green -> cyan -> blue -> magenta -> red -> yellow.

  • Saturation: Color vividness. Range from 0 to 100%. It is also called "purity" in comparison with the stimulus purity and the colorimetric purity. As the color saturation decreases, the gray color becomes more pronounced and a dull color appears. It is also useful to define " desaturation" as the opposite of saturation.
  • Brightness: Brightness of color. Range from 0 to 100% [5].

LAB

LAB is created to be more similar to human perception than HSV color space and includes following elements:

  • L: intensity of color
  • A: green to red
  • B: blue to yellow

It can be realized that it uses two elements for color. Using hue is not enough for transformation of color to our vision. LAB use two elements of colors. This lead to be perceptually linear in terms of human vision. Because of this many applications such as Adobe photoshop supports it.

When it comes to processing colors base on human vision, LAB is more useful in many cases by comparison to HSV. For example, imagine we should find a disease named anthracnose in a leaf:

 Fig 5. an image of infected leaf by anthracnose and color decomposition in RGB, HSV, and LAB [6]

 Anthracnose46

A

 rgb

B

 hsv1

C

 lab

D

 Fig 5. is a demonstration of an image of infected leaf by anthracnose and color decomposition in RGB, HSV, and LAB in part A to D, respectively. It can be realized that infected areas are brown. In order to classify normal and infected leaves using a simple algorithm, we need a color space that there is a significant difference between levels of infected area and non-infected area. So, we can easily classify using histogram processing. By watching infected area in different channels of each color space, you can find out that the difference is more in color elements of LAB, especially in A element.

CMYK

This is a subtractive model which is used in printers. C, M, Y, and K are denoted for cyan, magenta, yellow, and black. I should note that this model works on white papers. By adding each color to paper, you subtract it from color of paper. Almost any color can be created using cyan, magenta, and yellow without using black. Since black powder in laser-jet and ink-jet printers is cheaper than the mixture of cyan, magenta and yellow, it is used is used as alternative to the mixture. Also, good and dark black values cannot be achieved using the mixture.

 

Fig 6. an image of infected leaf by anthracnose and color decomposition in RGB, HSV, and LAB [7]
 400px Barns grand tetons
 A
 197px cmyk separation no black1  197px CMYK separation maximum black
 B

Generating an image using CMY and CMYK has been illustrated in Fig 6. The image that we want to create it has been shown in part A. I call it input image. Creation of the input image using CMY has been shown in part B and creation of it using CMYK has been shown in part C. By focusing on white areas (not printed areas) of each channel, it can be realized that less cyan, magenta less colors are used using CMYK.

Resources

[1] - https://en.wikipedia.org/wiki/List_of_video_game_console_palettes

[2] - https://www.pinterest.com/zpqu/eye/

[3] - https://courses.lumenlearning.com/wm-biology2/chapter/transduction-of-light/

[4] - https://datacadamia.com/color/hsv

[5] - https://ja.wikipedia.org/wiki/HSV%E8%89%B2%E7%A9%BA%E9%96%93

[6] - https://arborjet.com/2019/03/25/anthracnose-what-are-the-symptoms-and-the-best-treatment/ 

[7] - https://en.wikipedia.org/wiki/CMYK_color_model