Sei sulla pagina 1di 12

Digital Image Processing

(Digitaalinen kuvankäsittely)

Exercise 2

2009.10.08
1. Filter the given 4 × 4 gray level image with:

(a) 3×3 mean filter using zero padding

Zero padding of the borders.


Mean filter:
The value of the processed pixel will be
replaced by the average of the pixel values
in the window.

The corresponding convolution mask is:

All the pixels are scanned from left to right


and from up to down.

The resulting image:

The added borders are not processed.


(b) 3 × 3 weighted mean filter
using zero padding with mask

First, zero padding of the borders.

Second,
Value of the processed pixel=
[window matrix] dot product [convolution mask ]
The resulting filtered image:

Averaging filters: (Matlab)

1. Have a blurring effect on the image.


2. The blurring effect increases when the mask
size increases.
3. As the noise reduces, also the local contrast
becomes worse.
(c) 3 × 3 median filter
processing only such pixels
that have all the needed
neighbors
Process only pixels that have all the needed
neighbors.

3 × 3 median filter:
The output image is obtained by selecting the
median (the middle one when the values are
in increasing order) of the values under the mask.

The resulting image:

Median filter:
1. Reduces effectively impulsive noise, but the
local contrast remains better.
2. Thin lines are however lost.
(d) Laplacian filter with the
given mask and reflecting the
border pixels.

Reflecting the border pixels.

The pixels are scanned using mask:

The resulting image:

(Matlab)
2. Compute the 2-D discrete Fourier transform of the following image:

(a) Applying the 2-D Fourier transform


directly.

In our case, M = N = 4, so it becomes:

F(0; 0), F(0; 1), F(0; 2),…, F(1; 3),…, F(3; 3)

Resulting frequency domain image


F(u; v):
(b) Using the separability of the
Separability of the 2-D Fourier transform
Fourier transform.
means that we can get the full 2-D
transform by applying 1-D transform twice:
First, apply the 1-D transform to rows.
And then to columns of the image.

Apply 1-D DFT to rows of the input image:

The resulting intermediate image:

Next, do 1-D DFT to columns of this


intermediate image:
Resulting frequency domain image:
3. Filter the image from the previous question with the following frequency
space filter H

Image processed in the previous question:

Image filtering in frequency space is


done by:
[ frequcency domain representation ]
Dot product element-wise multiplication
[ filter]
The filtered image is finally obtained through
inverse DFT.
Summary:

Time domain Frequency domain

DFT
input image
F (u,v)
f (x,y)

Frequency domain Time domain


Inverse DFT

output image
G(u,v) = F (u,v) H(u,v) g (x,y)
4. High frequency emphasis filtering in frequency space can be expressed as:

The contrast of the resulting image can be further enhanced by applying


histogram equalization. Does it matter, which process is applied first? If the
order does matter, explain why one or the other operator should be applied first.

Hints: (Matlab)

1. The high frequency emphasis filter could not only remain low
frequency information (parameter k1) but also emphasize high frequency
information (parameter k2). (Refer to page 189-191.)

2. The histogram equalization is to make the histogram distribution uniform,


which could lose some low frequency information, such as the
average gray scale value.

Therefore, performing ‘high frequency emphasis filtering’ after ‘histogram


Equalization’ would not compensate the lost low frequency information.

Potrebbero piacerti anche