Lect13 Color Image Processing · 2011. 1. 10. · Lecture 13. Color Image Processing Autumn 2010....
Transcript of Lect13 Color Image Processing · 2011. 1. 10. · Lecture 13. Color Image Processing Autumn 2010....
Digital Image ProcessingDigital Image Processing
Lecture 13. Color Image ProcessingLecture 13. Color Image Processing
Autumn 2010Autumn 2010
1/10/2011 2
Color FundamentalsColor Fundamentals
1/10/2011 3
Color FundamentalsColor Fundamentals
Color FundamentalsColor Fundamentals
The colors that humans and most animals perceive in an object are determined by the nature of the light reflected from the object
►For example, green objects reflect light with wave lengths primarily in the range of 500 – 570 nm whileabsorbing most of the energy at other wavelengths
White Light
Colours Absorbed
Green Light
►► Color ModelColor Model�� A mathematical system for representing colorA mathematical system for representing color
►► The human eye combines 3 primary colors (using the 3 different The human eye combines 3 primary colors (using the 3 different types of cones) to discern all possible colors.types of cones) to discern all possible colors.
►► Colors are just different light frequenciesColors are just different light frequencies
�� red red –– 700nm wavelength700nm wavelength
�� green green –– 546.1 nm wavelength546.1 nm wavelength
�� blue blue –– 435.8 nm wavelength435.8 nm wavelength
►► Higher frequencies are Higher frequencies are coolercooler colorscolors
5
Color FundamentalsColor Fundamentals
1/10/2011 6
Color FundamentalsColor Fundamentals
► 6 to 7 million cones in the human eye can be divided into three principal sensing categories, corresponding roughly to red, green, and blue.
65%: red 33%: green 2%: blue (blue cones are the most sensitive)
1/10/2011 7
Color FundamentalsColor Fundamentals
1/10/2011 8
Color FundamentalsColor Fundamentals
► The characteristics generally used to distinguish one color from another are brightness, hue, and saturation
brightness: the achromatic notion of intensity.
hue: dominant wavelength in a mixture of light waves, represents dominant color as perceived by an observer.
saturation: relative purity or the amount of white light mixed with its hue.
Color FundamentalsColor Fundamentals
3 basic qualities are used to describe the quality of a 3 basic qualities are used to describe the quality of a chromatic light source:chromatic light source:
�� Radiance:Radiance: the total amount of energy that flows from the light the total amount of energy that flows from the light source (measured in watts)source (measured in watts)
�� Luminance:Luminance: the amount of energy an observer the amount of energy an observer perceives perceives from the from the light source (measured in lumens)light source (measured in lumens)
►► Note we can have high radiance, but low luminanceNote we can have high radiance, but low luminance
�� Brightness:Brightness: a subjective (practically unmeasurable) notion that a subjective (practically unmeasurable) notion that embodies the intensity of lightembodies the intensity of light
Primary ColorsPrimary Colors
►► Primary colors of Primary colors of lightlight are are additiveadditive
�� Primary colors are red, green, and bluePrimary colors are red, green, and blue
�� Combining red + green + blue yields whiteCombining red + green + blue yields white
►► Primary colors of Primary colors of pigmentpigment are are subtractivesubtractive
�� Primary colors are cyan, magenta, and yellowPrimary colors are cyan, magenta, and yellow
�� Combining cyan + magenta + yellow yields blackCombining cyan + magenta + yellow yields black
10
RGB Color modelRGB Color model
11
Active displays, such as computer monitors and television sets, emit
combinations of red, green and blue light. This is an additive color model
Source: www.mitsubishi.com
CMY Color modelCMY Color model
12
Passive displays, such as color inkjet printers, absorb light instead of
emitting it. Combinations of cyan, magenta and yellow inks are used. This
is a subtractive color model.
Source: www.hp.com
RGB vs CMYRGB vs CMY
RGB color cubeRGB color cube
RGB 24-bit color cube
RGB and CMY Color CubesRGB and CMY Color Cubes
15
RGB ExampleRGB Example
16
Original Green Band Blue BandRed Band
RGB ExampleRGB Example
17
Original No GreenNo Red No Blue
RGB ExampleRGB Example
1/10/2011 19
The CMY and CMYK Color ModelsThe CMY and CMYK Color Models
1
1
1
C R
M G
Y B
= −
Equal amounts of the pigment primaries, cyan, magenta, and yellow should produce black. In practice, combining these colors for printing produces a muddy-looking black.
To produce true black, the predominant color in printing, the fourth color, black, is added, giving rise to the CMYK color model.
1/10/2011 20
http://en.wikipedia.org/wiki/CMYK
CMY vs. CMYK
Subtractive mixing of inksSubtractive mixing of inks
►► Inks subtract light from white.Inks subtract light from white.
►► Linearity depends on pigment properties Linearity depends on pigment properties
�� inks, paints, often hugely noninks, paints, often hugely non--linear.linear.
►► Inks: Cyan=WhiteInks: Cyan=White--Red, Magenta=WhiteRed, Magenta=White--Green, Yellow=WhiteGreen, Yellow=White--Blue.Blue.
►► For a good choice of inks, For a good choice of inks, and good registrationand good registration, matching is linear and , matching is linear and easyeasy
►► eg. C+M+Y=Whiteeg. C+M+Y=White--White=Black, C+M=WhiteWhite=Black, C+M=White--Yellow=BlueYellow=Blue
►► Usually require CMY and Black, because colored inks are more expUsually require CMY and Black, because colored inks are more expensive, ensive, and registration is hard (CMYK)and registration is hard (CMYK)
►► For good choice of inks, there is a linear transform between XYZFor good choice of inks, there is a linear transform between XYZ and and CMYCMY
Color receptors and color deficiencyColor receptors and color deficiency
►► In color normal people, there In color normal people, there are three types of color are three types of color receptor, called receptor, called conescones, which , which vary in their sensitivity to light vary in their sensitivity to light at different wavelengths at different wavelengths (shown by molecular (shown by molecular biologists).biologists).
►► Deficiency by optical problems Deficiency by optical problems in the eye, or by absent in the eye, or by absent receptor types receptor types �� Usually a result of absent Usually a result of absent
genes.genes.
►► Some people have fewer than Some people have fewer than three types of receptor; most three types of receptor; most common deficiency is redcommon deficiency is red--green green color blindness in men. color blindness in men.
►► Color deficiency is less common Color deficiency is less common in women; red and green in women; red and green receptor genes are carried on receptor genes are carried on the X chromosome, and these the X chromosome, and these are the ones that typically go are the ones that typically go wrong. Women need two bad X wrong. Women need two bad X chromosomes to have a chromosomes to have a deficiency, and this is less deficiency, and this is less likely.likely.
HSI Color ModelHSI Color Model
►► Based on human perception of colors. Based on human perception of colors. ColorColor is is ““decoupleddecoupled”” from from
intensityintensity..
�� HUEHUE
►► A subjective measure of colorA subjective measure of color
►► Average human eye can perceive ~200 different colorsAverage human eye can perceive ~200 different colors
�� SaturationSaturation
►► Relative purity of the color. Mixing more Relative purity of the color. Mixing more ““whitewhite”” with a color with a color
reduces its saturation.reduces its saturation.
►► PinkPink has the same has the same huehue as as redred but less but less saturationsaturation
�� IntensityIntensity
►► The brightness or darkness of an objectThe brightness or darkness of an object
23
HSI Color ModelHSI Color Model
24
H
dominant
wavelength
S
purity
% white
I
Intensity
Source: http://www.cs.cornell.edu/courses/cs631/1999sp/
HSI Color ModelHSI Color Model
►► HueHue is defined as an angleis defined as an angle
�� 0 degrees is 0 degrees is REDRED
�� 120 degrees is 120 degrees is GREENGREEN
�� 240 degrees is 240 degrees is BLUEBLUE
►► SaturationSaturation is defined as the percentage of distance from the center is defined as the percentage of distance from the center
of the HSI triangle to the pyramid surface.of the HSI triangle to the pyramid surface.
�� Values range from 0 to 1.Values range from 0 to 1.
►► IntensityIntensity is denoted as the distance is denoted as the distance ““upup”” the axis from black. the axis from black.
�� Values range from 0 to 1Values range from 0 to 1
25
1/10/2011 26
HSI Color ModelHSI Color Model
HSI Color ModelHSI Color Model
27
HSI and RGBHSI and RGB
28
RGB and HSI are commonly used to specify colors
in software applications.
HSI has variants such as HSL and HSB both all of
which model color in the same fundamental way.
Conversion Between RGB and HSIConversion Between RGB and HSI
Image Image ““TypesTypes””(categorized by (categorized by ““colorcolor””))
►►Binary ImageBinary Image�� has exactly two colorshas exactly two colors
►►GrayscaleGrayscale�� has no chromatic contenthas no chromatic content
►►CCoolloorr�� contains some pixels with colorcontains some pixels with color
�� more than two colors existmore than two colors exist
31
Color DepthColor Depth
►► Describes the ability of an image to accurately reproduce colorsDescribes the ability of an image to accurately reproduce colors
�� Given as the Given as the ““number of bits consumed by a single pixelnumber of bits consumed by a single pixel””
�� Otherwise known as Otherwise known as ““bits per pixelbits per pixel”” (bpp)(bpp)
►► Binary images are ____ bpp?Binary images are ____ bpp?
►► Grayscale images are typically ____ bpp?Grayscale images are typically ____ bpp?
►► Color images are typically ____ bpp?Color images are typically ____ bpp?
32
33
A B
C D
A: 1 bpp
B: 2 bpp
C: 5 bpp
D: 24 bpp
Tristimulus ValuesTristimulus Values
►► Tristimulus valueTristimulus value
�� The amounts of red, green, and blue needed to form The amounts of red, green, and blue needed to form
any particular color are called the any particular color are called the tristimulus valuestristimulus values, ,
denoted by X, Y, and Z.denoted by X, Y, and Z.
�� Only two chromaticity coefficients are necessary to Only two chromaticity coefficients are necessary to
specify the chrominance of a light.specify the chrominance of a light.
1=++ ZYX
CIE CIE ChromacityChromacity DiagramDiagram
Specifying colors systematically can be achieved Specifying colors systematically can be achieved
using the CIE using the CIE chromacitychromacity diagramdiagram
On this diagram the xOn this diagram the x--axis represents the proportion axis represents the proportion
of red and the yof red and the y--axis represents the proportion of axis represents the proportion of
red used red used
The proportion of blue used in a color is calculated The proportion of blue used in a color is calculated
as:as:
z = 1 z = 1 –– (x + y)(x + y)
CIE CIE ChromacityChromacity Diagram (contDiagram (cont……))
Green: 62% green, Green: 62% green,
25% red and 13% blue25% red and 13% blue
Red: 32% green, 67% Red: 32% green, 67%
red and 1% bluered and 1% blue
CIE Chromacity Diagram (contCIE Chromacity Diagram (cont……))
►►Any color located on the boundary of the chromacity chart Any color located on the boundary of the chromacity chart
is fully saturatedis fully saturated
►►The point of equal energy has equal amounts of each color The point of equal energy has equal amounts of each color
and is the CIE standard for pure whiteand is the CIE standard for pure white
►►Any straight line joining two points in the diagram defines Any straight line joining two points in the diagram defines
all of the different colors that can be obtained by combining all of the different colors that can be obtained by combining
these two colors additivelythese two colors additively
►►This can be easily extended to three pointsThis can be easily extended to three points
CIE Chromacity Diagram (contCIE Chromacity Diagram (cont……))
►►This means the entire This means the entire
color range cannot be color range cannot be
displayed based on any displayed based on any
three colorsthree colors
►►The triangle shows the The triangle shows the
typical color gamut typical color gamut
produced by RGB monitorsproduced by RGB monitors
►►The strange shape is the The strange shape is the
gamut achieved by high gamut achieved by high
quality color printersquality color printers
Color ModelsColor Models
►► Specify three primary or secondary colorsSpecify three primary or secondary colors�� Red, Green, Blue.Red, Green, Blue.
�� Cyan, Magenta, Yellow.Cyan, Magenta, Yellow.
►► Specify the luminance and chrominanceSpecify the luminance and chrominance�� –– HSB, HSI or HSV (Hue, saturation, and brightness, intensity or HSB, HSI or HSV (Hue, saturation, and brightness, intensity or
value)value)
►► Amplitude specification:Amplitude specification:�� 8 bits per color component, or 24 bits per pixel8 bits per color component, or 24 bits per pixel
�� Total of 16 million colorsTotal of 16 million colors
Comparison of Different Color SpacesComparison of Different Color Spaces
Much details than other bands (can be used for processing color images)
1/10/2011 41
Pseudocolor Image ProcessingPseudocolor Image Processing
► The process of assigning colors to gray values based on a specified criterion.
► Intensity Slicing
( , ) if ( , )k k
f x y c f x y V= ∈
1/10/2011 42
1/10/2011 43
Intensity SlicingIntensity Slicing
►► Pixels with grayPixels with gray--scale (intensity) value in the range of (scale (intensity) value in the range of (f f ii--11 , f, fii) are ) are rendered with color rendered with color CiCi
1/10/2011 45
1/10/2011 46
1/10/2011 47
1/10/2011 48
Pseudocolor Image ProcessingPseudocolor Image Processing
► Intensity to Color Transformation
1/10/2011 49
The images are obtained from an airport X-ray scanning system.The left contains ordinary articles and the right contains the same articles as well as a block of simulated plastic explosives.
1/10/2011 50
Basics of FullBasics of Full--Color Image ProcessingColor Image Processing
Let represent an arbitrary vector in RGB color space:
At coordinates ( , ),
( , ) ( , )
( , ) ( , ) ( , )
( , ) ( , )
R
G
B
R
G
B
c
c R
c c G
c B
x y
c x y R x y
c x y c x y G x y
c x y B x y
= =
= =
1/10/2011 51
Basics of FullBasics of Full--Color Image ProcessingColor Image Processing
1/10/2011 52
Color Image SmoothingColor Image Smoothing
( , )
Let denote the set of coordinates defining a neighborhood
centered at ( , ) in an RGB color image. The average of the
RGB component vectors in this neighborhood is
1 ( , ) ( , )
xy
xy
s t S
S
x y
c x y c s tK ∈
=
( , )
( , )
( , )
1( , )
1( , )
1( , )
xy
xy
xy
s t S
s t S
s t S
R s tK
G s tK
B s tK
∈
∈
∈
=
∑
∑ ∑
∑
1/10/2011 53
1/10/2011 54
1/10/2011 55
1/10/2011 56
Color Image SharpeningColor Image Sharpening
[ ]
2
2 2
2
The Laplacian of vector c is
( , )
( , ) ( , )
( , )
R x y
c x y G x y
B x y
∇
∇ = ∇ ∇
1/10/2011 57
1/10/2011 58
Color Edge Detection (1)Color Edge Detection (1)
Let r, g, and b be unit vectors along the R, G, and B
axis of RGB color space, and define vectors
u r g b
and
v r g b
R G B
x x x
R G B
y y y
∂ ∂ ∂= + +
∂ ∂ ∂
∂ ∂ ∂= + +
∂ ∂ ∂
1/10/2011 59
Color Edge Detection (2)Color Edge Detection (2)
2 2 2
2 2 2
u u=
v v=
and
u v=
xx
yy
xy
R G Bg
x x x
R G Bg
y y y
R R G G B Bg
x y x y x y
∂ ∂ ∂= + +
∂ ∂ ∂
∂ ∂ ∂= + +
∂ ∂ ∂
∂ ∂ ∂ ∂ ∂ ∂= + +
∂ ∂ ∂ ∂ ∂ ∂
�
�
�
1/10/2011 60
Color Edge Detection (3)Color Edge Detection (3)
1
The direction of maximum rate of change of c( , ) is given by
the angle
21 ( , ) tan
2
The value of the rate of change at ( , ) in the direction of ( , ),
is given by
1F ( , )=
2
xy
xx yy
x
x y
gx y
g g
x y x y
x y gθ
θ
θ
−
= −
( ) ( )1/2
cos 2 ( , ) 2 sin 2 ( , )x yy xx yy xy
g g g x y g x yθ θ + + − +
1/10/2011 61
1/10/2011 62