chapter 6 point operations introduction a point operation takes a single input image into a single...
TRANSCRIPT
Chapter 6 Point Operations INTRODUCTION
A point operation takes a single input image into a single output image in such a way that each output pixel’s gray level depends only on the gray level of the corresponding input pixel.
Contrast enhancement, contrast stretching, gray-scale transformation(GST).
A point operation my be expressed as
)],([),( yxAfyxB
Applications of Point Operations Photometric Calibration
Remove the effects of image sensor nonlinearity Contrast Enhancement
A point operation might be used to expand the contrast of the features of interest in an image.
Display Calibration• One may employ a point operation to ensure that the fea
tures of interest fall into the maximum-visibility range of the display
• Compensating the nonlinearity of display devices • Gamma of Television CRT monitors
Contour LinesA point operation can add contour line to an
image.This is useful for defining boundaries or for making mask for subsequent operations.
ClippingSet negative values to zero and limits
positive values to Dm, the maximum gray level.
Types of Point Operations Linear Point Operations
Some special cases of linear point operations: , identity operation, copying A into
B. If , the contrast will be increased
0,1 ba
1a
baDDfD AAB )(
If , the contrast will be reduced. If and b is nonzero, the
operation merely shifts the gray level values of all pixels up or down.
If , the image is complemented.0a
1a
1a
Nonlinear Monotonic Point Operations
1. Increase the midrange gray levels while
leaving dark and light pixels little changed. (C=0.004, Dm=255)
)()( xDCxxxf m
0 50 100 150 200 2500
50
100
150
200
250
Input
Output
2. Sigmoid (S-shape) GST has slope greater than 1 in the midrange and less than 1 towards the end. This GST can increase the contrast within midrange objects at the expense o light and dark objects.
10 )2
1(sin
)2
sin(
11
2)(
m
m
D
xDxf
0 50 100 150 200 2500
50
100
150
200
250
3. GST has slope less than 1 in the midrange and greater than 1 near the ends. With the opposite effect on images to S-shape GST.
10 )2
1(tan
)2
tan(
11
2)(
m
m
D
xDxf
Some examples
POINT OPERATIONS AND THE HISTOGRAM
The output histogram ,
Approximation to the integral yields
Solve the output histogram, we obtain
)( AB DfD )(1BA DfD
AA
A
BB
B
DD
D
A
DD
D
B dDDHdDDH )()(
AAABBB DDHDDH )()(
POINT OPERATIONS AND THE HISTOGRAM
Let approaches zero, we have
And thus
AB
AABB DD
DHDH
/
)()(
AD
)()/(
)(
/
)()(
AA
AA
AB
AABB DfdDd
DH
dDdD
DHDH
))((
))(()(
1
1
Dff
DfHDH A
B
Examples Linear Point Operation
For linear point operation
If
then
abDDfD BBA /)()(1
)(1
)(a
bDHa
DH AB
2)()( cDA eDH
2)]/(/[1)( abcaD
B ea
DH
0 1 2 3 4 5 6 7 8 9 100
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 2 4 6 8 10 12 14 16 18 200
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Input histogram Output histogram
Example 1:Lenna
213≈1.2*138+50
1.2 50B AD D
Second-Order Point OperationA square-law point operation
Input histogram
Then
Which is shown in the following figures
2)( AAB DDfD
2
)( ADAA eDH
B
D
BBD
eDH
B
2)(
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 20
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 0.5 1 1.5 2 2.5 30
0.5
1
1.5
Input histogram Output histogram
Example 2 2 2
255 255 255A A
B AD DD f D
A Sigmoid TransformationInput histogram
),,(),,()( 2211 AAAA DGDGDH
2
sin)12
(sin2
)( 11
m
mm
D
DDDDf
)2
1(cos
2sin2
mD
x
dx
df
))((
))(()(
1
1
Dff
DfHDH A
B
General cases (some examples)
Histograms of image Lenna after point operations
其它情形 * 若灰度变换函数存在 0 斜率,则输出直方图将产生
尖峰; * 若灰度变换函数存在斜率无穷大,则输出直方图将
部分区域扩展为一定宽度; * 若灰度变换函数不存在反函数,可以将输入直方图
划为几段,然后输出直方图为几部分之和。
Applications of point operations Histogram equalization
Based on the relation between histogram and point operation, the equation will make the output histogram flat with number of pixels equal to , and this leads to
Where P(D) is the CDF of the image.
)()(0
DHA
DDf m
)()(1
)()(0 000
DPDduuHA
DduuHA
DDf m
D
m
Dm
))((
))(()(
1
1
Dff
DfHDH A
B
mDA /0
)],([),( yxAPDyxB m
1
01
0
00
00
1:
2 :
3 :
14 :
5 :
A
m
m
Dm
D
m
H f DAstep
D f f D
Dstep f H D
A
Dstep f D H u du
A
step CDF D H u duA
step f D D CDF D
Examples of histogram equalization
0 100 200
0
200
400
600
0 100 200
0
500
1000
Fig.1 Fig.2 Fig.3
Histogram of Fig.1 Histogram of Fig.2 Histogram of Fig.3
Equalization of Fig.1 Equalization of Fig.2 Equalization of Fig.3
Corresponding histograms
Histogram Matching Make the histogram of an image
A(x,y) to match a specified functional form or that of another image C(x,y)
This can be done in two steps: A(x,y) B(x,y) C(x,y), where B(x,y) has flat histogram. We have
)]},([{}/),({),( 11
31
3 yxAPPDyxBPyxC m
)],([),( 1 yxAPDyxB m )],([),( 3 yxCPDyxB m
Photometric Calibration
A point operation can be used to compensate for the effects of digitizer nonlinearity, the block diagram is shown below:
Ideal digitizer
Digitizer trans-formation
Point operation
Film image
Linear image
Nonlinear image
Calibrated image
A(x,y) B(x,y) C(x,y)
f(D) g(D)
If
The Digitizer’s gray-scale transfer function f(D) can be measured.
)()( 1 DfDg
),()],([),( yxAyxAfgyxC
Display Calibration Can be done in a similar way as photometric calibration. 光电转换特性
Γ ( gamma )校正• 摄象机: γ=0.5• 显示器: γ=2.5
人眼的生理特点• 电影: γ=1.5• 电视或计算机: γ=1.25
参考免费软件: gammalaunch
输出电压 输入光强
Appendix: Image Enhancement in the Spatial Domain Image enhancement is to process an image s
o that the result is more suitable than the original image for a specific application.
A general form of a spatial domain process is expressed as
Where n() is a neighbor of pixel A(x,y), when n() is the neighbor, the transform is reduced to a point operation or a gray-scale transformation (GST).
))),(((),( yxAnfyxB 11
When n() takes a larger neighbor than , the enhancement technique is often referred to as mask processing or filtering. The neighbor is called a mask (or a filter, a template).
11
An example of GST for contrast enhancement
Dark Light Dark Lightm m
Thresholdings=T(r)
s=T(r)
r r
Some basic GST used for image enhancement Log transformation s=clog(1+r) The Log transformation maps a narrow range
of low gray-level values in the input image into a wider range of output levels, and the opposite is true of higher values of input levels.
Expanding the values of dark pixels while compressing the values of light pixels.
Display Fourier spectrum by a Log transformation
Power Law Transformations Power law transformation Gamma correction Power law transformation are also usef
ul for general-purpose contrast manipulation
crs
Power law transformations with different gamma
An example of display gamma correction
Piecewise-linear transformation Piecewise-linear transformation for
contrast stretching
(r1,s1)
(r2,s2)
Summary of important points
1. Point operations transform the gray scale of an image
2. Point operations are useful for photometric calibration,display calibration,enhancement, and histogram modification.
3. A point operation is specified by the gray-scale transformation function that expresses the mapping between input and output gray-level values.
4. The histogram of an image following a specified point operation can be computed from a formula.
5. A linear point operation can only stretch or compress the histogram and shift it right pr left.
6.The cumulative distribution function (normalized area function) is the point operation that flattens the histogram.
7.The histogram of an image can be brought into a a desired form by the concatenation of a point operation that flattens the original histogram, followed by the inverse of one that flattens the desired histogram
6 要点总结 1 )点运算由输入象素灰度和输出象素灰度之间映射的灰
度变换函数确定。 2 )线性点运算可以改变数字图象的对比度。 3 )线性点运算后的直方图由下式确定:
4 )数字图象均衡化的灰度变换函数可由累积分布函数确定:
5 )数字图象匹配的灰度变换函数由下列函数确定:
1
' 1
A
B
H f DH D
f f D
mf D D CDF D
1C AC x,y CDF CDF A x,y
习题 P.82 第 1 题;
23 16
155 240
1.7, 23
B A AD f D aD b
a b
a b
a b
解:
解得
习题 P.82 第 2 题;
32 0
200 255
1.52, 48
B A AD f D aD b
a b
a b
a b
解:
解得
习题 P.82 第 5 题;
0255
0
1704sin 2552551704sin 255
2551 cos
2 255
m
D
GST D CDF
u du
u du
D
解:
习题 P.82 第 6 题;
2 3
00
0
3 4
12
1 112
3 4
m
D
m m
m
mm m
GST D CDF
D DA duD DD
A
D DD
D D
解:
上机实习 1 )应用 MATLAB 软件提供的函数,编制读取 BMP 文
件,并使其直方图均衡化 ( 请勿直接调用 histeq 函数 ) ,并存为另一幅 BMP 文件。然后使用 MATLAB 本身提供的直方图均衡化函数,判别自编程序与该函数的区别。
2 )应用 MATLAB 软件提供的函数,编制读取 BMP 文件,并使其直方图匹配的函数。