chapter 6 point operations introduction a point operation takes a single input image into a single...

52
Chapter 6 Point Operat ions INTRODUCTION A point operation takes a single input image into a single output image in suc h a way that each output pixel’s gray l evel depends only on the gray level of the corresponding input pixel. Contrast enhancement, contrast stretchi ng, gray-scale transformation(GST). A point operation my be expressed as )] , ( [ ) , ( y x A f y x B

Upload: melanie-merritt

Post on 18-Jan-2016

220 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: 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 ’

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

Page 2: 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 ’

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

Page 3: 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 ’

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.

Page 4: 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 ’

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 )(

Page 5: 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 ’

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

Page 6: 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 ’

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

Page 7: 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 ’

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

Page 8: 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 ’

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

Page 9: 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 ’

Some examples

Page 10: 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 ’
Page 11: 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 ’
Page 12: 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 ’

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 )()(

Page 13: 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 ’

POINT OPERATIONS AND THE HISTOGRAM

Page 14: 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 ’

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

Page 15: 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 ’

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

Page 16: 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 ’

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

Page 17: 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 ’

Example 1:Lenna

Page 18: 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 ’

213≈1.2*138+50

1.2 50B AD D

Page 19: 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 ’

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)(

Page 20: 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 ’

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

Page 21: 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 ’

Example 2 2 2

255 255 255A A

B AD DD f D

Page 22: 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 ’

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

Page 23: 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 ’
Page 24: 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 ’

General cases (some examples)

Histograms of image Lenna after point operations

Page 25: 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 ’

其它情形 * 若灰度变换函数存在 0 斜率,则输出直方图将产生

尖峰; * 若灰度变换函数存在斜率无穷大,则输出直方图将

部分区域扩展为一定宽度; * 若灰度变换函数不存在反函数,可以将输入直方图

划为几段,然后输出直方图为几部分之和。

Page 26: 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 ’

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

Page 27: 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 ’

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

Page 28: 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 ’

Examples of histogram equalization

0 100 200

0

200

400

600

0 100 200

0

500

1000

Page 29: 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 ’

Fig.1 Fig.2 Fig.3

Histogram of Fig.1 Histogram of Fig.2 Histogram of Fig.3

Page 30: 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 ’

Equalization of Fig.1 Equalization of Fig.2 Equalization of Fig.3

Corresponding histograms

Page 31: 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 ’

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

Page 32: 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 ’

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)

Page 33: 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 ’

If

The Digitizer’s gray-scale transfer function f(D) can be measured.

)()( 1 DfDg

),()],([),( yxAyxAfgyxC

Page 34: 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 ’

Display Calibration Can be done in a similar way as photometric calibration. 光电转换特性

Γ ( gamma )校正• 摄象机: γ=0.5• 显示器: γ=2.5

人眼的生理特点• 电影: γ=1.5• 电视或计算机: γ=1.25

参考免费软件: gammalaunch

输出电压 输入光强

Page 35: 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 ’

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

Page 36: 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 ’

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

Page 37: 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 ’

An example of GST for contrast enhancement

Dark Light Dark Lightm m

Thresholdings=T(r)

s=T(r)

r r

Page 38: 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 ’

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.

Page 39: 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 ’
Page 40: 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 ’

Display Fourier spectrum by a Log transformation

Page 41: 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 ’

Power Law Transformations Power law transformation Gamma correction Power law transformation are also usef

ul for general-purpose contrast manipulation

crs

Page 42: 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 ’

Power law transformations with different gamma

Page 43: 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 ’

An example of display gamma correction

Page 44: 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 ’

Piecewise-linear transformation Piecewise-linear transformation for

contrast stretching

(r1,s1)

(r2,s2)

Page 45: 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 ’

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.

Page 46: 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 ’

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

Page 47: 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 ’

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

Page 48: 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 ’

习题 P.82 第 1 题;

23 16

155 240

1.7, 23

B A AD f D aD b

a b

a b

a b

解:

解得

Page 49: 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 ’

习题 P.82 第 2 题;

32 0

200 255

1.52, 48

B A AD f D aD b

a b

a b

a b

解:

解得

Page 50: 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 ’

习题 P.82 第 5 题;

0255

0

1704sin 2552551704sin 255

2551 cos

2 255

m

D

GST D CDF

u du

u du

D

解:

Page 51: 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 ’

习题 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

解:

Page 52: 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 ’

上机实习 1 )应用 MATLAB 软件提供的函数,编制读取 BMP 文

件,并使其直方图均衡化 ( 请勿直接调用 histeq 函数 ) ,并存为另一幅 BMP 文件。然后使用 MATLAB 本身提供的直方图均衡化函数,判别自编程序与该函数的区别。

2 )应用 MATLAB 软件提供的函数,编制读取 BMP 文件,并使其直方图匹配的函数。