IIP Midterm Sol
IIP Midterm Sol
/EC/PE/2018-19/ODD/ECE4141/IIP
Ans: The frequency domain content is also rotated by an angle of ‘A’ (DFT property)
b) Given following 3 x 3 image (Fig. 1) which has 8 intensity levels in it. It is required to do
bit plane slicing of the given image. What is the 2nd bit plane of the image?
5 7 3
0 5 0
1 0 2
Fig. 1
Ans:
0 1 1
0 0 0
0 0 1
c) What is the storage space required to save 512 x 1024 image having 512 intensity levels.
d) If the pixel of an image are shuffled, then which of the following parameters may change?
i) Histogram ii) Mean
iii) Entropy iv) Covariance
Ans: Covariance
e) Small value of gamma (less than 1) will produce ____________ image. (darker/brighter)
Ans: brighter
Page 1 of 7
LNMIIT/B. Tech./EC/PE/2018-19/ODD/ECE4141/IIP
a) Let V = {0, 1}. Show the shortest 4-path, 8-path and m-path between ‘p’ and ‘q’ shown in
Fig. 2. Also find the chessboard distance and city-block distance between ‘p’ and ‘q’.
3 1 2 1 q
2 2 0 2
1 2 1 1
p 1 0 1 2
Fig. 2
Ans:
Fig. 1a
Chessboard distance : 3
City block distance : 6
Ans:
The input matrix ‘X’ will be formed by considering each row/column of the given
image.
Find the mean
Find covariance from the mean and the input matrix
Find the eigen values and corresponding eigen vectors from the covariance
The eigen vectors are arranged in the decreasing order of the eigen values.
A matrix ‘A’ of the eigen vectors are formed column wise in which the first column of
eigen vector corresponds to highest eigen value and then it is arranged in decreasing
order.
KLT formula:
The eigen vectors with highest value has the maximum information of the image. In ‘A’
matrix, we shall remove some insignificant eigen vectors at the end by making it 0. The
new matrix is ‘AT’
Page 2 of 7
LNMIIT/B. Tech./EC/PE/2018-19/ODD/ECE4141/IIP
c) Consider the histogram (2, 2, 4, 8, 16, 32, 64, 128), where the number of gray levels is 8.
What is the output of histogram equalization? Explain using result how histogram
equalization enhances the contrast of an image.
Ans:
Input No. of Output
PDF CDF
intensity pixels intensity
0 2 0.0078 0.0078 0
1 2 0.0078 0.0156 0
2 4 0.0156 0.0312 0
3 8 0.0313 0.0625 0
4 16 0.0625 0.1250 0
5 32 0.1250 0.2500 1
6 64 0.2500 0.5000 3
7 128 0.5000 1 7
Total: 256
140
120
100
no. of pixels
80
60 input
40 output
20
0
0 1 2 3 4 5 6 7
intensity values
Histogram equalization distributes pixel values throughout a range, thus, equalizing and
making the histogram more "normal" shaped. It transform the data/contrast level to spread
through the spectrum of 0-255 equally by using CDF. This process boost the lower contrast of
the darker region thus making parts of an image more 'visible'.
d) In the following image (Fig. 3), all pixels with value ‘1’
constitutes a region.
ii. Also show the different ‘m’ path possible between pixels
‘p’ and ‘q’.
Fig. 3
Page 3 of 7
LNMIIT/B. Tech./EC/PE/2018-19/ODD/ECE4141/IIP
Ans:
(i)
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0 1 0 0 0
0 0 1 1 1 0 0 0 0 1 1 1 0 0
0 1 1 1 1 1 0 0 1 1 1 1 1 0
0 1 1 1 1 0 0 0 1 1 1 1 0 0
0 1 1 1 0 0 0 0 1 1 1 0 0 0
0 1 0 1 0 0 0 0 1 0 1 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
(ii)
0 0 0 0 0 0 0
0 0 0 1 0 0 0
0 0 1 1 1 0 0
0 1 1 1 1 1 0
0 1 1 1 1 0 0
0 1 1 1 0 0 0
0 1 0 1 0 0 0
0 0 0 0 0 0 0
Page 4 of 7
LNMIIT/B. Tech./EC/PE/2018-19/ODD/ECE4141/IIP
Ans:
i) Steps:
Blur the image (done by median filter)
0 3 3 0
3 4 4 3
2 3 3 2
0 1 2 0
16 5 5 10
9 2 2 1
0 7 5 4
4 9 0 4
0 -1 0
-1 6 -1
0 -1 0
b) Perform the intensity level slicing on the following 3 bit image (Fig. 5). Let 𝑟1 = 3, 𝑟2 = 5
and 𝑠 = 7, where 𝑟1 and 𝑟2 are the input intensities and s is the output intensity for input
between 𝑟1 and 𝑟2. Obtain the image:
Page 5 of 7
LNMIIT/B. Tech./EC/PE/2018-19/ODD/ECE4141/IIP
Ans:
Output image:
Output image:
2 1 2 2 1
0 0 0 0 0 2 7 7 7 2
0 7 7 7 0 6 2 7 6 0
0 0 0 0 0 2 6 6 7 1
0 0 0 7 0 0 7 2 2 1
0 7 0 0 0
0 1 3 1
1 2 3 2
3 3 2 3
1 2 3 2
Fig. 6
Ans:
First we perform the 1D DFT on the rows: (you may also start with column first)
Page 6 of 7
LNMIIT/B. Tech./EC/PE/2018-19/ODD/ECE4141/IIP
Page 7 of 7