Lecture 3 - Color Image Processing

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 105

Color Image Processing

Preview

 Motive
- Color is a powerful descriptor that often simplifies
object identification and extraction from a scene.
- Human can discern thousands of color shades and
intensities, compared to about only two dozen
shades of gray.

H.R. Pourreza
Preview

H.R. Pourreza
Preview

H.R. Pourreza
Preview

 Color image processing is divide into two major


area:
 Full-Color Processing
 Pseudo-Color Processing

H.R. Pourreza
Color spectrum
 When passing through a prism, a beam of sunlight is
decomposed into a spectrum of colors: violet, blue,
green, yellow, orange, red
 1666, Sir Isaac Newton

6
Electromagnetic energy spectrum

 Ultraviolet  visible light  infrared


 The longer the wavelength (meter), the lower the frequency (Hz),
and the lower the energy (electron volts)
 The discovery of infrared (1800, Sir Frederick William Herschel)
 What is infrared?
http://coolcosmos.ipac.caltech.edu/cosmic_classroom/ir_tutorial/

7
Color Fundamentals (con’t)
Chromatic light spans the electromagnetic spectrum from
approximately 400 to 700 nm
human colour vision is achieved through 6 to 7 million cones in
each eye

H.R. Pourreza
Physical Background

• Visible light: a narrow band of


electromagnetic radiation →
380nm (blue) - 780nm
(red)

• Wavelength: Each physically


distinct colour corresponds to
at least one wavelength in this
band.
Color Fundamentals

• The colors that humans and some animals


perceive in an object are determined by
the nature of light reflected from the
object
Color fundamentals (cont.)
• The color that human perceive in an object =
the light reflected from the object

scene
Illumination source

reflection
eye
Achromatic vs Chromatic Light

• Achromatic (void of color) Light: Its only


contribute is its ‘Intensity’ or amount

• Chromatic Light: spans the electromagnetic


spectrum from approximately 400 to 700nm
Quantities for description of quantity of Chromatic
Source of Light

• Three basic quantities are used to describe the quantity of a


chromatic source of light:

– Radiance
• The total amount of Energy that flows from a Light Source
• It is measured in Watts
– Luminance
• Luminance gives a measure of amount of energy an observer
perceives from a light source (measured in Lumens(lm) )
• For example light emitted from a source operating in Infrared region
of Spectrum could have significant energy (Radiance) but a human
observer will hardly perceive it so luminance is zero.
– Brightness
• It is a subjective measure
• It embodies the achromatic notion of intensity and is one of the key
factors in describing color sensation
Some questions
 What does it mean when we say an object is in a
certain color?
 Why are the primary colors of human vision red,
green, and blue?
 Is it true that different portions of red, green, and
blue can produce all the visible color?
 What kind of color model is the most suitable one to
describe human vision?

14
Human Perception

• Detailed experimental evidences has established that the 6


to 7 million cones in the human eye can be divided into
three principal sensing categories, corresponding roughly to
red, green and blue

• Approximately 65% of all cones are sensitive to Red Light,


33% are sensitive to Green Light and about 2% are
sensitive to Blue Light (most sensitive)
Human Perception

• Due to these absorption characteristic of Human Eye colors


are seen as variable combinations of the so-called ‘Primary
Colors’ Red, Green and Blue

• The primary colors can be added to produce secondary


colors of Light

– Magenta (Red+Blue)
– Cyan (Green+Blue)
– Yellow (Red+Green)
Primary colors of human vision
 Cones are divided into three sensible
categories
Detailed experimental
Detailed experimental – 65% of cones are sensitive to red light
curve
Curveavailable
availableinin1965
1965 – 33% are sensitive to green light
– 2% are sensitive to blue light
 For this reason, red, green, and blue are
referred to as the primary colors of
human vision. CIE (
International Commission on Illumination)
standard designated three specific
wavelength to these three colors in 1931.
– Red (R) = 700 nm
– Green (G) = 546.1 nm
– Blue (B) = 435.8 nm

17
Some clarifications
No single color may be called red, green, or
blue.
R, G, B are only specified by standard.

18
Secondary colors
Magenta (R + B)
Cyan (G + B)
Yellow (R + G)

19
Primary Color of Light vs Primary Color of Pigments

• Red, Green and Blue Colors are Primary Colors of Light

• In Primary Color of Pigments a primary color is defined as the


one that subtracts or absorbs a primary color of Light and
reflects or transmits the other two

• Therefore the Primary Colors of Pigments are Magenta, Cyan


and Yellow and secondary colors are Red, Green and Blue

• A proper combination of three pigment primaries or a


secondary with its opposite primary produces Black

• Color Television Reception is an example of the additive


nature of Light Colors
Primary colors of light v.s.
primary colors of pigments
• Primary color of pigments
– Color that subtracts or absorbs a primary color of
light and reflects or transmits the other two

Color of light: R G B

r of pigments: absorb R absorb G absorb B


Cyan Magenta Yellow
Tri-Stimulus Values

• The amount of Red, Green and Blue needed to form a


particular color (denoted by X, Y and Z)

• A color is then specified by its “Tri-chromatic Coefficients”

• Thus x+y+z=1
Chromaticity Diagram

• Another approach for specifying colors is to use


chromaticity diagram

• Shows color compositions as a function of x(red) and


y(green)

• For any x and y the corresponding value of z(blue) can be


obtained as

z=1-x-y
Chromaticity Diagram
Chromaticity Diagram
 To determine the range of
colors that can be obtained
from the 3 given colors in the
CD, we simply draw
connecting lines to each of
the three color points.
 The result is a triangle and
any color inside a triangle is
produced by various
combinations of the three
initial colors.
 The triangle shows a typical
range of colors (called the
color gamut) produced by
RGB monitor
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 portions of the white light
produce 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, it appears white.
magenta, yellow.  If an object absorbs (subtracts)
 Combining all three primary all the light illuminating it, it
colors produces white. appears black.

27
Color characterization

 Brightness: chromatic notion of intensity


 Hue: dominant color perceived by an observer
 Saturation: relative purity or the amount of
white mixed with a hue

120o
G
S
H
R 0o

240o B 28
Some clarifications
So when we call an object red, orange, etc. we
refer to its hue
Chromaticity: hue + saturation

29
Color Models
• The purpose of a color model (also called Color Space or Color
System) is to facilitate the specification of colors in some
standard way

• A color model is a specification of a coordinate system and a


subspace within that system where each color is represented by
a single point

• Color Models

RGB (Red, Green, Blue)


CMY (Cyan, Magenta, Yellow)
HSI (Hue, Saturation, Intensity)
YIQ (Luminance,In phase, Quadrature)
YUV (Y' stands for the luma component (the brightness) and U and
V are the chrominance (color) components )
RGB Model
• In this model, the primary colors are
red, green, and blue. It is an additive
model, in which colors are produced by
adding components, with white having
all colors present and black being the
absence of any color.

• This is the model used for active


displays such as television and
computer screens.

• The RGB model is usually represented


by a unit cube with one corner located
at the origin of a three-dimensional
color coordinate system, the axes
being labeled R, G, B, and having a
range of values [0, 1]. The origin (0, 0,
0) is considered black and the
diagonally opposite corner (1, 1, 1) is
called white. The line joining black to
white represents a gray scale and has
equal components of R, G, B.
32
RGB Color Cube

• The total number of colors in a 24 Bit image is


(28)3 =16,777,216 (> 16 million)
Generating RGB image
CMY and CMYK Color Model
• Cyan, magenta, and yellow are the secondary colors with respect to the
primary colors of red, green, and blue. However, in this subtractive model,
they are the primary colors and red, green, and blue, are the secondaries.
In this model, colors are formed by subtraction, where adding different
pigments causes various colors not to be reflected and thus not to be seen.
Here, white is the absence of colors, and black is the sum of all of them.
This is generally the model used for printing.

• Most devices that deposit color pigments on paper (such as Color Printers
and Copiers) requires CMY data input or perform RGB to CMY conversion
internally

C 1.00 R

M = 1.00
- G

Y 1.00 B
CMY and CMYK Color Model

• CMY is a Subtractive Color Model

• Equal amounts of Pigment primaries (Cyan, Magenta and


Yellow) should produce Black

• In practice combining these colors for printing produces a


“Muddy-Black” color

• So in order to produce “True-Black” a fourth color “Black” is


added giving rise to CMYK model
37
38
CMY Color Model
CMY Color Model
HSI Color Model

– Hue (dominant colour seen)


• Wavelength of the pure colour observed in the
signal.
• Distinguishes red, yellow, green, etc.
• More than 400 hues can be seen by the human
eye.

– Saturation (degree of dilution)


• Inverse of the quantity of “white” present in the
signal. A pure colour has 100% saturation, the
white and grey have 0% saturation.
• Distinguishes red from pink, marine blue from
royal blue, etc.
• About 20 saturation levels are visible per hue.

– Intensity
• Distinguishes the gray levels.
HSI Color Model

• Separates out intensity I from the coding

• Two values (Hue & Saturation) encode chromaticity

• Intensity encode monochrome part.

• Hue and saturation of colors respond closely to the way


humans perceive color, and thus this model is suited for
interactive manipulation of color images .
43
HSI color model (cont.)
• RGB -> HSI model Colors on this triangle
Have the same hue
Intensity
line
saturation
HSI Color Model
Hue, Saturation, Intensity

47
RGB-to-HSI conversion (*)

1
I = (R + G + B )
3
3
S =1 - min (R, G, B )
I
é 1 ù
[(R - G )+ (R - B )]
-1ê 2 ú
q =cos ê ú
2
ê (R - G ) + (R - B )(G - B )ú
ë û
ìq G³B
H =í
î2p - q G £B

48
HSI-to-RGB conversion (*)
 For 0o <= H < 120o
é S cos(H ) ù
R =I ê1 + ú, B =I (1 - S ), G =I - R - B
ë cos(60 - H )û

 For 120o <= H < 240o


(
é S cos H - 120 
G =I ê1 +
)ù, R =I (1 - S ), B =I - R - G
ë cos (
180 
- H) úû
 For 240o <= H < 360o
é S cos(H - 240 )ù
B =I ê1 + ú, G =I (1 - S ), R =I - G - B
ë cos(300 - H ) û

49
RGB vs. HSI

50
• Adding white pigment to a pure color produces a tint. For
example, adding white to red makes pink.
• Adding black pigment to a pure color produces a shade. For
example, adding black to red makes dark red.
• Adding both white and black to a pure color produces a tone.
• A mixture of white and black, with no color added, produces a
shade of gray.
51
Color Wheel

52
Color Image to Greyscale Image
Conversion
To convert a color from a colorspace based on an
RGB color model to a grayscale representation of
its luminance, weighted sums must be calculated in
a linear RGB space,
HSV Color Model
• The hue (H) of a color refers to which pure color it resembles.
All tints, tones and shades of red have the same hue.
• Hues are described by a number that specifies the position of the
corresponding pure color on the color wheel, as a fraction
between 0 and 1. Value 0 refers to red; 1/6 is yellow; 1/3 is
green; and so forth around the color wheel.
• The saturation (S) of a color describes how white the color is. A
pure red is fully saturated, with a saturation of 1; tints of red have
saturations less than 1; and white has a saturation of 0.
• The value (V) of a color, also called its lightness, describes how
dark the color is. A value of 0 is black, with increasing lightness
moving away from black.
54
Hexacone Model of the Color
space

55
• The outer edge of the top of the cone is the color wheel, with
all the pure colors. The H parameter describes the angle around
the wheel.
• The S (saturation) is zero for any color on the axis of the cone;
the center of the top circle is white. An increase in the value of
S corresponds to a movement away from the axis.
• The V (value or lightness) is zero for black. An increase in the
value of V corresponds to a movement away from black and
toward the top of the cone.

56
HSV Model
HSV to RGB
HSV to RGB
Problem
Let the RGB values of a point be (0.4, 0.6,
0.8). Find the HSV equivalent of RGB. Also
verify whether the original point can be
obtained by the inverse transform from HSV
to RGB.
Solution
Let the RGB values of a point be (0.4, 0.6, 0.8).
Find the HSV equivalent of RGB. Also verify
whether the original point can be obtained by
the inverse transform from HSV to RGB.
Solution:
Kmax = 0.8
Kmin = 0.4
K = Kmax – Kmin = 0.8 – 0.4 = 0.4
Therefore,
V = Kmax = 0.8
Solution
S = K / Kmax = 0.4 / 0.8 = 0.5
R’ = (Kmax – R) / K =(0.8 – 0.4) / 0.4 = 1
G’ = (Kmax – G) / K =(0.8 – 0.6) / 0.4 = 0.5
B’ = (Kmax – B) / K =(0.8 – 0.8) / 0.4 = 0

Finally, H’ = G’ – R’ + 4 = 0.5-1+4 = 3.5


Therefore, =3
Since
H’>0
H = (1/6) X 3.5 = 0.58
Solution
Finally the HSV points corresponding to RGB point is
(0.58, 0.5, 0.8). This can be converted back to RGB.

Since, = 3.5 = 3, for case 3, the resultant RGB is (x,y,v).


Here v=V. Therefore V=0.8. x & y can be calculated using:

x = (1-S)XV = (1-0.5)x0.8 = 0.4

y = (1-(Sx(H’ – ))) x 0.8 = 0.75 x 0.8 = 0.6

Therefore the original values of RGB are exactly obtained.


Color Image to Grey
CMY and CMYK Model
TV Color Models

TV Analog Video Formats - National Television System Committee


Phase Alternating Line format
68
• The type of representation depends on the applications at
hand applications at hand
– For display or printing, choose primary colors so that more colors can
be produced E g so that more colors can be produced
– E.g. RGB for displaying and CMY for printing.
– For analytical analysis of color differences
– For analytical analysis of color differences, HSI is more suitable.
– For transmission or storage, choose a less redundant representation,
eg. YIQ or YUV or YCbCr

– http://colorizer.org/

69
Color Quantization
 The process of converting mathematical model in to
image is called rendering.
 During rendering the RGB color components may be
floating point numbers. Therefore , it is necessary to
convert it in to binary values for proper display.
 Conversion of floating values to binary is called
quantization.
 The process of picking the best 256 colors are also called
color quantization.
Color Quantization
Quantization
• Reduce the number of bits used to store each
coefficient by dividing by a given value
– If you have an 8 bit number (0-255) and divide it by 8, you
get a number between 0-31 (5 bits = 8 bits – 3 bits)
– Different coefficients are divided by different amounts
– Perceptual issues come in here
• Achieves the greatest compression, but also quality
loss
• “Quality” knob controls how much quantization is
done
09/17/02 (C) 2002, University of Wisconsin, CS 559
Color Quantization
• The problem of reducing the number of colors
in an image with minimal impact on appearance
– Extreme case: 24 bit color to black and white
– Less extreme: 24 bit color to 256 colors, or 256
grays
• Sub problems:
– Decide which colors to use (if there is a choice)
– Decide which of those each original color maps to

09/17/02 (C) 2002, University of Wisconsin, CS 559


Example (24 bit color)

09/17/02 (C) 2002, University of Wisconsin, CS 559


Uniform Quantization
• Break the color space into uniform cells
• Find the cell that each color is in, and map it to the center
• Generally does poorly because it fails to capture the
distribution of colors
– Some cells may be empty, and are wasted
• Equivalent to dividing each color by some number and
taking the integer part
– Say your original image is 24 bits color (8 red, 8 green, 8 blue)
– Say you have 256 colors available, and you choose to use 8 reds,
8 greens and 4 blues (8 × 8 × 4 = 256 )
– Divide original red by 32, green by 32, and blue by 64

09/17/02 (C) 2002, University of Wisconsin, CS 559


76
Uniform Quantization
• 8 bits per pixel in this
image
• Note that it does very
poorly on smooth
gradients
• Normally the hardest part
to get right, because lots
of similar colors appear
very close together
• Does this scheme use
information from the
image?

09/17/02 (C) 2002, University of Wisconsin, CS 559


78
Image Quality Metrics

79
Uniform Quantization

K  Set of best colors


M  the range of colors
Popularity Algorithm
Median Cut Algorithm
Octree Based Method
Summary
 Color spectrum vs. EM spectrum
– Wavelength vs. frequency
– Middle IR, near IR, far IR, visible
 Primary color vs. secondary color for human vision
– Primary color of pigment
 Additive vs. subtractive color system
 Color characterization
– Chromaticity
• hue + saturation
• Chromaticity diagram
– Brightness
 Color models
– RGB vs. CMYK vs. HSI

84
Color image processing
• Pseudo-color image processing
– Assign color to monochrome images
– Intensity slicing
– Gray level to color transformation
• Spatial domain approach – three different transformation
functions
• Frequency domain approach – three different filters
• Full-color image processing
– Color image enhancement and restoration
– Color compensation

85
Intensity slicing

Similar to c2
thresholding c1

0 Ii L

86
Gray level to color transformation – spatial
domain
 Perform three independent transformations on the gray level
of any input pixel.
 The three results can then serve as the red, green, and blue
components of a color image

87
Examples

88
Example 2

89
Gray level to color transformation –
frequency domain
 Color code regions of an image based on frequency content
 The Fourier transform of an image is modified independently by three filters to
produce three images used as Fourier transform of the R, G, B components of a
color image
 Additional processing can be any image enhancement algorithm like histogram
equalization

90
Example
Red from highpass
Green from bandpass
Blue from lowpass

91
Full-color image processing
 Color transformations
– Processing in RGB, HSI, or CMY(K) space
 Tone and color corrections
– Calibrate images using the CIELAB model (L*a*b* model)
 Point-based processing
 Mask-based processing

92
Adjusting intensity in different color
spaces

93
Color gamut of color monitor and
color printing

94
CIELAB (L*a*b* color model)
 Maintain a high degree of color consistency between the
monitors used and the eventual output devices
 Device-independent color model that relates the color
gamuts of the monitors and output devices

æY ö
L* =116.hç ÷- 16
çY ÷
èWø The CIELAB gamut encompasses
é æ X ö æY the entire visible spectrum and
öù
a* =500 êhç
çX ÷÷- hçç ÷ú
÷ can represent accurately the
ë è W ø èYW øû colors of any display, print, or
é æ Y ö æ Z öù input device
b* =200 êhç
çZ ÷ ÷- hç çZ ÷ ÷ú
ë è W ø è W øû
ì3 q q > 0.008856
h(q) =í 95
î7.787 q + 16 / 116 q £0.008856
Tonal
correction
example

Color is not
changed
(RGB or I)

96
Color
correction
example

97
Histogram processing

98
Mask-based processing
Per-image basis vs. direct operation on color
vector space

f ( x, y ) =s
ér ù
ê ú
f ( x, y ) =êg ú
ê
ëb ú
û

99
Color image
smoothing

100
Color image sharpening

101
Color edge detection
Section 6.7.3

102
Noise in color image

103
104
105

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy