Le Thanh Ha, Dr.
Laboratory of
Human Machine Interface
Color model is a mathematical tools describing color by numbers.
A color model is a specification of a coordinate system where each
color is represented by a single point.
Each color model is used for different purpose.
For example:
RGB: used for display and acquaring hardware devices
HSV: human cognitive.
Y’CbCr: image compression.
CMYK: printers.
10/25/2022 Lê Thanh Hà 2
Based on 3D-Cartersien coordinate system in which each axis
corresponds to a color component (Red, Green, Blue).
The origin (0,0,0) presents Black color
Point (1,1,1) presents White color
Point in each axis present a single color component.
10/25/2022 Lê Thanh Hà 3
R, G, B are valued from 0 to 1
Red+Blue -> Magenta (1, 0, 1)
The diagonal from (0, 0, 0) to (1, 1, 1) presents gray color.
Comments:
This color model cannot present all color in visible spectrum, but is enough for
compter applications.
TV, Computer display, and camera are using this color model.
Most widely used.
10/25/2022 Lê Thanh Hà 4
10/25/2022 Lê Thanh Hà 5
10/25/2022 Lê Thanh Hà 6
10/25/2022 Lê Thanh Hà 7
For a computer display: color is a combination of color component
radiated from phosphor.
For paper: color is reflected from the materials printed on the paper.
Black ink absorb all lights coming to it.
→CMYK is subtractive of RGB
10/25/2022 Lê Thanh Hà 8
CMY uses primary colors Cyan, Magenta, and Yellow (as for color printer). They are
subtractive of RGB.
K = Key (black color):
Mixing primary is not always perfect.
Use black color instead of mixing all expensive primary color to produce cheaper one.
Yellow Green Cyan Blue
Red Magenta
White
Black
Magenta Cyan Green Red
Blue Yellow
10/25/2022 Lê Thanh Hà 9
RGB -> CMY
void RGB2CMY(float R,float G,float B,float &C,float &M,float &Y)
{
C = 1 - R;
M = 1 - G;
Y = 1 - B;
}
RGB -> CMYK
void RGB2CMYK(float R,float G,float B,float &C,float &M,float &Y,float &K)
{
RGB2CMY(R, G, B, C, M, Y);
K = min3(C, M, Y);
C = C - K;
M = M - K;
Y = Y - K;
}
10/25/2022 Lê Thanh Hà 10
Instead of using R, G, B primary color components, this color model use Hue,
Saturation and Value (HSV)
RGB and HSV comparison:
RGB color space is a cube
HSV color space is a cone
Red
Magenta
Yellow
White
Green Blue
Cyan
RGB
10/25/2022 Lê Thanh Hà 11
Hue: wavelength of color
Is presented by an angle from 00 to 3600
Value: value of brightness
Ranging in [0, 1]
V=0 -> black color.
Saturation: purity of color
Ranging in [0, 1]
10/25/2022 Lê Thanh Hà 12
Y’CbCr is used for image compression.
Y’ – luminance
Cb - Blue-Y
Cr - Red-Y
RGB to Y’CbCr conversion
Y’ = 0.299R + 0.587G + 0.114B
Cb = -0.147R - 0.289G + 0.436B
Cr = 0.615R - 0.515G - 0.1B
10/25/2022 Lê Thanh Hà 13
Color compliment
Color slicing
Color correction
Color image segmentation
10/25/2022 Le Thanh Ha 14
Like negative operator in gray-scale images
Enhancing detail embedded in dark regions.
10/25/2022 Le Thanh Ha 15
10/25/2022 Le Thanh Ha 16
Highlighting a specific range of color in an image (object
extraction)
Extending the intensity slicing in gray-scale case
W
0.5 if rij − a j
si = 2 any 1 j 3
r otherwise
i
10/25/2022 Le Thanh Ha 17
10/25/2022 Le Thanh Ha 18
Have wide variety of real-life applications related with the
human activity
A very simple and fast method may look like this:
10/25/2022 Le Thanh Ha 19