Sunteți pe pagina 1din 74

1

Image Enhancement in
the Frequency Domain

Frequency Domain
Filtering
Basic steps for filtering in the
frequency domain
Basics of filtering in the
frequency domain
1. multiply the input image by (-1)
x+y
to center the
transform to u = M/2 and v = N/2 (if M and N are even
numbers, then the shifted coordinates will be integers)
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
to cancel the
multiplication of the input image.

Images
Black and white image is a 2D matrix.
Intensities represented as pixels.
Color images are 3D matrix, RBG.

Linear Filtering
About modifying pixels based on
neighborhood. Local methods simplest.
Linear means linear combination of neighbors.
Linear methods simplest.
Useful to:
Integrate information over constant regions.
Scale.
Detect changes.
Fourier analysis.
Many nice slides taken from image database.
Filtering to reduce noise
Noise is what were not interested in.
Well discuss simple, low-level noise: Light
fluctuations; Sensor noise; Quantization
effects; Finite precision
Not complex: shadows; extraneous objects.
A pixels neighborhood contains
information about its intensity.
Averaging noise reduces its effect.
Additive noise
I = S + N. Noise doesnt depend on
signal.
Well consider:
d distribute y identicall ,
for t independen ,
tic. determinis
0 ) ( with
j i
j i j i
i
i i i i
n n
n n n n
s
n E n s I
=
= + =
Average Filter
Mask with positive
entries, that sum 1.
Replaces each pixel
with an average of
its neighborhood.
If all weights are
equal, it is called a
BOX filter.

1
1
1
1
1
1
1
1
1
F
1/9
Does it reduce noise?
Intuitively, takes out small variations.
) , 0 ( ~ ) , (

1
)) , (

(
0 )) , (

(
) , (
1
) , (

m
1
) , ( ) , (

m
1
j) O(i,
) N(0, ~ j) N(i, with ) , ( ) , (

) , (
2
2
2
2
2 /
2 /
2 /
2 /
) , (

2 /
2 /
2 /
2 /
2 /
2 /
2 /
2 /
m
N j i N
m
m
m
j i N E
j i N E
k j h i N
m
k j h i I
k j h i N k j h i I
j i N j i I j i I
m
m h
m
m k
j i N
m
m h
m
m k
m
m h
m
m k
o o
o
o
= =
=
+ =
= + =
+ =


= = = =
= =

2
2 2
Example: Smoothing by
Averaging
Smoothing as Inference About the
Signal
+ =
Nearby points tell more about the
signal than distant ones.
Neighborhood for
averaging.
Gaussian Averaging
Rotationally
symmetric.
Weights nearby
pixels more than
distant ones.
This makes sense
as probabalistic
inference.

A Gaussian gives a
good model of a fuzzy
blob

exp
x
2
+ y
2
2o
2
|
\

|
.
|
|
\

|
.
|
An Isotropic Gaussian
The picture shows a
smoothing kernel
proportional to



(which is a reasonable
model of a circularly
symmetric fuzzy
blob)
Smoothing with a Gaussian
The effects of smoothing
Each row shows smoothing
with gaussians of different
width; each column shows
different realizations of
an image of gaussian noise.

Efficient Implementation
Both, the BOX filter and the Gaussian
filter are separable:
First convolve each row with a 1D filter
Then convolve each column with a 1D filter.
Smoothing as Inference About the
Signal: Non-linear Filters.
+ =
Whats the best
neighborhood for
inference?
Filtering to reduce noise: Lessons
Noise reduction is probabilistic inference.
Depends on knowledge of signal and
noise.
In practice, simplicity and efficiency
important.
Filtering and Signal
Smoothing also smooths signal.
Removes detail
This is good and bad:
- Bad: cant remove noise w/out blurring
shape.
- Good: captures large scale structure
Notch filter

=
=
otherwise 1
N/2 (M/2, v) (u, if 0
) , (
)
v u H
this filter is to force the F(0,0)
which is the average value of an
image (dc component of the
spectrum)
the output has prominent edges
in reality the average of the
displayed image cant be zero as
it needs to have negative gray
levels. the output image needs to
scale the gray level
Low pass filter
high pass filter
Add the of filter height to
F(0,0) of the high pass filter
Correspondence between filter in
spatial and frequency domains
Convolution
Convolution kernel g,
represented as
matrix.
its associative


Result is:

Smoothing Frequency-domain
filters: Ideal Lowpass filter
image power circles
Result of ILPF
Example
Butterworth Lowpass Filter:
BLPF
Example
Spatial representation of BLPFs
Gaussian Lowpass Filter: GLPF
Example
Example
Example
Example
Sharpening Frequency Domain
Filter:
Ideal highpass filter
Butterworth highpass filter
Gaussian highpass filter

>
s
=
0
0
D v) D(u, if 1
D v) D(u, if 0
) , ( v u H
| |
n
v u D
v u H
2
0
) , ( D 1
1
) , (
+
=
2
0
2
2 / ) , (
1 ) , (
D v u D
e v u H

=
Spatial representation of Ideal,
Butterworth and Gaussian highpass filters
Example: result of IHPF
Example: result of BHPF
Example: result of GHPF
Laplacian in the Frequency
domain
Example: Laplacian filtered image
Example: high-boost filter
Examples
2-D Fourier Transform
Properties

S-ar putea să vă placă și