4 Color Concept
4 Color Concept
Color
❑When the resulting color is created by illuminating
an object by white light and then absorbing some of
the wavelengths (colors) we use the notion of
subtractive colors.
❑If you then want the paper to become green you add
green paint, which absorbs everything but the green
wavelengths.
CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur
Color
❑If you add yet another color of paint, then more
wavelengths will be absorbed, and hence the
resulting light will have a new color.
Color Image
❑This notion applies when you create the wavelengths
as opposed to manipulating white light.
Color Image
RGB to GRAY
Fig.: A color image and how it can be mapped to different gray-scale images
depending on the weights
CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur
Normalized RGB
RGB Color Model
▪ The color is a complex and interdisciplinary
subject spanning from physics to psychology.
▪ A color coordinate system has 3 primary colors –
Red, Green and Blue.
▪ Each color take on an intensity value ranging from
0 (Off - Lowest) to 1 (On - Highest).
▪ Mixing of these primary colors at different
intensity levels produces a variety of colors.
▪ The collection of all the colors obtained by such a
linear combination of R,G,B form the cube shape
color combination.
RGB Color Model
▪ The corner of the RGB color cube that is at the origin of the
coordinate system corresponds to black.
▪ The corner of the cube that is diagonally opposite to the
origin represents white.
▪ The diagonal line connecting black and white corresponds
to all the gray colors between black and white is called gray
axis.
▪ Color specification using RGB model is an additive process.
▪ We begin with black and add on the approximate primary
component to yeild a desired color.
▪ This closely matches to the working principles of the display
monitor.
CMY
▪ On other hand there is a complementary color model called
CMY.
▪ CMY color model defines color by subtractive process.
▪ Subtractive models closely works with the working
principles of Printers.
▪ In CMY model we begin with white and take away the
approximate primary components to yield a desired color.
Ex:- If we subtract red from white, what remains
consist of green and blue is called Cyan.
▪ Let’s look at from another perspective –
▪ We can use the amount of cyan (the complementary color
of red), to control the amount of red, which is equal to one
minus the amount of cyan (1-cyan).
CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur
C 1 R
M = 1 − G
Y 1 B
CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur
Spatial resolution and color
B
original
B
original processed
B
original processed
B
original processed
0 0 0 Black
0 0 1 Blue
0 1 0 Green
0 1 1 Cyan
1 0 0 Red
1 0 1 Magenta
1 1 0 Yellow
1 1 1 White
▪ A widely accepted industry standard uses 3 Bytes (24 bits), with
one Byte for each primary color.
▪ This way we allow each primary color to have 256 different
intensity levels. It corresponds to binary values from 00000000 to
11111111.
▪ Hence a pixel can take one color from 256x256x256 or 16.7 million
possible choices.
▪ This 24-bit format is commonly referred to a true color
representation.
▪ The difference between 2 colors that differs by one intensity level
in one or more of the primaries is virtually undetected under
normal viewing conditions.
▪ Hence more precise representations involving more bits are of little
use in terms of perceived color accuracy.
▪ The direct coding method features simplicity and
supports a variety of applications.
▪ We can see relatively high demand for storage space
when it comes to the 24-bit standard.
▪ Ex:- A 1000x1000 true color image would take up 3-
million Bytes.
▪ If every pixel in that image had a different color, there
would be 1-million colors in that image.
▪ Hence the 24-bit representations ability to have 16.7
million different colors appear simultaneously in a
single image seems to be somewhat overkill!
Lookup Table
▪ The lookup table contains 256 entries
▪ The entries have address 0 to 255.
▪ Each entry contain 24-bit RGB color values.
▪ Pixel values are now 8-bit or 1 Byte quantities.
▪ The color of a pixel whose value is i, where 0<i<255, is
determined by the color value in the table entry whose
address is i.
▪ This 24-bit, 256 entry lookup table representation is often
referred as 8-bit format.
▪ It reduces the storage requirement of 1000x1000 image to
1-million Bytes + 768 (256x3) Bytes for the color values in
lookup table.
▪ It allows 256 simultaneous colors which are
chosen from 16.7 million possible colors.
▪ Using lookup table representation, An image
is defined not only by its pixels values but also
by its color values in the corresponding lookup
table.
▪ Those color values form a color map for the
image.
CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur
RGB to HSI
http://fourier.eng.hmc.edu/e161/lectures/ColorProcessing/node2.html
CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur
space. Min
Min = min(R,G,B);
Max = max(R,G,B); Diff
Diff = Max – Min;
Sum = (Max + Min)/2; Hue
Max
-Hue the same as in HSV
Black Color
CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur
Max: indicates how much black color it has, giving a flavor of shade or
blackness.
Min: indicates how much white color it has, giving a flavor of tint or
whiteness.
Diff: indicates how much gray it contains and how close to the pure color,
giving a flavor of tone or colorfulness.
Sum: simulates the brightness of the color.
CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur
Chromaticity
Chromaticity: hue +
saturation
Tristimulus: the X
x=
amount of R, G, B needed X +Y + Z
Y
to form any color (X, Y, Z) y=
X +Y + Z
Trichromatic z=
Z
coefficients: x, y, z X +Y + Z
x + y + z =1