Digital Image Processing - COMP4173
Lecture 13:Color Image Processing
Prof. Hongjian Shi (时红建)
Department of Computer Science and Technology
BNU-HKBU United International University
Email:
[email protected]Office: T3-601-R3;
Office Hours: Tues., Wed., Thur. 9:00-11:50; Wed. 16:00-16:50
1
Color Image Processing
• Full color processing – color TV, color scanner, publication, visualization
• Color TV – the interior of CRT (cathode ray tube) color screens is composed of a large array
of triangular dot patterns of electron-sensitive phosphor. When excited, each dot in a triad
produces light in one of the primary colors
• The intensity of the red-emitting phosphor dots is modulated by an electron gun inside the
tube, which generates pulses corresponding to the “red energy” seen by the TV camera.
The green and blue phosphor dots in each triad are modulated in the same manner
• The effect, viewed on the television receiver, is that the three primary colors from each
phosphor triad are “added” together and received by the color-sensitive cones in the eye
as a full-color image
• Thirty successive image changes per second in all three colors complete the illusion of a
continuous image display on the screen
• CRT displays are being replaced by “flat panel” digital technologies, such as liquid crystal
displays (LCDs) and plasma devices, these and similar technologies use the same principle
in the sense that they all require three subpixels (red, green, and blue) to generate a single
color pixel
• Pseudo color processing – assigning a particular color to a monochrome or range of
intensity such as disturbed noise to color, conversion of gray images to color images
2
Color Models - RGB Color Model
• RGB Color Model: In this color model each color appears in its primary
spectral components of Red, Green and Blue
• The model is based on the 3D Cartesian coordinate system, where the color
subspace of interest is the color cube shown below.
Pixel depth
The total number of
colors in a 24-bit RGB
image is (28)3 =
16,777,216
Color Cube: 0,0,0=Black, 1,1,1=White 3
Three common models:
• RGB model – color
monitor, video camera,
web site color
• CMYK model – color
printing
• HSI – humans perceive
color, the intensity I
makes gray image
processing methods
work for color images
4
Safe RGB colors (or
safe Web colors) are
reproduced faithfully,
reasonably
independently of
viewer hardware
capabilities
5
The CMY and CMYK Color Models
C 1 R
M 1 G
Y 1 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.
6
HSI Color Model
7
HSI Color Model
8
Converting Colors from RGB to HSI
For convenience, h, s and I values are converted to the
Range of [0,360], [0, 100], [0,255] respectively by:
180
𝐻 =ℎ× , 𝑆 = 𝑠 × 100, 𝐼 = 𝑖 × 255
𝜋
9
Converting Colors from HSI to RGB
10
11
RGB to HSI
H Image
RGB Image
I Image
S Image
12
Convert HSI to RGB
13
Saturation Adjustment
14
Saturation Adjustment
15
Pseudocolor Image Processing
• This technique is based on assigning color (false/pseudo) values to different gray
levels. By converting monochrome images to color images human visualization
and interpretation of the gray level images can be improved
• Intensity/density Slicing: The image is interpreted as 3D function (intensity versus
spatial coordinates), where, planes which are parallel to the coordinate planes
called “slices” are considered to slice the image function into two color levels
16
Intensity/density Slicing
17
18
19
The images are
obtained from an
Inputs 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.
Outputs Outputs
20
21
Color Image are represented by three bands (not uniquely) e.g., R, G, &
B or L, a*, & b*
22
• Gray Level to Color Transformations : In this method, a given gray level
image is processed by 3 different transformation functions producing 3
enhanced images in Red, Green and Blue channels respectively
• By combining the 3 channel images we get a colored image.
fR, fG and FB are used to be inputs to an RGB monitor, producing a colored image.
23
FIGURE 6.27 (a)–(d) Images in
bands 1–4 in Fig. 1.10 (see
Table 1.1). (e) Color composite
image obtained by treating (a),
(b), and (c) as the red, green,
blue components of an RGB image.
(f) Image obtained in the same
manner, but using in the red
channel the near-infrared image
in (d). (Original multispectral
images courtesy
of NASA.)
24
• Pseudocolor by combining
several of the sensor
images from the Galileo
spacecraft, some of which
are in spectral regions not
visible to the eye.
• Bright red depicts
materials newly ejected
from an active volcano on
Io, and the surrounding
yellow materials are older
sulfur deposits.
25
Basics of Full-Color Image Processing
There two main methods in using full color images:
• In the first method each color component is processed separately to form a composite
color image
• In the second approach we consider each pixel as a vector of 3 values and process
each pixel
26
Basics of Full-Color Image Processing
Let c represent an arbitrary vector in RGB color space:
cR R
c cG G
cB B
At coordinates (x, y ),
c R ( x , y ) R ( x, y )
c( x, y ) cG ( x, y ) G ( x, y )
cB ( x, y ) B( x, y )
g ( x, y ) T f ( x , y ) si Ti (r1 , r2 ,..., rn ), i 1, 2,..., n.
27
FIGURE 6.30 A full-color image and its various
Full color image color-space components. (Original image courtesy
of MedData
Interactive.)
C,M,Y, K components
R,G,B components
H,S,I components
28
g ( x, y ) kf ( x, y )
FIGURE 6.31 Adjusting
the intensity of an
image using color
transformations.
(a) Original image. (b)
Result of decreasing its
intensity by 30% (i.e.,
letting ).
(c)–(e) The required
RGB, CMY, and HSI
transformation functions.
(Original image
courtesy of MedData
Interactive.)
si kri , si kri (1 k ), s3 kr3
i 1, 2,3. i 1, 2,3. 29
• Color Complements (inverse colors). Color complementing a color image is
identical to gray scale negatives in monochrome images
• Color complement transformations are performed according to the following
color circle
FIGURE 6.32
Complements on
the color
circle.
30
Transformation functions for RGB
FIGURE 6.33
Color complement
transformations.
(a) Original image. Transformation
(b) Complement functions for HSI
transformation
functions.
(c) Complement of (a)
based on the RGB
mapping
functions.
(d) An approximation
of the RGB complement
using HIS
transformations
Complementing RGB components Complementing HSI components
31
Color slicing
• Highlighting a specific range of colors in an image
If the colors of interest are enclosed by a cube of width W
and centered at a protypical color with components
( a1 , a2 ,..., an ), the necessary set of transformations is
if
0.5
si | rj a j | W / 2
any 1 j n
ri otherwise
If a sphere is used to specify the colors of interest,
R 0 is the radius of the enclosing of its center.
The transformations is
r a j R02
n
2
0.5 if
si
j
j 1
r
i otherwise
32
Color slicing
33
Tone and Color Correction
and Balance
34
Color Image Smoothing and Segmentation
• The idea of gray-scale image smoothing can be extended into processing of full color images
• Let Sxy denote the set of coordinates defining a neighborhood centered at (x,y) in RGB color image
• Averaging (smoothing) and Sharpening using Laplacian operator of the RGB component vectors in
this neighborhood is:
Smoothing using Averaging Sharpening using Laplacian
K is the number of pixels
within the neighborhood
of the averaging mask
35
Color Image Smoothing: Given a full color image with the following color components
Full color RGB image R Image G Image B Image
Hue image Saturation Image Intensity Image
36
• Original Hue and Saturation are maintained. Working
with HSI image is a better idea
Smoothing by
5x5 averaging
mask
Each RGB component filtered Only I of the HSI filtered Difference of the 2 images
Sharpened by
3x3 Laplacian
mask
Each RGB component filtered Only I of the HSI filtered Difference of the 2 images 37
FIGURE 6.42 (left) Image segmentation in HSI space. (a) Original. (b) Hue. (c) Saturation. (d)
Intensity.
(right) (e) Binary saturation mask (f) Product of (b) and (e). (g) Histogram of (f). (h)
Segmentation of red components in (a)
38
• Segmentation in RGB vector space : Although working with HSI space is more
intuitive in most applications, in segmentation working with RGB color vectors is
generally more advantages
• Suppose that an object within a specified RGB color range is to be segmented.
Assume that a is the average RGB vector. Each RGB pixel is classified to have
color in the specified range/distance from the average color vector
• Let z denote an arbitrary point in RGB space. Then the Euclidean Distance
between z and a is given by:
• The segmented pixels fall into the solid sphere of radius Do where
39
Area of interest
Input image
Segmentation Procedure:
1. Sample data is taken from the area of interest.
2. Mean RGB components and their standard
deviation values are calculated.
3. Do is determined by using the standard deviation s.
For example in this example:
DoR =1.25 sR
Segmented region DoG =1.25 sG
DoB =1.25 sB
4. Any pixel within Do distance from the mean is set
to white color and all the other pixels are set to black
color.
40
Segmented Output image
Edge Detection
FIGURE 6.46
(a) RGB image.
(b) Gradient
computed in RGB
color vector
space.
(c) Gradients
computed on a
per-image basis
and then added.
(d) Difference
between (b) and
(c). 41