1
CMPB 345: IMAGE PROCESSING
DISCRETE TRANSFORM 2
2
FILTERING We may want to modify the resulting spectrum after an image
has been transformed into the frequency/sequency domain. High frequency information can be removed with a lowpass filter
(effect of blurring an image). Low frequency information can be removed with a highpass
filter (tend to sharpen an image). Bandpass filtering is to extract the frequency information in
specific parts of the spectrum. Bandreject filtering is to eliminate specific parts of the spectrum
(e.g. to remove unwanted noise). After we have transform the image into frequency or sequency
domain, we may want to modify the resulting spectrum before apply any filtering to the image.
2 types of spectral symmetries result from taking the continuous functions & sampling them to develop the discrete transform:
3
(a) FOURIER TRANSFORM IMPLIED SYMMETRY
WE repeat the discrete NxN spectrum in all directions to infinity. The frequency in the spectral components only increasing up to
N/2 and then decreases due to periodicity and conjugate symmetry properties of the Fourier transform.
The origin of the spectrum is often shifted to the center for display & filtering purposes. This shifting is done by using a property of the Fourier transform called the frequency translation property by multiply the original image I(r,c) by (-1)r+c before we perform the transformation.
Human Visual System give more responds to brightness. So we need to log-remapped the original image which has been shifted to the center by using this formula.:-
– log(u,v) = k log [ 1+|F(u,v)| ]
4
(a) FOURIER TRANSFORM IMPLIED SYMMETRY
The advantage of this formula is:
(a) It will compress the data into lower range
(b) It will remap the dynamic range of the Fourier spectrum which is greater than 256 gray levels (8 bits) into the 0-255 range, k will control the range.
Example: (k=4)
300 -400 = 4 log [ 1 + | -300 | ]
250 320 = 4 log [ 1 + 300 ]
F(u,v) = 4 log 301
= 4(2.4786)
= 9.91
5
(b) COSINE TRANSFORM IMPLIED SYMMETRY
The spectrum is folded about the origin, creating a 2Nx2N pattern.
The frequency increases from the origin outward & thus we do not have to shift it to the center (half of the frequency information will lost if we do so).
The Walsh-Hadamard Transform also exhibit increasing sequency from the origin outward.
6
FILTERING METHODS
7
LOWPASS FILTER
Tend to visually blur images, considered an enhancement because it imparts a softer effect to the image.
Pass low frequencies & attenuate/eliminate the high frequency information.
Used for image compression or for hiding effects caused by noise.
Using the below equation:
I(r,c) = T-1 [ T(u,v) H(u,v) ] I (r,c) = The filtering image
T(u,v) = The transform
H(u,v) = The filter function
8
IDEAL LOWPASS FILTER
It is called ideal because the transition from the passband to the stopband in the filter is perfect (it goes from 0 to 1 instantly). H(u,v) only have the value 1’s and 0’s.
The frequency at which we start to eliminate the information is called the cutoff frequency.
The frequencies in the spectrum that are not filtered out are in the passband while the spectral components that do get filtered out are in the stopband.
However, ideal filter leaves undesirable artifacts in images. This artifact appears in the lowpass filtered image as
ripples/waves, wherever there is a boundary in the image. This problem can be avoided by using a “nonideal filter” which
does not have perfect transition.
9
NONIDEAL LOWPASS FILTER
To overcome the problems in ideal filter. Makes the image become smoother. One of the nonideal types is called the Butterworth Filter. With this, the order of the filter can be specified which
determines how steep the slope is in the transition of the filter function.
Higher order to the filter create steeper slope & the closer we get to an ideal filter.
10
HIGHPASS FILTER
Passes only high frequency information corresponding to places where gray levels are changing rapidly.
Used for edge enhancement. The function for a special type of highpass filter, called a high-
frequency emphasis filter, is to retain some of the low frequency information by adding an offset value to the function, so we do not lose the overall image info.
The contrast will be added back to the image after using the high-frequency emphasis filter.
Greater offset will give a sharper image.
11
BANDPASS, BANDREJECT & NOTCH FILTER Bandpass & Bandreject are specified by two cutoff
frequencies, low cutoff & high cut off frequencies. These filters can be modified into nonideal filters by making the
transitions gradual (steeper slope) at the cutoff frequencies. A special form of these filters is called a notch filter because it
only notches out or passes specific frequencies. These 3 types of filters are used in image restoration,
enhancement & compression. The example of these 3 filters can be referred to page 124 in the
text book.
12
WAVELET TRANSFORM
13
WHAT IS WAVELET TRANSFORM ?
The most common model for a wavelet transform uses the Fourier transform and highpass and lowpass filters.
Wavelet Transform contain both spatial and frequency information.
A transformation of an image which has its basis functions shifted and expanded
The filters must be perfect resolution filters (distortion that exist would be canceled in the inverse transform) in order to satisfy the conditions of the wavelet transform.
14
WHY WAVELET ?
The Wavelet Transform is sufficient for most practical
applications and for reconstruction of the signal. The Wavelet Transform provides enough information, and offers
an enormous reduction in the computation time. The Wavelet Transform is considerably easier to implement
when compared to the continuous wavelet transform.
15
WHEN TO USE WAVELET ?
We can use Wavelet Transform for image compression when
we want to conserve time and space when handling large
images.
16
HOW DOES WAVELET WORK ? The Wavelet Transform breaks an image into four subsampled
images. Subsampled by keeping every other pixel. Results in an image which has been highpass filtered both
vertically and horizontally, one that has bees lowpass both vertically and horizontally, one which has bee highpass on the vertical side and lowpass on the horizontal side and one that has been lowpass on the vertical side and highpass on the horizontal side
Transform implemented in the spatial domain using 1-D convolution filters.
Circular convolution is a special type of convolution used in order to perform wavelet transformation
17
CIRCULAR CONVOLUTION
Take the underlying image array and extend it in a periodic manner to match the symmetry implied by the discrete Fourier transform.
Convolution starts with the origin of the image and the mask aligned so that the first value contains contributions from the “previous” copy of the extended image.
Last value contains contributions from “next” copy of the extended, periodic image.
18
X X X
X X X
X X X
a. Extended, periodic image (x = origin)
19
b. Extended, periodic 1-D convolution filter (x = origin)
One period
Center of filter
20
Previous
period
Period
Of interest
Next
period
c. With circular convolution, the outer rows and columns include products of both previous and next
periods.
X
21
WAVELET USING HAAR FILTERS
Example:
Lowpass: 1/√2 [X1 X2]
Highpass: 1/√2 [X1 -X2] To use the Haar Basis vector to implement the wavelet
transform, it must be zero padded to the same size as the subimage (in this case four).
The origin of the basis vector is define in the center, corresponding to the value to the right of the center
22
Form the example above if we want to implement the Haar basis vector we have to zero pads the vectors to have a length of four.
Lowpass: 1/√2 [X1 X2 0 0]
Highpass: 1/√2 [X1 -X2 0 0]
Origin Take note that after the vector has been zero-padded on the right the
origin is no longer to the right of the center. The origin is determined before zero padding.
23
WAVELET USING DAUBECHIES FILTER
An example of Daubechies basis vectors :
LOWPASS : 1/4√2[ 1+√3, 3+√3, 3-√3, 1-√3]
HIGHPASS : 1/4√2[ 1-√3, √3-3, 3+√3, -1-√3]
24
The basis vector has to be zero padded to be the same size as the sub image.
If an image is divided into 8 X 8 blocks :
LOWPASS : 1/4√2[ 1+√3, 3+√3, 3-√3, 1-√3, 0, 0, 0, 0]
HIGHPASS : 1/4√2[ 1-√3, √3-3, 3+√3, -1-√3, 0, 0, 0, 0]
ORIGIN
25
Because these are assumed circular convolution, we could zero pad equally on both ends.
LOWPASS : 1/4√2[0, 0, 1+√3, 3+√3, 3-√3, 1-√3, 0, 0]
HIGHPASS : 1/4√2[0, 0, 1-√3, √3-3, 3+√3, -1-√3, 0, 0]
ORIGIN