chapter 6 color image processing - concordia...
TRANSCRIPT
© 2002 R. C. Gonzalez & R. E. Woods
Chapter 6 Color Image Processing
Color Spectrum: six broad regions – violet, blue, green, yellow, orange and red
© 2002 R. C. Gonzalez & R. E. Woods
Color Spectrum
Each color blends smoothly into the next.
Visible light is composed of a relatively narrow band of frequencies in the electromagnetic spectrum.
© 2002 R. C. Gonzalez & R. E. Woods
Absorption of Light by Cones in the Human Eye
Cones are the sensors in the eye responsible for color vision.
© 2002 R. C. Gonzalez & R. E. Woods
Primary and Secondary Colors of Light and Pigments
Three primary colors and their combinations to produce the secondary colors. Example: Color TV
Three pigment primaries and their combinations
© 2002 R. C. Gonzalez & R. E. Woods
Characteristics Used to Distinguish One Color from Another
Brightness: chromatic notion of intensity Hue: dominant wavelength Saturation: relative purity or amount of white light mixed with a hue. Hue and saturation taken together are called chromaticity.
© 2002 R. C. Gonzalez & R. E. Woods
Tristimulus Values and Trichromatic Coefficients
tristimulus values: X - red, Y- green, Z – blue trichromatic coefficients:
ZYXZz
ZYXYy
ZYXXx
++=
++=
++=
© 2002 R. C. Gonzalez & R. E. Woods
CIE Chromaticity Diagram
Color composition as a function of x and y: z = 1-(x+y) Also shows the wave- length: from 380nm (violet) to 780 nm (red).
Green point: x=62% y=25%, therefore, z=13%.
© 2002 R. C. Gonzalez & R. E. Woods
Typical Color Gamut of Color Monitors and Color Printing Devices
triangle: color monitors irregular region: color printing devices
© 2002 R. C. Gonzalez & R. E. Woods
RGB (red, green, blue) model: Ideal for image color generation. It’s used for color monitors and color video cameras.
CMY(cyan, magenta, yellow) and CMYK (cyan, magenta,
yellow and black) model: It is used for color printing. HSI (hue, saturation, intensity) model: Ideal for color
description.
Color Models
© 2002 R. C. Gonzalez & R. E. Woods
Schematic of the RGB Color Tube
R,G,B: normalized, i.e. in the region of [0,1]. The different colors are points on or inside the cube, and are defined by vectors extending from the origin.
© 2002 R. C. Gonzalez & R. E. Woods
RGB 24-bit Color Cube
Each image consists of 3 component images, one for each primary color. Pixel depth: # of bits used to represent each pixel in RGB space.
The total number of colors in this 24-bit RGB image is 224 = 16777216
© 2002 R. C. Gonzalez & R. E. Woods
Process of Acquiring a Color Image filters
© 2002 R. C. Gonzalez & R. E. Woods
Safe RGB Colors
Safe RGB colors are a subset of colors that are likely to be reproduced faithfully, reasonably, independently of viewer hardware capability. In 256 colors, 216 colors are common to most system (safe colors).
© 2002 R. C. Gonzalez & R. E. Woods
Safe RGB Colors
© 2002 R. C. Gonzalez & R. E. Woods
The RGB Safe-Color Cube
It has valid colors only on the surface planes.
© 2002 R. C. Gonzalez & R. E. Woods
The CMY and CMYK Color Models
Conversion from RGB to CMY
−
=
BGR
YMC
111
© 2002 R. C. Gonzalez & R. E. Woods
Conceptual Relationships Between the RGB and HSI Models
Hue, saturation and intensity can be obtained from the RGB color cube.
intensity axis: line joining the black and white vertices. saturation: increases as a function of distance from the intensity axis
shaded plane: same hue (cyan)
© 2002 R. C. Gonzalez & R. E. Woods
Hue and Saturation in the HSI Color Model
Primary colors: separated by 120º Secondary color: 60º from the primaries
Hue: angle from the red axis (0º means 0 hue) Saturation: length of the vector
hexagonal color circular color triangular color plane plane plane
© 2002 R. C. Gonzalez & R. E. Woods
HSI Color Model
HSI color model based on triangular color plane.
HSI color model based on circular color plane.
© 2002 R. C. Gonzalez & R. E. Woods
Converting Colors from RGB to HSI
Assume R,G and B are normalized to [0,1]
−=
θ
θ0360
Hif B if B>G
Where
−−+−
−+−= −
21
2
1
)])(()[(
)]()[(21
cos
BGBRGR
BRGRθ
)],,[min()(
31 BGRBGR
S++
−=
)(31 BGRI ++=
≤ G
© 2002 R. C. Gonzalez & R. E. Woods
Converting Colors from HSI to RGB
RG sector ( 00 1200 <≤ H ):
)(1)60cos(
cos1
)1(
0
BRGH
HSIR
SIB
+−=
−+=
−=
GB sector ( 00 240120 <≤θ ):
)(1
])60cos(
cos1[
)1(120
0
0
GRBH
HSIG
SIRHH
+−=−
+=
−=−=
© 2002 R. C. Gonzalez & R. E. Woods
Converting Colors from HSI to RGB
BR sector ( 00 360240 ≤≤ H ):
)(1
])60cos(
cos1[
)1(240
0
0
BGRH
HSIB
SIGHH
+−=−
+=
−=−=
© 2002 R. C. Gonzalez & R. E. Woods
Gray-level display of H, S, I components
© 2002 R. C. Gonzalez & R. E. Woods
RGB image and the components of its corresponding HSI image
RGB image hue
saturation intensity
© 2002 R. C. Gonzalez & R. E. Woods
Manipulating HSI Component images
Change to 0 the pixels corresponding to blue and green regions in Fig.6.16(b)
Reducing by half the saturation of the cyan region in Fig.6.16(c).
Reducing by half the intensity of the central white region in Fig.6.16(d).
Converting the modified HSI image to RGB image. Outer portions: all red Purity of cyan: diminished Central region: gray
© 2002 R. C. Gonzalez & R. E. Woods
Pseudocolor Image Processing
Pseudocolor image processing consists of assigning colors to gray values on a specified criterion.
© 2002 R. C. Gonzalez & R. E. Woods
Intensity Slicing
Using plane at f(x,y)=li to slice the image function into two levels.
© 2002 R. C. Gonzalez & R. E. Woods
Intensity Slicing
© 2002 R. C. Gonzalez & R. E. Woods
Intensity Slicing
In general: Let [0,L-1] be the gray scale. l0: f(x,y)=0, represent black; lL-1: f(x,y)=L-1, represent white. Suppose that P planes perpendicular to the intensity axis are defined at levels l0 , l1,…., lp, 0<P<L-1, the P planes partition the gray scale into P+1 intervals V1, V2, ….., VP+1. Then f(x,y)=Ck , if f(x,y) ∈Vk Ck: color associated with the kth intensity interval Vk
© 2002 R. C. Gonzalez & R. E. Woods
Intensity Slicing into Eight Color Regions
Picking out variations in intensity is easier in (b) than in (a).
© 2002 R. C. Gonzalez & R. E. Woods
Intensity Slicing
Assigning yellow to gray level 255 and blue to all other gray levels.
© 2002 R. C. Gonzalez & R. E. Woods
Use of Color to highlight rainfall levels
intensity corresponding to average monthly rainfall
color assigned to intensity values
color coded image
zoom of south American
© 2002 R. C. Gonzalez & R. E. Woods
Gray Level to Color Transformations
red input of an RGB image
green input
blue input
© 2002 R. C. Gonzalez & R. E. Woods
Use of Pseudocolor for highlighting Explosives Contained in Luggage
monochrome images of luggage
obtained with the non- linear transformation function in Fig.6.25(a)
obtained with the non- linear transformation function in Fig.6.25(b).
© 2002 R. C. Gonzalez & R. E. Woods
Color Coding of Multispectral Images
© 2002 R. C. Gonzalez & R. E. Woods
Example of Color Coding of Multispectral Images
© 2002 R. C. Gonzalez & R. E. Woods
Pseudocolor Rendition of Jupiter Moon Io.
Pseudocolor image of Jupiter Moon Io.
a close-up region
© 2002 R. C. Gonzalez & R. E. Woods
Basics of Full-color Image Processing
Each color pixel is a vector. In RGB color space,
=
=
),(),(),(
),(),(),(
),(yxByxGyxR
yxcyxcyxc
yx
B
G
Rc
(x,y): coordinate of the pixel Two conditions for vector-based processing being equivalent to per-color- component: 1. The process is applicable to both vectors and scalars. 2. The operation on each component of a vector must be independent to the other.
© 2002 R. C. Gonzalez & R. E. Woods
Spatial Masks for gray-scale and RGB Images
Per-color-component and vector-based processing are equivalent.
© 2002 R. C. Gonzalez & R. E. Woods
Formulation for Color Transformation
g(x,y) = T[f(x,y)] where f(x,y) is a color input image T is an operator on f over a spatial neighborhood of (x,y). or , i=1,2,….n. ),.....,,( 21 nii rrrTs =ri, si: variable denoting the color components of f(x,y) and g(x,y) at (x,y) n: # of color components, in RGB, n=3 {T1, T2, …….,Tn}: transformation or color mapping function
© 2002 R. C. Gonzalez & R. E. Woods
A Full-color Image and Its Various Color-space Components
If we want to modify the intensity of this image, in CMYK color space, si=kri+(1-k), i=1,2,3,4 in RGB color space, si=kri, i=1,2,3 in HSI color space, s3=kr3 s1=r1 s2=r2
© 2002 R. C. Gonzalez & R. E. Woods
The Result of Adjusting the Intensity (k=0.7)
I H,S
original image result image
© 2002 R. C. Gonzalez & R. E. Woods
Color Complements Color complements are useful for enhancing detail that is embedded in dark regions of a color image.
Complements of Colors
© 2002 R. C. Gonzalez & R. E. Woods
Color Complement Transformations
© 2002 R. C. Gonzalez & R. E. Woods
Color Slicing
Color slicing is useful for highlighting a specific range of colors.
If the colors of interest are enclosed by a cube of width W and centered at a prototypical color with components (a1,a2,….,an), then,
=i
i rs
5.0 njanyjjWarif ≤≤>− 1]2
[otherwise i=1,2…..,n
If a sphere is used to specify the colors of interest, then
=i
i rs
5.0 ∑ >−=
n
jjj Rarif
1
20
2)(
otherwisei=1,2…..,n
0R : radius of the enclosing sphere
© 2002 R. C. Gonzalez & R. E. Woods
An Illustration of Color Slicing
W=0.2549 R=0.1765
© 2002 R. C. Gonzalez & R. E. Woods
Tonal Transformations
Tonal correction for flat image (boosting contrast) Tonal correction for light image Tonal correction for dark image
© 2002 R. C. Gonzalez & R. E. Woods
Color Balancing
© 2002 R. C. Gonzalez & R. E. Woods
Histogram Processing
Histogram equalization in the HSI color space
original image
after histogram equalization
after saturation adjustment for the left image
© 2002 R. C. Gonzalez & R. E. Woods
Color Image Smoothing
Let Sxy denote the set of coordinates defining a neighborhood centered at (x,y) in an RGB color image. The average of the RGB component vectors in this neighborhood is:
∑=∈
xySyx
yxK
yx),(
),(1),( cc
∑
∑
∑
=
∈
∈
∈
xy
xy
xy
Syx
Syx
Syx
yxBK
yxGK
yxRK
),(
),(
),(
),(1
),(1
),(1
© 2002 R. C. Gonzalez & R. E. Woods
An RGB Color Image and Its Red,Green,Blue Components
© 2002 R. C. Gonzalez & R. E. Woods
HSI Components of the Previous Image
© 2002 R. C. Gonzalez & R. E. Woods
Image Smoothing with a 5x5 Averaging Mask
processing on each RGB component
processing only the I component of HSI image
© 2002 R. C. Gonzalez & R. E. Woods
Color Image Sharpening
Sharpening using the Laplacian in the RGB color system:
∇
∇
∇
=∇
),(
),(
),(
)],([2
2
2
2
yxB
yxG
yxR
yxc
© 2002 R. C. Gonzalez & R. E. Woods
Image Sharpening with the Laplacian
processing on each RGB component
processing on the intensity component of HSI image