1
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 1
Image Enhancement
SPATIAL FILTERING
FREQUENCY DOMAIN FILTERING
),(*),(),( yxfyxhyxg =
),().,(),( vuFvuHvuG =
h(x,y)f(x,y) g(x,y)
H(u,v)F(u,v) G(u,v)
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 2
Image Enhancement
LOW PASS FILTERING– attenuate or eliminate high-frequency components (edges
and other sharp details)– results in image bluring
HIGH PASS FILTERING– attenuate or eliminate low-frequency components (slowly
varying characteristics, such as overall contrast andaverage intensity)
– results in reduction of overall contrast and averageintensity, and a correspondingly apparent sharpening ofedges and other sharp details
2
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 3
Image Enhancement
),(*),(),( yxfyxhyxg =
),().,(),( vuFvuHvuG =Frequency domain filters
Spatial domain filters
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 4
Image Enhancement
SMOOTHING FILTERS - LOWPASS SPATIAL FILTERING
• With the assumption that image pixel values within a smallneighborhood are highly correlated and that the noisecomponents are not correlated, noise may be reduced byreplacing each pixel with the mean over a certain neighborhoodof (x, y):
• where M is the number of pixels in the neighborhood S.• This is useful when only one version of the image is available.• If this operation is performed over a 3 x 3 neighborhood, we
have
).,(),(1
),(),(
yxmnfM
yxgSmn
µ== ∑∈
).,(9
1),(
1
1
1
1
jyixfyxgji
++= ∑∑−=−=
3
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 5
Image Enhancement
CONVOLUTION BY MASK OPERATION:The 3x3 mean filter may be expressed by the convolution mask
Unfortunately, the mean filter operation blurs edges and sharp features.
111
111
111
9
1
),(*),(),( yxfyxhyxg =
Convolution mask or kernel
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 6
Image Enhancement
4
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 7
Image Enhancement
(a) Original image;
(b)-(f) results of spatial lowpassfiltering with masks size of 3x3,5x5, 7x7, 15x15, 25x25.
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 8
Image Enhancement
Blurring of edges may be controlled by selective mean filtering:
• where T is a threshold,• this is useful in salt and pepper noise,• in this applications, the central pixel at(x,y) is usually left out
to use only the eight neighboring pixel in computing themean.
>−
=.),(
,),(),(),,(),(
otherwiseyxf
Tyxyxfifyxyxg
µµ
5
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 9
Image Enhancement
SMOOTHING FILTERS - MEDIAN FILTERING– non-linear filter– performs better noise removal with less blurring in most
cases.
1002520
201520
202010
(10, 20, 20, 20, 15, 20, 20, 25, 100)
sorting: (10, 15, 20, 20, 20, 20, 20, 25, 100)
median
1002520
201520
202010
20
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 10
Image Enhancement
(a) Original image;
(b) image corrupted byimpulse noise;
(c) result of 5x5 mean;
(d) result of 5x5 medianfiltering.
6
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 11
Image Enhancement
SHARPENING FILTERS - HIGHPASS SPATIAL FILTERING
– Edge Enhancement and Extraction– The gradient operator gives a measure of change in the
image values in the direction specified:
– For digital, differentiation is approximated by differences:
jy
fi
x
fyxG
∂∂+
∂∂=),( .),(
22
∂∂+
∂∂=
y
f
x
fyxG
[ ] [ ].)1,(),(),1(),(),(
,)1,(),(),1(),(),( 22
−−+−−≈
−−+−−=
yxfyxfyxfyxfyxG
oryxfyxfyxfyxfyxG
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 12
Image Enhancement
Differentiation leads to• removal of constant values in the direction of the operation;• extraction of edges in the orthogonal direction; and• removal of the average intensity (DC component).
Roberts gradient uses cross-differences
• This operator computes diagonal edge gradients.Theadvantage of this operator is that the resulting image pixelvalues may be written in the same array as the input image.
[ ] [ ] .),1()1,()1,1(),(),( 22 yxfyxfyxfyxfyxG +−++++−=
7
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 13
Image Enhancement
3 x 3 MASKS FOR GRADIENT OPERATIONS
Prewitt operators:
Sobel operators:
−−−≈
∂∂
−−−
≈∂∂
111
000
111
3
1;
101
101
101
3
1
y
f
x
f
−−−≈
∂∂
−−−
≈∂∂
121
000
121
4
1;
101
202
101
4
1
y
f
x
f
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 14
Image Enhancement
3x3 MASK FOR IMAGE SHARPENING
Laplacian: Subtracting Laplacian: Unsharp Masking:
−
010
141
010
−−−−−−−−
8/18/18/1
8/128/1
8/18/18/1
−−−
−
010
151
010
8
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 15
Image Enhancement
3X3 MASK FOR DIRECTIONAL GRADIENTS
.
111
000
111
:90;
101
101
101
:0
−−−
−−−
oo
.
110
101
011
:135;
011
101
110
:45
−−−
−−− oo
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 16
Image Enhancement
EXAMPLES OF 3X3 MASK OPERATIONS:
−−−−−−−−
=
−
01110
12121
11011
12121
01110
010
141
010
*
00000
01110
01110
01110
00000
−−−−−−−−−
−−−
=
−−−
−
01110
13231
12121
13231
01110
010
151
010
*
00000
01110
01110
01110
00000
9
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 17
Image Enhancement
−−−−−−−−
×111
181
111
9
1
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 18
Image Enhancement
−−−−−−−−
×111
11
111
9
1w
Where w = 9A -1,with A ≥1
(a) original image;
(b) A=1.1;
(c) A=1.15;
(d) A=1.2.
10
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 19
Image Enhancement
(a) original image;
(b) magnitude ofPrewitt gradient;
(c) setting to 255any gradient valueover 25;
(d) setting to 255any gradient valueover 25 and settingto 0 any gradientvalue under orequal 25.
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 20
Image Enhancement
(a) original image;
(b) vertical edge detector;
(c) horizontal edgedetector;
(d) Sobel edge detector;
(e) Roberts’ edge detector.
11
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 21
Image Enhancement
FREQUENCY DOMAIN FILTERING
• High-frequency components are associated with sharpfeatures in the image, as well as noise.
• To achieve smoothing of images and/or noise removal, wemay remove or attenuate a certain portion of the high-frequency components by lowpass filtering.
),().,(),( vuFvuHvuG = H(u,v)F(u,v) G(u,v)
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 22
Image Enhancement
LOWPASS FILTER FUNCTIONS:
≤
=otherwise
DvuDifvuHideal o
0
,),(1),(:
.).,.,),(:( 22 frequencyradialtheeivuvuDNote +=
),().,(),( vuFvuHvuG =
12
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 23
Image Enhancement
(a) 512x512 image;
(b) its Fourier spectrum with superimposed circles which radiiequal to 8, 18, 43, 78, and 152 (enclose 90, 93, 95, 99, and 99.5% ofthe image power, respectively).
2),(),( vuFvuP =∑∑
−
=
−
==
1
0
1
0
),(N
u
N
vT vuPP
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 24
Image Enhancement
(a) original image;
(b)-(f) results of ideal lowpass filteringwith the cutoff frequency set at the radiiequal to 8, 18, 43, 78, and 152,respectively.
• Ideal losspass filters results inblurring and ringing removing edgeand sharp detail information of theimage
13
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 25
Image Enhancement
),(*),(),( yxfyxhyxg =
),().,(),( vuFvuHvuG =
),( yxh
),( yxf
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 26
Image Enhancement
• While "ideal" filtering is possible on computers, it is notdesirable as it results in ringing artifacts around edges in theimage.
• Exponential and Butterworth filters provide a smoother roll off,and produce smooth images with no ringing artifacts.
Exponential:
Butterworth:
(Note: n is the order of the filter; higher-order filters provide faster roll-off.)
.),(
exp),(
−=
n
oD
vuDvuH
.),(
1
1),( 2 n
oD
vuDvuH
+
=
22),( vuvuD +=
14
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 27
(a) original image;
(b)-(f) results of Butterworthlowpass filtering with the cutofffrequency set at the radii equal to 8,18, 43, 78, and 152, respectively.
• Less blurring and no ringing
Image Enhancement
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 28
Image Enhancement
(a) image digitized with only 16gray levels (exhibits falsecontours);
(b) result of smothing (a) with alowpass filter of order 1;
(c) noisy image;
(d) results of applyingButterworth lowpass filtering tothe noisy image.
15
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 29
Image Enhancement
HIGHPASS FILTER FUNCTIONS:• Highpass filters are useful in edge extraction applications.
Ideal:
Exponential:
Butterworth:
≥
=.0
,),(1),(
otherwise
DvuDifvuH o
.),(
exp),(
−=
n
o
vuD
DvuH
.
),(1
1),( 2n
o
vuD
DvuH
+
=
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 30
Image Enhancement
(a) original image;
(b) result after a highpassButterworth filter (=> low-frequency components wereseverely attenuated, thus makingdifferent gray-level regionsappear the same)
(c) result after high-frequencyemphasis (high-frequencyemphasis filter ≈ highpass filter +a constant);
(d) results of applying high-frequency emphasis andhistogram equalization.
16
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 31
Image Enhancement
• Directional "sector" filters may be designed to enhance, extract,or remove features at preferred orientations, by virtue of therotational property of the Fourier transform.
• While space domain operations affect local pixel values andfeatures, frequency domain operations affect the imageglobally.
• While normally we are concerned with the magnitude spectrumto a large extent, the phase spectrum is also important. Phasehas been shown to be associated with edge information to alarger extent than the magnitude of the frequency components.
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 32
Image Enhancement
HOMOMORPHIC FILTERING
i(x,y): illumination component (very low frequency);r(x,y): reflectance component (medium-to-high frequency).
To separate the two components for filtering, take the logarithm:
[ ] [ ] [ ]),(ln),(ln).(ln),( yxryxiyxfyxz +==
).(’),(’),( vuRvuIvuZ +=
),().,(),( yxryxiyxf = ),().,(),( vuRvuIvuF ≠
[ ]),(exp),( yxsyxg =),().,(),( vuZvuHvuS =
lnf(x,y) g(x,y)FFT H(u,v) (FFT)-1 exp
17
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 33
Image Enhancement
(a) original image;
(b) image processed by homomorphic filteringto achieve simultaneous dynamic rangecompression and contrast enhancement.
(by enhancing r and suppressing i)
© Copyright RMR / RDL - 1999.1 PEE5830 - Processamento Digital de Imagens 34
Color Image Processing
• Slide projector
Top Related