Upload
yardley
View
37
Download
0
Embed Size (px)
DESCRIPTION
Chapter 6 Color Image Processing. 國立雲林科技大學 電子工程系 張傳育 (Chuan-Yu Chang ) 博士 Office: ES 709 TEL: 05-5342601 ext. 4337 E-mail: [email protected]. Color Fundamentals. In 1666, Sir Isaac Newton - PowerPoint PPT Presentation
Citation preview
Chapter 6Color Image Processing
國立雲林科技大學 電子工程系張傳育 (Chuan-Yu Chang ) 博士Office: ES 709TEL: 05-5342601 ext. 4337E-mail: [email protected]
2
Color Fundamentals In 1666, Sir Isaac Newton
He discovered that when a beam of sunlight passes through a glass prism, the emerging beam of light is consists of a continuous spectrum of colors ranging from violet to red.
3
Color Fundamentals (cont.) Basically, humans and some other animals perceive in
an object are determined by the nature of the light reflected from the object.
Visible light is composed of a relatively narrow band of frequencies in the electromagnetic spectrum.
For humans, colors are seen as variable combinations of the primary colors: red, green, and blue.
4
Color Fundamentals (cont.)
人眼椎狀體吸收之紅、綠、藍光的波長函數
65% 的椎狀體可感應到紅光, 33% 可感應到綠光,只有 2% 感應到藍光
1931 年國際照明組織(CIE) 指定三原色的波長 :Blue:435.8nmGreen:546.1nmRed:700nm
5
Color Fundamentals (cont.)
For the purpose of standardization, the CIE (the international Commission on Illumination) designated in 1931 the following specific wavelength values to the three primary colors: Blue=435.8 nm, Green=546.1 nm, and Red=700 nm. From Fig. 6.2 and 6.3 that no single color may be called
red, green , or blue. Having three specific primary color wavelengths for the
purpose of standardization does not mean that these three fixed RGB components acting alone can generate all spectrum colors.
6
Color Fundamentals (cont.)
光的混合式採用加成的方式
In colorants, a primary color is defined as one that subtracts or absorbs a primary color of light and reflects or transmits the other two.
Primary and secondary colors of light and pigments The primary colors can be added to produce the secondary
colors of light: magenta (R+B), cyan (G+B), yellow (R+G)
The primary colors of pigments are magenta, cyan, and yellow
7
Color Fundamentals (cont.)
The characteristics generally used to distinguish one color from another are Brightness embodies the chromatic notion of intensity. Hue represents dominant color as perceived by an
observer. Saturation is an attribute associated with the dominant
wavelength in a mixture of light waves. Saturation refers to the relative purity or the amount of white
light mixed with a hue. Hue and saturation taken together are called chromaticity,
therefore, a color may be characterized by its brightness and chromaticity.
8
Color Fundamentals (cont.) The amounts of red, green, and blue needed to form any
particular color are called the tri-stimulus values and are denoted, X, Y, and Z.
A color is then specified by its tri-chromatic coefficients, defined as
It is noted from these equations that x + y + z = 1
ZYX
Zz
ZYX
Yy
ZYX
Xx
(6.1-1)
(6.1-2)
(6.1-3)
(6.1-4)
9
The CIE chromaticity diagram Which shows color composition as a function of x (red) and y
(green). For any value of x and y, the corresponding value of z (blue) is
obtained from Eq.(6.1-4). z = 1- ( x + y )
approximately 62% green, 25% red , and 13% blue content. The positions of the various spectrum colors from violet at
380 nm to red at 780 nm are indicated around the boundary of the tongue-shaped chromaticity diagram.
These are the pure colors shown in the spectrum of Fig. 6.2.
Color Fundamentals (cont.)
10
Color Fundamentals (cont.) CIE 色度圖
綠色點佔62%
藍色點佔13%
紅色點佔25%
11
Color Fundamentals (cont.)
12
Color Models The RGB Color Model
Each color appears in its primary spectral components of red, green, and blue.
Images represented in the RGB color model consist of three component images, one for each primary color.
When fed into an RGB monitor, these three images combine on the phosphor screen to produce a composite color image.
The number of bits used to represent each pixel in RGB space is called the pixel depth. Full-color denote a 24-bit RGB color image
13
Color Models (cont.) Example 6.1
Generating the hidden face planes and a cross section of the RGB color cube. Fig. 6.8 is a solid, composed of the 224=16777216
colors..
14
Color Models (cont.) Example 6.1 (cont.)
Acquiring a color image is basically the process shown in Fig. 6.9 in reverse.
A color image can be acquired by using three filters, sensitive to red, green, and blue.
When we view a color scene with a monochrome camera equipped with one of these filters, the result is a monochrome image whose intensity is proportional to the response of that filter.
Repeating this process with each filter produces three monochrome images that are RGB component images of the color scene.
15
Color Models (cont.) Safe RGB color, All-system-safe color, Safe Web
color, Safe browser color Given the variety of systems in current use, it is of
considerable interest to have a subset of colors that are likely to be reproduced faithfully, reasonably independently of viewer hardware capabilities.
216 colors are common to most systems, these colors have become the standard for safe colors.
Each of the 216 safe colors is formed from three RGB values, each value can only be 0, 51, 102, 153, 204, or 255.
The values 000000 and FFFFFF represent black and white, respectively.
16
Color Models (cont.)
17
Color Models (cont.) The CMY color model
Cyan, magenta, and yellow are the secondary colors of light Most devices that deposit colored pigments on paper, such as
color printers and copiers, require CMY data input or perform an RGB to CMY conversion internally.
The assumptions is that all color values have been normalized to range [0,1].
The CMYK color model In order to produce true black, a fourth color black is added
B
G
R
Y
M
C
1
1
1
Y
M
C
B
G
R
1
1
1
(6.2-1)
18
Color Models (cont.) The HSI Color Model
When humans view a color object, we describe it by its hue, saturation, and brightness.
Hue is a color attribute that describes a pure color. Saturation gives a measure of the degree to which a pure
color is diluted by white light. Brightness is a subjective descriptor that is practically
impossible to measure. ( 所以用 intensity 來取代brightness)
HSI color model decouples the intensity component from the color-carrying information (hue and saturation) in a color image.
19
Color Models (cont.) Conceptual relationships between the RGB and HIS
color models The intensity is along the line joining the vertices (0,0,0)
and (1,1,1). If we wanted to determine the intensity component of any
color point, we would simply pass a plane perpendicular to the intensity axis and containing the point.
The intersection of the plane with the intensity axis would give us a point with intensity value in the range [0,1].
The intensity axis joining the black and white vertices is vertical
20
Color Models (cont.)
Fig. 12(b) shows a plane defined by three points (black, white, and cyan)
All points contained in the plane segment defined by the intensity axis and the boundaries of the cube have the same hue. All colors generated by three colors lie in the triangle
defined by those colors. If two of those points are black and white and the third is a
color point, all points on the triangle would have the same hue.
By rotating the shaded plane about the vertical intensity axis, we would obtain different hues.
21
Color Models (cont.)
The HIS space is represented by a vertical intensity axis and the locus of color points that lie on planes perpendicular
Looking at the cube (Fig. 12) down its gray-scale axis, as shown in Fig. 6.13(a).
In this plane we see that the primary colors are separated by 120°.
The hue of the point is determined by an angle from some reference point. Usually an angle of 0° from the red
axis designates 0 hue, and the hue increases countercolockwise from there.
The saturation is the length of the vector from the origin to the point.
22
GBif
GBifH
360
),,min(3
1 BGRBGR
S
)(3
1BGRI
2/12
1_
2
1
cosBGBRGR
GRGR
Color Models (cont.): Converting colors from RGB to HSI The H component of each RGB
pixel is obtained by
with
The saturation component is given by
The intensity component is given by The RGB values have been normalized to
range [0,1] and that angle is measured withrespect to the red axis of the HSI space.
23
Color Models (cont.): Converting colors from HIS to RGB Given values of HIS in the interval [0,1], we can
find the corresponding RGB values in the same range.
The applicable equations depend on the values of H.
There are three sectors of interest, corresponding to the 120 。 intervals in the separation of primaries
24
Color Models (cont.) RG sector
When H is in this sector, the RGB components are given by
GB sector If the given value of H is in this sector, we first subtract
120° from it.
Then the RGB components are
BR sector If the given value of H is in this sector, we first subtract
240° from it.
)1( SIB
1200 H
240120 H
360240 H
)60cos(
cos1
H
HSIR )(3 BRIG
120HH
)1( SIR
240HH
)1( SIG
)60cos(
cos1
H
HSIG
)60cos(
cos1
H
HSIB
)(3 GRIB
)(3 BGIR
25
Color Models (cont.)
Fig. 6.8 影像的 Hue
Fig. 6.8 影像的 saturation
Fig. 6.8 影像的 intensity
Its most distinguishing feature is the discontinuity in value along 45 line in the front (red) plane of the cube.
26
Color Models (cont.)
Hue 的成分影像
saturation 的成分影像
intensity 的成分影像
RGB 影像
27
Color Models (cont.)
修改過的 hue成分影像 修改過的 saturation
成分影像
修改過的 intensity成分影像
重建的 RGB 影像
28
Pseudocolor Image Processing Pseudocolor image processing consists of assigning
colors to gray values based on a specified criterion. The principal use of pseudocolor is for human
visualization and interpretation of gray-scale events in an images or sequence of images.
Intensity Slicing If an image is interpreted as a 3D function, the method can
be viewed as one of placing planes parallel to the coordinate plane of the image;
Each plan then “slices” the function in the area of intersection.
29
Pseudocolor Image Processing (cont.) Let [0, L-1] represent the gray scale Let level l0 represent black [f(x,y)=0] Level lL-1 represent white [f(x,y)=L-1] Suppose that P planes perpendicular to the intensity axis are
defined at levels l1, l2,…, lp
Assuming that 0<P<L-1 The P planes partition the gray scale into P+1 intervals, V1, V2,
…, VP+1
Gray-level to color assignments are made according to the relation
where ck is the color associated with the k-th intensity interval Vk.
kk Vf(x,y)cyxf if),(
30
Pseudocolor Image Processing (cont.) Fig. 6.18 shows an example of using a plane at f(x,y)=li to slice
the image function into two levels. If a different color is assigned to each side of the plane, any pixel
whose gray level is above the plane will be coded with one color, and any pixel below the plane will be coded with the other.
Levels that lie on the plane itself may be arbitrarily assigned one of the two colors.
The result is a two-color image whose relative appearance can be controlled by moving the slicing plane up and down the gray-level axis.
31
Pseudocolor Image Processing (cont.)Any input gray level is
assigned one of two colors, depending on whether it is above or below the value of li.
When more levels are used, the mapping function takes on a staircase form.
32
Pseudocolor Image Processing (cont.) Example 6.3 Intensity Slicing
單色的甲狀腺影像(monochrome image of the Picker Thyroid Phantom )
The result of intensity slicing this image into eight color regions.
33
Pseudocolor Image Processing (cont.) Example 6.3 Intensity Slicing (cont.)
Intensity slicing assumes a much more meaningful and useful role when subdivision of the gray scale is based on physical characteristics of the image.
Fig. 6.21(a) shows an X-ray image of a weld containing several cracks and porosities with graylevel of 255.
If the exact values of gray levels one is looking for are known, intensity slicing is a simple but powerful aid in visualization.
Cracks/porosities
34
Pseudocolor Image Processing (cont.) Example 6.4 Use of color to highlight rainfall levels
影像灰階對應平均月降雨量
指定色彩給灰階
色彩編碼後的影像 放大南美洲
的色彩編碼影像
35
Pseudocolor Image Processing (cont.) Gray Level to Color Transformations
To perform three independent transformations on the gray level of any input pixel.
The three results are then fed separately into the red, green, and blue channels of a color television monitor.
These are transformations on the gray level values of an image and are not functions of position.
36
Pseudocolor Image Processing (cont.) Example 6.5 Fig. 6.24(a) shows two
monochrome images of luggage obtained from an airport X-ray scanning system.
The purpose of this example is to illustrate the use of gray level to color transformations to obtain various degrees of enhancement.
塑膠炸藥 (plastic explosive)
Ordinary materials
37
Pseudocolor Image Processing (cont.)
Fig 6.25 shows the transformation functions used.
These sinusoidal functions contain regions of relatively constant value around the peaks and regions that change rapidly near the valleys.
Changing the phase and frequency of each sinusoid can emphasize (in color) ranged in the gray scale.
If all three transformations have the same phase and frequency, the output image will be monochrome.
Fig. 6.24(b) was obtained with the transformation functions in Fig. 6.25 (a).
Fig. 6.24(c) was obtained with the transformation functions in Fig. 6.25 (b).
38
Pseudocolor Image Processing (cont.) Combine several monochrome images into a
single color composite. Usually used in Multispectral image processing Different sensors produce individual monochrome
images, each in a different spectral band.
39
Pseudocolor Image Processing (cont.)
Red component of an RGB image
Green component of an RGB image
Blue component of an RGB image
Near-infrared image
Green+Blue+Near-infrared image
Red+Green+Blue
40
Pseudocolor Image Processing (cont.)
Jupiter moon Io木星 Io 衛星影像
Bright red depicts material newly ejected from an active volcano
紅色的區域表示活火山新噴出的物質
Surrounding yellow materials are older
sulfur deposits黃色的區域表示硫磺
的沉積物質
41
Basic of Full-Color Image Processing Full-color image processing approached fall into two
major categories : Process each component image individually and then form
a composite processed color image from the individually processed components.
Work with color pixels directly. Let c represent an arbitrary vector in RGB color
space:
B
G
R
c
c
c
c
B
G
R
),(
),(
),(
),(
),(
),(
),(
yxB
yxG
yxR
yxc
yxc
yxc
yxc
B
G
R
(6.4-1)
(6.4-2)
42
Basic of Full-Color Image Processing The results of individual color component processing are not
always equivalent to direct processing in color vector space. In order for per-color-component and vector-based processing
to be equivalent, two conditions have to be satisfied: The process has to be applicable to both vectors and scalars. The operations on each component of a vector must be independent
of the other components.
43
Color Transformation Color transformation deal with processing the components of a color
image within the context of a single color model. We model color transformations using the expression
where f(x,y) is a color input image, g(x,y) is the transformed color output image, and T is an operator on f over a spatial neighborhood of (x,y).
The pixel values here are triplets or quartets from the color space chosen to represent the images.
Color transformations
ri and si are variables denoting the color components of f(x,y)and g(x,y) at any point (x,y). n is the number of color components.{T1, T2, …, Tn} is a set of color mapping function that operate on ri to produce si.
n transformations, Ti, combine to implement the single transformation function, T, in Eq(6.5-1).
),(),( yxfTyxg
nirrrTs nii ,...,2,1),,...,,( 21
(6.5-1)
(6.5-2)
44
CMYK 成分,黑色代表 0 ,白色代表 1 。
Strawberries are composed of large amounts of magenta and yellow.
草莓由大量的紅色成分所組成。
Intensity 成分 原始影像的單色呈現
Color Transformation (cont.)A bowl of strawberries and cup of coffee
45
Color Transformation (cont.) Suppose that we wish to modify the intensity of the image in
Fig. 6.30(a) using
where 0<k<1. In the HIS color space, this can be down with the simple
transformation
where s1=r1, s2=r2 。 Only HIS intensity component r3 is modified. In the RGB color space, three components must be
transformed:
The CMY space requires a similar set of linear transformations
),(),( yxkfyxg
33 krs
3,2,1 ikrs ii
3,2,11 ikkrs ii
46
Color Transformation (cont.) The result of applying any of the transformations
in Eq.(6.5-4)~ (6.5-6), using k=0.7
47
Color Complements The hues directly opposite one another on
the color circle of Fig. 6.32 are called complements.
Color complements are useful for enhancing detail that is embedded in dark regions of a color image.
48
Example 6.7 補色的轉換函數,其中 飽和度 S的成分不變。
RGB 的補色轉換HSI 的補色轉換
Identical to the gray-scale negative transformation.
49
Color Slicing Color slicing
Highlighting a specific range of colors in an image is useful for separating objects from their surroundings.
The basic idea is either to ( 將 ROI 以外的色彩,映射到不重要的中性色彩。 ) Display the colors of interest so that they stand out from the
background Use the region defined by the colors as a mask for further processing
To map the colors outside some range of interest to a nonprominent neutral color. If the colors of interest are enclosed by a cube of width W and centered at a prototypical color with components (a1, a2, …, an) the necessary set of transformations is
Color Cube (hypercube)
otherwiser
Warif
s
i
ninjjj
i ,...,2,1,125.0
W 是立方體寬度,中心成分在(a1,a2,…,an)
50
Color Slicing (cont.)
If a sphere is used to specify the colors of interest, Eq. (6.5-7) becomes
otherwiser
niRarifs
i
n
jjj
i,..,2,1,5.0 2
0
2
1R0 是球體的半徑,中心成分在(a1,a2,…,an)
51
Example 6.8 An illustration of color slicingW=0.2549 ,中心在(0.6863, 0.1608, 0.1922)的 RGB cube
Radius=0.1765 ,中心在(0.6863, 0.1608, 0.1922)的 RGB sphere
52
Tone and Color Corrections
色調與色彩之修正 (Tone and color corrections) Device-independent color model
建立螢幕和輸出裝置以及其裝置之間的色彩範圍 Color management system (CMS)
選擇採用 CIE L*a*b* 模型,或是 CIELAB CIE L*a*b* 具有下列特性:
Colormetric Perceptually uniform Device independent
53
Tone and Color Corrections (cont.) L*a*b* color model
008856.0116/16787.7
008856.0
200*
500*
16116*
3
qqqh
where
Z
Zh
Y
Yhb
Y
Yh
X
Xha
Y
YhL
WW
WW
W
Xw, YW, Zw 是白色的三色激勵值 ( 由圖 6.5 的 CIE 色調圖上 x=0.3127, y=0.3290 所定義 )
54
Tone and Color Corrections (cont.) 色調範圍 (tonal range) ,亦稱為 (key type)是指影像色彩強度的一般分布。 High-key
影像的大部分資訊集中於高 ( 或亮 ) 的強度 Low-key
影像的大部分資訊集中於低 ( 或暗 ) 的強度 Middle-key
影像的大部分資訊介於 high-key 和 low-key 之間
55
Example 6.9 Tonal transformations
56
Example 6.10 Color balancing
57
Histogram Processing
58
Smoothing and Sharpening Color Image Smoothing
The average of the RGB component vectors in the neighborhood is
對每個顏色分量進行 smooth
Smoothing by neighborhood averaging can be carried out on a per-color-plane basis.
xySyx
yxcK
yxc),(
,1
),(
xy
xy
xy
Syx
Syx
Syx
yxBK
yxGK
yxRK
yxc
,
,
,
,1
,1
,1
,
59
Example 6.12 Color image smoothing by neighborhood averaging
Original RGB image
Red component
image
Green component
image
Blue component
image
60
Example 6.12 Color image smoothing by neighborhood averaging (cont.)
Hue component
image
Saturation component
image
Intensity component
image
61
Example 6.12 Color image smoothing by neighborhood averaging (cont.)
Result of processing each RGB component
image
Image smoothing with 5x5 averaging mask
Result of processing Intensity
component image
Difference between the two results
62
Smoothing and Sharpening (cont.) Color Image Sharpening
Computing the Laplacian of each component image separately.
yxB
yxG
yxR
yxc
,
,
,
,2
2
2
2
63
Color Segmentation
Segmentation in HIS color Space Color is represented in the hue image. Saturation is used as a masking image to isolate
further regions of interest in the hue image. Intensity image is used less frequency for
segmentation of color image because it carries no color information.
64
Example 6.14 Segmentation in HIS spaceOriginal
imageHue image
Intensity image
Saturation image
對飽和影像取臨界值 ( 最大值的
10%) 所得的遮罩影像,將大於臨界值的像素點設為 1 ,其餘設為黑色。
遮罩影像和 Hue影像的乘積。
乘積影像的histogram 。
對乘積影像取臨界值 (90%) ,後所得之影像。
65
Color Segmentation (cont.) Segmentation in RGB Vector Space
The objective is to segment objects of a specified color range in an RGB image.
Let the average color be denoted by the RGB vector a. The objective of segmentation is to classify each RGB pixel
in a given image as having a color in the specified range or not.
222
2
1
,
BBGGRR
T
azazaz
azaz
azazD
66
Example 6.15 Color image segmentation in RGB space
67
Color Segmentation (cont.)
Color Edge Detection
68
Chapter 6Color Image Processing
Chapter 6Color Image Processing
69
Example 6.16 Edge detection in vector space
70
Example 6.16 Edge detection in vector space (cont.)
Red component 的gradient
Green component的 gradient
Blue component 的gradient
71
Noise in Color Image
72
Example 6.17 Illustration of the effects of converting noisy RGB images to HSI
73
Example 6.17 Illustration of the effects of converting noisy RGB images to HIS (cont.)
74
Example 6.17 Illustration of the effects of converting noisy RGB images to HIS (cont.)
75
Example 6.18 A color image compression example