Upload
others
View
5
Download
0
Embed Size (px)
Citation preview
1
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
The principal objective of enhancementThe principal objective of enhancementto process an image so that the result is more suitablethan the original image for a specific application.
Enhancement methodsEnhancement methodsSpatial Domain (in chapter 3)
based on direct manipulation of pixels in an image
Frequency Domain (in this chapter)based on modifying the Fourier transform of an image
The viewer is the ultimate judge of how well ofThe viewer is the ultimate judge of how well ofa particular method works.a particular method works.
Chapter 4 Chapter 4 Image Enhancement in theImage Enhancement in theFrequency DomainFrequency Domain
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
Chapter 4 Chapter 4 Image Enhancement in theImage Enhancement in theFrequency DomainFrequency Domain
4.1 Background4.2 Introduction to the Fourier Transform and the
Frequency Domain4.3 Smoothing Frequency-Domain Filters4.4 Sharpening Frequency-Domain filters4.5 Homomorphic Filtering4.6 Implementation
2
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.1 Background4.1 Background
Source:http://www-groups.dcs.st-and.ac.uk/~history/PictDisplay/Fourier.html
Jean Jean BaptisteBaptiste Joseph Fourier(1768~1830) Joseph Fourier(1768~1830)French mathematicianFrench mathematician
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.1 Background4.1 Background
3
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.1 Background4.1 Background
Fourier SeriesFourier SeriesAny Any periodically repeated functionperiodically repeated function can be expressed can be expressedof the sum of of the sum of sinessines/cosines/cosines of of different frequenciesdifferent frequencies,,each multiplied by a different coefficienteach multiplied by a different coefficient
Fourier TransformFourier TransformFinite curvesFinite curves can be expressed as the integral of can be expressed as the integral ofsinessines/cosines multiplied by a weighing function/cosines multiplied by a weighing functionwildly used in wildly used in signal processingsignal processing field field
Fourier Series/TransformFourier Series/Transform can be reconstructed can be reconstructedcompletely via completely via an inverse processan inverse process
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
This Section will introduceThis Section will introduceOne dimensionOne dimension and and Two dimensionTwo dimension Fourier Fouriertransformtransformmostly on a mostly on a discrete formulationdiscrete formulation of the continuous of the continuoustransform and some of its propertiestransform and some of its properties
4
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
One dimensional Fourier transform and itsOne dimensional Fourier transform and itsinverse (Fourier transform pair)inverse (Fourier transform pair)
Fourier transform
Inverse Fourier transform
其中, f(x)是單變數連續函式,F(u)是f(x)的FourierTransform結果,j= 1−
( ) ( ) 1)-(4.2 2 dxexfuF uxj π−∞
∞−∫=
( ) ( ) 2)-(4.2 2 dueuFxf uxj π∫∞
∞−=
像素強度
頻率強度
頻率強度
像素強度
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
Two dimensional Fourier transform and itsTwo dimensional Fourier transform and itsinverse (Fourier transform pair)inverse (Fourier transform pair)
Fourier transform
Inverse Fourier transform
( ) ( ) ( ) 3)-(4.2 ,, 2∫ ∫∞
∞−
∞
∞−
+−= dydxeyxfvuF vyuxj π
( ) ( ) ( ) 4)-(4.2 ,, 2∫ ∫∞
∞−
∞
∞−
+= dvduevuFyxf vyuxj π
5
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
Discrete Fourier Transform (DFT)Discrete Fourier Transform (DFT)
Discrete Fourier Transform
Inverse Discrete Fourier Transform
( ) ( ) 5)-(4.2 1 -210for 1 1
0
2 ., ..., M, , uexfM
uFM
x
Muxj == ∑−
=
− π
( ) ( ) 6)-(4.2 1 -210for 1
0
2 ., ..., M, , xeuFxfM
x
Muxj == ∑−
=
π
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
Frequency DomainFrequency Domain
Euler’s formula
7)-(4.2 sincos θθθ je j +=
substituting this expression into Eq. (4.2-5)
( ) ( )[ ]
8)-(4.2 1-M ..., 2, 1,for
/2sin/2cos1 1
0
=
−= ∑−
=
u
MuxjMuxxfM
uFM
x
ππ
F(u)是f(x)的頻率成份,Fourier Transform就像菱鏡的功能一樣可將f(x)的頻率成份分離出來分離出來的值為F(u)
6
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
To express F(x) in polar coordinates(To express F(x) in polar coordinates(極座標極座標))( ) ( ) ( ) 9)-(4.2 ujeuFuF φ−=
( ) ( ) ( )[ ] 10)-(4.2 21
22 uIuRuF +=
|F(u)| is called the magtitute(強度) or spectrum(頻譜)
( ) ( )( ) 11)-(4.2 tan 1
= −
uRuIuφ
φ is called the phase angle (相位角) or phase spectrum
R(u) 與 I(u)分別是F(u)的實部與虛部
( ) ( ) ( ) ( ) 12)-(4.2 222 uIuRuFuP +==
p(u) is called power spectrum of spectrum density
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
( ) ( )
( )
MAKMA
eMAF
eMA
AeM
exfM
uF
K
x
K
x
Mxj
K
x
Muxj
K
x
Muxj
M
x
Muxj
=
=
=
=
=
=
∑
∑
∑
∑
∑
−
=
−
=
−
−
=
−
−
=
−
−
=
−
1
0
1
0
02
1
0
2
1
0
2
1
0
2
1
0
1
1
π
π
π
π
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
ExampleExample
7
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
8
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
22D DFT and its inverseD DFT and its inverse
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
Spectrum, Phase angle, and Spectrum densitySpectrum, Phase angle, and Spectrum density
9
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
Shifts the origin of F(u, v) to (M/2, N/2)Shifts the origin of F(u, v) to (M/2, N/2)
dc (direct current) valuedc (direct current) valuezero frequencyzero frequencymean value of an imagemean value of an image
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
if f(x,y) is real, its Fourier transformation isif f(x,y) is real, its Fourier transformation isconjugate conjugate ((共軛共軛)) symmetricsymmetric
10
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
ExampleExample
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
11
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
Filtering in the frequency domainFiltering in the frequency domain影像灰階內容與頻率的關係
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
1. Multiply the input image by (-1)x+y to center the transform,as indicated in Eq. (4.2-21).
2. Compute F(u, v), the DFT of the image from (1).3. Multiply F(u, v) by a filter function H(u,v).
4. Compute the inverse DFT of the result in (3).
5. Obtain the real part of the result in (4).6. Multiply the result in (5) by (-1)x+y
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
Steps of Filtering in the frequency domainSteps of Filtering in the frequency domain
12
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
Some basic filters and their propertiesSome basic filters and their propertiesNotch filter - remove the average value of an imageNotch filter - remove the average value of an image
13
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
Low frequenciesLow frequenciesSmooth areasSmooth areas
High frequenciesHigh frequenciesEdge, Texture, noiseEdge, Texture, noise
LowpassLowpass filter filter濾掉高頻部份,保留低頻部份濾掉高頻部份,保留低頻部份
highpass highpass filterfilter濾掉低頻部份,保留高頻部份濾掉低頻部份,保留高頻部份
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
14
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
Correspondence between filtering in the Correspondence between filtering in the spatialspatialand and frequencyfrequency domains domains
Convolution theorem(Convolution theorem(捲積定理捲積定理))
( ) ( ) ( ) ( ) ( )31-4.2 ,,,*, vuHvuFyxhyxf ⇔
( ) ( ) ( ) ( ) ( )32-4.2 ,*,,, vuHvuFyxhyxf ⇔
捲積捲積
頻域相乘等於空間域做捲積,空間域相乘等於頻域做捲積
15
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
Impulse Function(Impulse Function(脈衝函式脈衝函式))
Fourier transform of Impulse FunctionFourier transform of Impulse Function
( ) ( ) ( ) 33)-(4.2 ,,,1
0
1
00000∑∑
−
=
−
=
=−−M
x
N
y
yxAsyyxxAyxs δ
( ) ( ) ( ) 34)-(4.2 0,0,,1
0
1
0∑∑−
=
−
=
=M
x
N
y
syxyxs δ
( ) ( ) ( ) 35)-(4.2 1,1,1
0
1
0
//2
MNeyx
MNvuF
M
x
N
y
NvyMuxj == ∑∑−
=
−
=
+− πδ
函式函式與與脈衝函式脈衝函式做做捲積捲積就是將函式就是將函式複製複製到脈衝函式所在位置到脈衝函式所在位置
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
( ) ( ) ( ) ( )
( ) 36)-(4.2 1
,,1,*,1
0
1
0
x,yhMN
nymxhnmMN
yxhyxfM
x
N
y
=
−−= ∑∑−
=
−
=
δ
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
Convolution between h(x,y) and Impulse FunctionConvolution between h(x,y) and Impulse Function
16
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
Correspondence between filtering in the Correspondence between filtering in the spatialspatialand and frequencyfrequency domains domains
Spatial Domain Frequency Domain
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
GaussianGaussian filter ( filter (高斯濾波器高斯濾波器))
( ) 38)-(4.2 22/2 σuAeuH −=
( ) 39)-(4.2 22222 xAexh σπσπ −=
( ) 40)-(4.2 -22
221
2 2/2/ σσ uu BeAeuH −−=
( ) 41)-(4.2 2 -222
2222
12 2
22
1xx BeAexh σπσπ σπσπ −−=
17
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.2 Introduction to the Fourier Transform and4.2 Introduction to the Fourier Transform andthe Frequency Domainthe Frequency Domain
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.3 Smoothing Frequency-Domain Filters4.3 Smoothing Frequency-Domain Filters
( ) ( ) ( ) 1)-(4.3 ,,, vuFvuHvuG =
4.3.1 4.3.1 Ideal Ideal LowpassLowpass Filters Filters
( ) ( )( ) 2)-(4.3
if 0if 1
,0
0
>≤
=Du,v DDu,v D
vuH
D(u,v)表距中心點距離, MxN的影像,中心點為(M/2, N/2)
( ) ( ) ( )[ ] 3)-(4.3 2/2/, 2122 NvMuvuD −+−=
D0 is called cutoff frequency
18
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.3 Smoothing Frequency-Domain Filters4.3 Smoothing Frequency-Domain Filters
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.3 Smoothing Frequency-Domain Filters4.3 Smoothing Frequency-Domain Filters
Choosing the cutoff frequency according to theChoosing the cutoff frequency according to thepower spectrum of an imagepower spectrum of an image
( ) 4)-(4.3 ,1
0
1
0∑∑−
=
−
=
=M
u
N
vT vuPP
( ) 5)-(4.3 /,100
= ∑∑
u vTPvuPα
19
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.3 Smoothing Frequency-Domain Filters4.3 Smoothing Frequency-Domain Filters
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.3 Smoothing Frequency-Domain Filters4.3 Smoothing Frequency-Domain Filters
a b cd e f
20
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.3 Smoothing Frequency-Domain Filters4.3 Smoothing Frequency-Domain Filters
blurring and ringing effectsblurring and ringing effects
( ) ( ) ( )( ) ( ) ( )yxfyxhyxgDomainSpatial
vuFvuHvuGDomainFrequency,*,,:
,,,: =
=
Blurring : Low frequencies are removedBlurring : Low frequencies are removed
Ringing : Cutoff is too sharpRinging : Cutoff is too sharp
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.3 Smoothing Frequency-Domain Filters4.3 Smoothing Frequency-Domain Filters
21
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.3 Smoothing Frequency-Domain Filters4.3 Smoothing Frequency-Domain Filters
4.3.2 4.3.2 ButterworthButterworth LowpassLowpass Filters Filters
( )( )[ ]
6)-(4.3 ,11, 2
0nDvuD
vuH+
=
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.3 Smoothing Frequency-Domain Filters4.3 Smoothing Frequency-Domain Filtersno ringing
a b cd e f
FIGURE 4.15 (a) Original image. (b)-(f) Results of filtering with BLPFs of order 2,with cutoff frequencies at radii of 5, 15, 30, 80, 230, as shown in Fig. 4.11 (b).Compare with Fig. 4.12.
22
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.3 Smoothing Frequency-Domain Filters4.3 Smoothing Frequency-Domain Filters
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.3 Smoothing Frequency-Domain Filters4.3 Smoothing Frequency-Domain Filters
4.3.3 4.3.3 Gaussian LowpassGaussian Lowpass Filters Filters
( ) ( ) 7)-(4.3 ,22 2, σvuDevuH −=
( ) ( ) 8)-(4.3 ,20
2 2, DvuDevuH −=
23
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.3 Smoothing Frequency-Domain Filters4.3 Smoothing Frequency-Domain Filters
a b cd e f
FIGURE 4.18 (a) Original image. (b)-(f) Results of filtering with Gaussian lowpassfilters with cutoff frequencies set at radii of 5, 15, 30, 80, 230, as shown in Fig. 4.11(b). Compare with Figs. 4.12 and 4.15.
no ringing
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.3 Smoothing Frequency-Domain Filters4.3 Smoothing Frequency-Domain Filters
24
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.3 Smoothing Frequency-Domain Filters4.3 Smoothing Frequency-Domain Filters
4.3.4 4.3.4 Additional examples of Additional examples of LowpassLowpass Filtering Filtering
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.3 Smoothing Frequency-Domain Filters4.3 Smoothing Frequency-Domain Filters
25
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.4 Sharping Frequency-Domain Filters4.4 Sharping Frequency-Domain Filters
( ) ( ) 1)-(4.4 ,1, vuHvuH lphp −=
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.4 Sharping Frequency-Domain Filters4.4 Sharping Frequency-Domain Filters
26
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.4 Sharping Frequency-Domain Filters4.4 Sharping Frequency-Domain Filters
4.4.1 4.4.1 Ideal Ideal HighpassHighpass Filters Filters
( ) ( )( ) 2)-(4.4
if 1if 0
,0
0
>≤
=Du,v DDu,v D
vuH
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.4 Sharping Frequency-Domain Filters4.4 Sharping Frequency-Domain Filters
4.4.2 4.4.2 ButterworthButterworth HighpassHighpass Filters Filters( )
( )[ ] 3)-(4.4 ,1
1, 20
nvuDDvuH
+=
27
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.4.3 4.4.3 Gaussian HighpassGaussian Highpass Filters Filters
4.4 Sharping Frequency-Domain Filters4.4 Sharping Frequency-Domain Filters
( ) ( ) 4)-(4.4 1,20
2 2, DvuDevuH −−=
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.4 Sharping Frequency-Domain Filters4.4 Sharping Frequency-Domain Filters
4.4.4 4.4.4 The The Laplacian Laplacian in the Frequency Domainin the Frequency Domain
28
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.4 Sharping Frequency-Domain Filters4.4 Sharping Frequency-Domain Filters
4.4.4 4.4.4 The The Laplacian Laplacian in the Frequency Domainin the Frequency Domain
An image can be enhanced by subtracting the Laplacianfrom the original image.
( ) ( ) ( ) 12)-(4.4 ,,, 2 yxfyxfyxg ∇−=
( ) ( ) ( )[ ] ( ){ } 13)-(4.4 ,221 , 221 vuFNvMuyxg −+−−ℑ= −
( ) ( ) ( )[ ] ( ){ } 10)-(4.4 ,2/2/, 2212 vuFNvMuyxf −+−−ℑ=∇ −
( ) ( ) ( )[ ] ( ) 11)-(4.4 ,2/2/, 222 vuFNvMuyxf −+−−⇔∇
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.4 Sharping Frequency-Domain Filters4.4 Sharping Frequency-Domain Filters
29
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.4 Sharping Frequency-Domain Filters4.4 Sharping Frequency-Domain Filters
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.4 Sharping Frequency-Domain Filters4.4 Sharping Frequency-Domain Filters
4.4.5 4.4.5 UnsharpUnsharp Masking, High-Boost Filtering, Masking, High-Boost Filtering,and High-and High-GrequencyGrequency Emphasis Filtering Emphasis Filtering
Unsharp Unsharp filteringfiltering
High-Boost filteringHigh-Boost filtering
( ) ( ) ( ) 14)-(4.4 ,,, yxfyxfyxf lphp −=
( ) ( ) ( )( ) ( ) ( ) ( )( ) ( ) ( ) 17)-(4.4 ,,1-A
16)-(4.4 ,,,1-A
15)-(4.4 ,,,
yxfyxf
yxfyxfyxf
yxfyxAfyxf
hp
lp
lphb
+=
−+=
−=
30
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
UnsharpUnsharp filtering - frequency-domain filter filtering - frequency-domain filter
High Boost filtering - frequency-domain filterHigh Boost filtering - frequency-domain filter
4.4 Sharping Frequency-Domain Filters4.4 Sharping Frequency-Domain Filters
( ) ( ) 18)-(4.4 ,1, vuHvuH lphp −=
( ) ( ) ( ) 19)-(4.4 ,1, vuHAvuH hphb −−=
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.4 Sharping Frequency-Domain Filters4.4 Sharping Frequency-Domain Filters
31
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.4 Sharping Frequency-Domain Filters4.4 Sharping Frequency-Domain Filters
High frequency emphasisHigh frequency emphasis
( ) ( ) 20)-(4.4 ,, vubHavuH hphfe +=
typically, 0.25≤ a ≤ 0.5, 1.5 ≤ b ≤ 2.0
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.4 Sharping Frequency-Domain Filters4.4 Sharping Frequency-Domain Filters
32
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.5 Homomorphic Filtering4.5 Homomorphic Filtering
illumination-reflectance modelillumination-reflectance modelsimultaneous simultaneous gray-level range compressiongray-level range compression and andcontract enhancementcontract enhancement
( ) ( ) ( ) 1)-(4.5 .,,, yxryxiyxf =
( ) ( )( ) ( ) 3)-(4.5 .,ln,ln
,ln, yxryxi
yxfyxzLet+=
=
( )( ) ( )( ) ( )( ) 2)-(4.5 .,,, yxryxiyxf ℑℑ≠ℑ
( ) ( ) ( ) 4)-(4.5 ,,,Then vuFvuFvuZ ri +=
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.5 Homomorphic Filtering4.5 Homomorphic Filtering
( ) ( ) ( )( ) ( ) ( ) ( ) 5)-(4.5
,,, u,vFu,vHu,vFu,vH
vuZvuHvuS
ri +==
( ) ( ){ }( ) ( ){ } ( ) ( ){ } 6)-(4.5
,,11
1
u,vFu,vHu,vFu,vHvuSyxs
ri−−
−
ℑ+ℑ=
ℑ=
( ) ( ) ( ){ }( ) ( ) ( ){ } 8)-(4.5
7)-(4.5 ,' 1
1
u,vFu,vHx,yr'
u,vFu,vHyxiLet
r
i−
−
ℑ=
ℑ=
( ) ( ) ( ) 9)-(4.5 .,',', yxryxiyxs =
33
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
( ) ( )
( ) ( )
( ) ( ) 10)-(4.5
,
00
,
x,yrx,yiee
eyxgx,yr'x,yi'
yxs
=⋅=
=
( ) ( ) 11)-(4.5 ,'0
yxiex,yi =
( ) ( ) 12)-(4.5 ,'0
yxrex,yr =
4.5 Homomorphic Filtering4.5 Homomorphic Filtering
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.5 Homomorphic Filtering4.5 Homomorphic Filtering
34
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.5 Homomorphic Filtering4.5 Homomorphic Filtering
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 Implementation
Some Additional Properties of the 2D FourierSome Additional Properties of the 2D FourierTransform TranslationTransform Translation
ShiftingShifting
Shifts center to (M/2, N/2)Shifts center to (M/2, N/2)
35
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 Implementation
DistributivityDistributivity((分配率分配率))
ScalingScaling
( ) ( )[ ] ( )[ ] ( )[ ] 5)-(4.6 ,,,, 2121 yxfyxfyxfyxf ℑ+ℑ=+ℑ
( ) ( )[ ] ( )[ ] ( )[ ] 6)-(4.6 ,,,, 2121 yxfyxfyxfyxf ℑ⋅ℑ≠⋅ℑ
( ) ( ) 7)-(4.6 ,, vuaFyxaf ⇔
( ) 8)-(4.6 ,1,
⇔
bv
auF
abbyaxf
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 Implementation
RotationRotation
( ) ( ) 9)-(4.6 ,, 00 θϕωθθ +⇔+ Frf
ϕωϕωθθ sin ,cos sin ,cos ==== vuryrxLet
( ) ( ) ( ) ( )ϕω,F r,θfu,vFx,yfThen and become and
36
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 Implementation
PeriodicityPeriodicity
Conjugate symmetryConjugate symmetry
( ) ( ) ( ) ( )( ) ( ) ( ) ( ) 11)-(4.6
10)-(4.6 ,,,,NM,yxfNx,yfM,yxfx,yf
NvMuFNvuFvMuFvuF++=+=+=++=+=+=
( ) ( ) 12)-(4.6 ,*, vuFvuF −−=
( ) ( ) 13)-(4.6 ,, vuFvuF −−=
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 Implementation
37
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 Implementation
SeparabilitySeparability
( ) ( )
( ) 14)-(4.6 ,1
,11,
1
0
/2
1
0
/21
0
/2
∑
∑∑−
=
−
−
=
−−
=
−
=
=
M
x
Muxj
N
y
NvyjM
x
Muxj
evxFM
eyxfN
eM
vuF
π
ππ
( ) ( ) 15)-(4.6 ,1,1
0
/2∑−
=
−=N
y
NvyjeyxfN
vxF π
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 Implementation
Computing the inverse Fourier TransformComputing the inverse Fourier Transformusing a Forward Transform Algorithmusing a Forward Transform Algorithm
38
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 Implementation
More on PeriodicityMore on Periodicity
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 Implementation
39
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 Implementation
避免產生避免產生wraparound errorwraparound error在函式後方補零在函式後方補零
( ) ( )21)-(4.6
PxA 01-Ax0
≤≤≤≤
=xf
xfe
( ) ( )22)-(4.6
PxB 01-Bx0
≤≤≤≤
=xg
xge
且P≥A+B-1
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 Implementation
22DD
40
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 Implementation
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 Implementation
41
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 Implementation
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 ImplementationThe convolution and Correlation TheoremsThe convolution and Correlation Theorems
Convolution TheoremsConvolution Theorems
42
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 ImplementationThe convolution and Correlation TheoremsThe convolution and Correlation Theorems
Correlation TheoremsCorrelation Theorems
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 ImplementationThe convolution and Correlation TheoremsThe convolution and Correlation Theorems
43
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 ImplementationSummary of Properties of the 2D Fourier TransformSummary of Properties of the 2D Fourier Transform
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 ImplementationSummary of Properties of the 2D Fourier TransformSummary of Properties of the 2D Fourier Transform
44
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 ImplementationSummary of Properties of the 2D Fourier TransformSummary of Properties of the 2D Fourier Transform
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 ImplementationSummary of Properties of the 2D Fourier TransformSummary of Properties of the 2D Fourier Transform
45
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 ImplementationThe Fast Fourier TransformationThe Fast Fourier Transformation
Complexity of Fourier TransformationComplexity of Fourier TransformationO(NO(N22))
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 ImplementationThe Fast Fourier TransformationThe Fast Fourier Transformation
( ) ( ) 35)-(4.6 1 1
0∑−
=
=M
x
uxMWxf
MuF
36)-(4.6 /2 MjM eW π−=
38)-(4.6 237)-(4.6 2Let
K MM n
==
( ) ( )
( ) ( ) ( ) ( ) 39)-(4.6 12K12
K1
2121
1
0
1
0
122
22
1
0
++=
=
∑ ∑
∑−
=
−
=
+
−
=
k
x
k
x
xuK
xuK
M
x
uxM
WxfWxf
WxfK
uF
46
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
( ) ( )
( ) ( ) ( ) ( ) 39)-(4.6 12K12
K1
2121
1
0
1
0
122
22
1
0
++=
=
∑ ∑
∑−
=
−
=
+
−
=
k
x
k
x
xuK
xuK
M
x
uxM
WxfWxf
WxfK
uF
4.6 Implementation4.6 ImplementationThe Fast Fourier TransformationThe Fast Fourier Transformation
( ) ( )∑−
=
1
0
222
K1 k
x
xuKWxf ( ) ( )∑
−
=
++1
0
12212
K1 k
x
xuKWxf
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 ImplementationThe Fast Fourier TransformationThe Fast Fourier Transformation
( ) ( )
( ) ( ) ( ) 40)-(4.6 12K12
K1
21 1
0
1
02
/22/2222
++=∴
===
∑ ∑−
=
−
=
−−
k
x
k
x
uK
uxK
uxK
uxK
KuxjKuxjuxk
WWxfWxfuF
WeeW ππQ
( ) ( )
( ) ( ) ( ) ( ) 39)-(4.6 12K12
K1
2121
1
0
1
0
122
22
1
0
++=
=
∑ ∑
∑−
=
−
=
+
−
=
k
x
k
x
xuK
xuK
M
x
uxM
WxfWxf
WxfK
uF
47
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 ImplementationThe Fast Fourier TransformationThe Fast Fourier Transformation
( ) ( ) 41)-(4.6 2K1
1
0∑−
=
=k
x
uxKeven WxfuFDefining
( ) ( ) 42)-(4.6 12K1
1
0∑−
=
+=k
x
uxKodd WxfuFDefining
( ) ( ) ( )[ ] 43)-(4.6 21
2uKoddeven WuFuFuF +=
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 ImplementationThe Fast Fourier TransformationThe Fast Fourier Transformation
( ) ( ) ( )[ ]
( ) ( ) ( ) ( )
( ) ( ) ( )
( ) ( )
( ) ( )[ ] 44)-(4.6 21
12K12
K1
21
12K12
K1
21
12K12
K1
21
21
and
2
1
02
1
0
1
02
1
0
1
02
1
0
2
22
uKoddeven
K
x
uK
uxK
K
x
uxK
K
x
uK
uxK
K
x
uxK
K
x
kuk
xKuK
K
x
xKuK
kukoddeven
uM
MuM
uM
MuM
WuFuF
WWxfWxf
WWxfWxf
WWxfWxf
WKuFKuFKuF
WWWW
−=
+−=
−++=
++=
+++=+∴
−==
∑∑
∑∑
∑∑
−
=
−
=
−
=
−
=
−
=
++−
=
+
+
++Q 週期性
48
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 ImplementationThe Fast Fourier TransformationThe Fast Fourier Transformation
( ) ( ) ( )[ ]
( ) ( ) ( )[ ]
( ) ( ) ( )[ ]
( ) ( ) ( )[ ]
( ) ( ) ( )[ ]
( ) ( ) ( )[ ]12
12
02
12
12
02
11211
11211
00210
11211
11211
00210
−
−
−−−=+−
−=+
−=+
−+−=−
+=
+=
KKoddeven
Koddeven
Koddeven
KKoddeven
koddeven
koddeven
WKFKFKKF
WFFKF
WFFKF
WKFKFKF
WFFF
WFFF
L
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 ImplementationThe Fast Fourier TransformationThe Fast Fourier Transformation
( ) ( )( ) ( ) 46)-(4.6 1 212na
45)-(4.6 1 212 1
≥+−=
≥+−= −
nnannmnm
n
n
FFT所需要的乘法與加法計算次數
( )
( ) 48)-(4.6 logna
47)-(4.6 log21
2
2
MM
MMnm
=
=
n2M =其中
49
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 ImplementationThe Fast Fourier TransformationThe Fast Fourier Transformation
( )
( ) 50)-(4.6 22M
49)-(4.6 log
log
n
2
2
2
nnC
MM
MMMMC
n
=⇒=
=
=
Advantage of the FFT over Fourier Transform
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 ImplementationThe Fast Fourier TransformationThe Fast Fourier Transformation
50
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
4.6 Implementation4.6 ImplementationThe Fast Fourier TransformationThe Fast Fourier Transformation
Digital Image Processing, 2nd ed.Digital Image Processing, 2nd ed.www.imageprocessingbook.com
© 2002 R. C. Gonzalez & R. E. Woods
• 頻域可完全掌控filter特性,非常適合在實驗階段,Filter在頻域設計完成後,通常會轉成對等的空間域filter,然後使用韌體或硬體的方式處理影像.
4.6 Implementation4.6 ImplementationSome comments on filter designSome comments on filter design