LAB-2
2D LINEAR SYSTEMS
In this exercise, we will focus on the implementation of 2D linear systems. In J-DSP, 2D linear systems can be specified in two ways: First, by 2D Filter block that implements the 2D convolution sum (Fig. 1(a)), and second, by 2D FastFilter block that implements FFT-based fast convolution using the overlap-add method (Fig. 1(b)).
Fig. 1(a) 2D Filter block Fig. 1(b) 2D FastFilter block
Fig. 2 shows the 2D J-DSP editor. In fig. 2, the 2D blocks that are placed in the vertical line on the left hand side are called permanent blocks and are shown in green color. The blocks placed in the horizontal line are shown in yellow color and can be changed by selecting one of the options given in the drop-down menu on the top left corner of the screen. It is always recommended to use any 2D block separately before it is connected with others and to read the [Help] screen of every new block you use.
Fig.2 2D J-DSP.
Two-dimensional linear finite impulse response (FIR) digital filters are linear, shift-invariant two-dimensional systems, whose regions of supports are finite. The direct implementation of a 2D FIR filter is very easy and can be performed using a 2D convolution sum. Any 2D FIR filter can also be implemented by using a 2D FFT algorithm as shown below in Equation (1). The overlap-add and overlap-save methods are FFT-based methods and can be used to perform the filtering operation. In some cases, these methods reduce the number of arithmetic operations significantly, relative to realization by direct convolution.
(1)
** is for 2D convolution.
In Equation (1), is the output of the
system.
is the input to the
system and
is the impulse
response of the system.
The corresponding capital letters show the 2D signals in frequency-domain.
Note: Give reasons for all the answers to the questions, and where necessary, give appropriate J-DSP plots (Time/Frequency-domain) in order to justify your answers. You may need to use other 2D blocks as well.
Problem 2.1
Given the following 2D sequences,
x(n1,n2) =
h(n1,n2) =
Evaluate x(n1,n2) ** h(n1 -
1,n2 + 1), where ( **
) denotes 2D convolution.
a)
What is the region of
support (ROS) of the output signal?
b)
Is the output of this
2D convolution separable?
c)
What are the benefits
of designing separable linear shift-invariant (LSI) systems?
Your system should look as shown in Fig. 3.
Fig.3
Problem 2.2
Use 2D J-DSP to compute the 2D
convolution of the two 2D signals using DFT method. Choose (4*4)-point DFT
size. The two signals to be convolved are as follows:
x(n1,n2) =
y(n1,n2)
= 1.0 ; 0 £ n1, n2
£
2
Note: You have to use FFT and IFFT blocks in order to do
FFT-based fast convolution.
Problem 2.2.1
Use 2D Filter block in order to convolve the same two signals as in problem 2.2.
a)
Are the results of
the two systems equal?
b)
Which system results
in a circular convolution?
c)
What changes need to
be made in order to avoid the circular convolution?
Problem 2.3
Now connect the 2D blocks as shown in the Fig. 4.
Fig. 4
In the 2D FIR Coeff
block, set the values of the impulse response of the system as follows:
h(n1,n2) = 0.1111 ; -1 £ n1, n2 £ 1
In the 2D Images
block, select “Cameraman” as an input to the system.
a)
What happens to the
image, when it’s passed through the filter?
b)
What kind of
filtering effect has the system on the input image?
i.
LPF
ii.
HPF
iii.
BPF
iv.
BSF
Problem 2.4
Now change the impulse response of the system as follows:
h(n1,n2) =
The
encircled value is at the origin (0,0).
a)
What happens to the
image, when it’s passed through the filter?
b)
What kind of
filtering effect has the system on the input image?
i.
LPF
ii.
HPF
iii.
BPF
iv.
BSF
Problem 2.4.1
Use the same impulse response as in problem 2.4 and change the value at: h(0,0) = -9, -8, -7
a)
Did you observe any
change at the output-image when changing the value from –9 to
–7?
Hint: Take a closer look at the coefficients of the impulse response of the 2D FIR filters.
Problem 2.5
In the 2D Images block, select “Lena” as an input to the system. Insert Guassian noise of density=0.08.
Use the following 2D convolution kernels in the 2D FIR Coeff block.
1. h(n1,n2) = 0.1111 ; -1 £ n1, n2 £ 1
2. h(n1,n2) = 0.0204 ; -3 £ n1, n2 £ 3
a) What happens when the kernel is too small?
b) What happens when the kernel is too large?
Note: In order to see the noisy image, you need to connect the 2D Image block with the 2D Plot block directly or select the “impulse” as an impulse response in the 2D FIR Coeff block to see the noisy image. At this point, you cannot see the noisy image in the 2D Image block itself.
Problem 2.6
Answer the following general questions.
Note: No plots are required. State answers clearly.
a)
Give equivalent block
diagram of the system shown below (without convolving h with g).
b)
Two 2D sequences,
each of which is 5*6 points in extent, are circularly convolved using
(8*8)-point DFT. Which samples of the (8*8)-point output array are identical to
the samples of the linear convolution of the two input arrays, and which are
different.
c)
What happens when a
blurred image is subtracted from the original image?
d)
Below are the three
impulse responses of the 2D casual systems. The lower left corner is at the
origin.i.e., h(0,0).
0 |
-1 |
0 |
-1 |
5 |
-1 |
0 |
-1 |
0 |
(1)
1 |
-2 |
1 |
-2 |
5 |
-2 |
1 |
-2 |
1 |
(2)
-1/7 |
-2/7 |
-1/7 |
-2/7 |
19/7 |
-2/7 |
-1/7 |
-2/7 |
-1/7 |
(3)
i.
What type of
filters/systems are these?
ii.
One characteristic of
all these filters/systems is that the sum of all the amplitudes of each impulse
response is one. Does this have anything to do with the intensity of the input
signal/image?
Hint: Take a closer look at the numerical values of the frequency response of the 2D FIR filters. Frequency response is the Fourier transform of the impulse response of the system.
e)
If you need to reduce
the random noise in a signal, which impulse response would you use, the one in problem 2.3 or the one in problem 2.4?
If you need to sharpen edges, which one would you use?