0% found this document useful (0 votes)
30 views

4 Color Concept

This document discusses color image processing and color models. It describes how color is created by combining red, green, and blue light. The RGB and CMY color models are additive and subtractive respectively. RGB uses combinations of red, green, and blue light to create colors, while CMY subtracts cyan, magenta, and yellow from white light. Direct coding and lookup tables are introduced as methods to represent color images digitally using bits or indices to color values.

Uploaded by

nikhil
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

4 Color Concept

This document discusses color image processing and color models. It describes how color is created by combining red, green, and blue light. The RGB and CMY color models are additive and subtractive respectively. RGB uses combinations of red, green, and blue light to create colors, while CMY subtracts cyan, magenta, and yellow from white light. Direct coding and lookup tables are introduced as methods to represent color images digitally using bits or indices to color values.

Uploaded by

nikhil
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

CST455: Digital Image Processing

Dr. S K Vipparthi, CSE, MNIT Jaipur

Color Image Processing


CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur

The Digital Image


Colour Fundamentals
In 1666 Sir Isaac Newton discovered that when a
beam of sunlight passes through a glass prism,
the emerging beam is split into a spectrum of
colours
CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur

Fig. The electromagnetic spectrum


CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur
Color Images
CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur

basic qualities are used to describe the quality of a


chromatic light source:
Radiance: the total amount of energy that flows
from the light source (measured in watts)
Luminance: the amount of energy an observer
perceives from the light source (measured in lumens)
Note we can have high radiance, but low luminance
Brightness: a subjective (practically unmeasurable)
notion that embodies the intensity of light
CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur

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.

❑Exactly as when you mix paint to create a color. Say


you start with a white piece of paper, where no light
is absorbed. The resulting color will be white.

❑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.

❑Keep doing this and you will in theory end up with a


mixture where all wavelengths are absorbed, that is,
black.

❑In practice, however, it will probably not be black,


but rather dark gray/brown.
CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur

Color Image
❑This notion applies when you create the wavelengths
as opposed to manipulating white light.

❑A good example is a color monitor like a computer


screen or a TV screen. Here each pixel is a
combination of emitted red, green and blue light.

❑Meaning that a black pixel is generated by not


emitting anything at all.

❑White (or rather a shade of gray) is generated by


emitting the same amount of red, green, and blue.
CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur

Color Image

❑Red will be created by only emitting red light etc.

❑All other colors are created by a combination of red,


green and blue.

❑For example yellow is created by emitting the same


amount of red and green, and no blue.
CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur

Fig.: A color image


CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur
CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur
CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur

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

CMY model (+Black = CMYK)


CMY: secondary colors of light, or primary colors
of pigments
Used to generate hardcopy output

 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

Slide credit: Bill Freeman


Blurring the G component

B
original processed

Slide credit: Bill Freeman


Blurring the R component

B
original processed

Slide credit: Bill Freeman


Blurring the B component

B
original processed

Slide credit: Bill Freeman


Direct Coding
▪ In direct coding we allocate certain amount of storage
space for each pixel to code its color.

Example:- If we allocate 3 bits for each pixel where 1 bit


each is the primary color. These 3 bits allow each primary to
vary independently between 2 intensity levels: 0 or 1.

Each pixel can take on one of the 8 colors that corresponds


to the corners of the RGB color cube.
Bit 1 [R] Bit 2 [G] Bit 3 [B] Color

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

Additive vs. Subtractive color system


involves light emitted directly  Subtractive color starts with
from a source an object that reflects light
mixes various amounts of red, and uses colorants to subtract
green and blue light to produce portions of the white light
other colors. illuminating an object to
Combining one of these produce other colors.
additive primary colors with  If an object reflects all the
another produces the additive white light back to the viewer,
secondary colors cyan, magenta, it appears white.
yellow.  If an object absorbs (subtracts)
Combining all three primary all the light illuminating it, it
colors produces white. appears black.
CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur

Hue and Saturation


❑ The hue is the dominant wavelength in the perceived light and
represents the pure color, i.e., the colors located on the edges of the
triangle in Fig.
❑ The saturation is the relative purity of the color and represents
the amount of white light mixed with the pure color (Hue).
❑ The degree of saturation being inversely propositional to the amount
of white light added.
CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur
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

The HSI Color Representation


CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur

The HSV Color Representation


CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur
CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur
CST455: Digital Image Processing
Dr. S K Vipparthi, CSE, MNIT Jaipur

HMMD Color Space


HMMD (Hue-Max-Min-Diff)
color space is closer to a White Color
perceptually uniform color Sum

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

You might also like