You are on page 1of 6

A.D.

PATEL INSTITUTE OF TECHNOLOGY


FIRST MID SEMESTER EXAMINATION
FUNDAMENTALS OF IMAGE PROCESSING (2181102)
FINAL YEAR ELECTIVE (EC)
Date: 2/03/2019 Time: 1:00 pm to 2:00 pm Total Marks: 20
Note: Assume suitable data wherever necessary and mention them clearly.

Solution
Q:1 Answer the following questions. [5]
[A]
1. Define m-adjacency between pixels.
Two pixels p and q with values from V are m – adjacent if
1) q is in N4(p) or
2) q is in ND(p) and the set N4(p) ∩ N4(q) has no pixels whose values are
from V.

2. Explain city block distance with example.


The distance between the 4-neighbors whose values are from V is
D4 = | x-s | + | y-t |

3. Define the term contrast stretching.


Contrast stretching is a process that expands the range of intensity levels in an
image so that it spans the full intensity range of the recording medium or display
device.

4. What is un-sharp masking?


It is a process of subtracting an unsharp (smoothed) image from the original image.
- Steps of unsharp masking:
1. blur the original image
2. subtract the blurred image from the original (the resulting difference
is called the mask)
3. add the mask to the original

5. State the advantages of DCT over DFT.


The DCT does a better job of concentrating energy into lower order coefficients
than does the DFT for image data.
The DCT is purely real, the DFT is complex.

Q:1 Consider the binary image (5 X 5) given in figure below. Show the result of 3 X 3 median [3]
[B] filtering.
11 11 11 11 11

Result of median filtering:


11 11 11 11 11

OR
Q:1 Apply the high pass filter on the image shown below using a 3 x 3 mask by assuming [3]
[B] replicate padding.
5 5 10 10
5 5 10 10
5 5 10 10
5 5 10 10
Assuming mask:
1 1 1
1 -8 1
1 1 1

Replicate padding:

5 5 5 10 10 10
5 5 5 10 10 10 0 15 -15 0
5 5 5 10 10 10 0 15 -15 0
5 5 5 10 10 10 0 15 -15 0
5 5 5 10 10 10 0 15 -15 0
5 5 5 10 10 10
Q:2 Answer the following questions: (Any THREE) [12]

[A] Apply histogram equalization and sketch the histograms of the original image and equalized
image.

Grey Level 0 1 2 3 4 5 6 7
No. of Pixels 0 0 50 60 50 20 10 0
Total Pixels = M x N = 190,
3 bits/pixel, L-1 = 7
Gray Number of CDF (Running Pr(rk) Sk = Rounded Ps(Sk)
level pixels sum) sk
(rk) (nk)

(k=0,1,2 ….L-1)
0 0 0 0 0 0 0
1 0 0 0 0 0 0
2 50 50 0.264 1.843 2 0.264
3 60 110 0.316 4.053 4 0.316
4 50 160 0.264 5.895 6 0.264
5 20 180 0.106 6.632 7 0.159
6 10 190 0.053 7 7
7 0 190 0 7 7

Histogram
Histogram
0.35

0.3

0.25

0.2
Input Histogram
0.15 #REF!

0.1

0.05

0
0 1 2 3 4 5 6 7

[B] In the image shown in figure compute D4, D8 and Dm distances between pixels p and q
for V= {1, 2, 5}. Assume each pixel placed at unique distance from its neighbor.

1 2 6 5 2 q
5 3 5 6 5
5 2 5 5 6
7 5 1 7 7
p 2 5 2 3 1
D4: Does not exist

1 2 6 5 2
5 3 5 6 5
5 2 5 5 6
7 5 1 7 7
2 5 2 3 1
D8: 5
1 2 6 5 2
5 3 5 6 5
5 2 5 5 6
7 5 1 7 7
2 5 2 3 1
Dm: 7

1 2 6 5 2
5 3 5 6 5
5 2 5 5 6
7 5 1 7 7
2 5 2 3 1
[C] What do you mean bit plane slicing? Explain in brief. Consider the image given below.
Obtain the new image if we set higher order two-bit planes to zero. Comment on the result.
12 13 14 15
4 5 6 7
8 9 10 11
0 1 3 2
- Instead of highlighting intensity level ranges, we could highlight the contribution
made to total image appearance by specific bits.
- Bit plane 1 contain lower order bits and bit plane 8 contain higher order bits.

Binary Image:
1100 1101 1110 1111
0100 0101 0110 0111
1000 1001 1010 1011
0000 0001 0011 0010

Higher order bit planes to zero:


00 01 10 11 0 1 2 3
00 01 10 11 0 1 2 3
00 01 10 11 0 1 2 3
00 01 11 10 0 1 3 2

Comments:
Histogram
4.5

3.5

2.5

1.5

0.5

0
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Original Histogram After Removing Higher Two bits

[D] Image is corrupted by salt and pepper noise. Explain suitable digital image processing
technique to remove salt and pepper noise from the image.

If the image is corrupted by Salt (Pixel value 255) and Pepper (Pixel value 0) noise, then
filtering can be done as follows.
1. Smoothing filters: Can be removed as a result of averaging.
2. Median filter: Will remove Salt and Pepper noise
3. Min filter: Will remove only Pepper noise
4. Max filter: Will remove only Salt noise

The filtering mainly used for removal of impulse noise or salt and pepper noise for
noise free images and fully recovered by minimum signal distortion also uncorrupted
the images. For best solutions of removal of salt and pepper noise is a
nonlinear digital filter which is based on order statistics of median filter.

Original Image:

10 0 7 3
255 45 67 33
170 10 42 4
0 255 80 0

Image after Replicate padding:

10 10 0 7 3 3
10 10 0 7 3 3
255 255 45 67 33 33
170 170 10 42 4 4
0 0 255 80 0 0
0 0 255 80 0 0

Image after Median filtering:

10 10 7 7
170 42 10 7
170 10 67 33
10 80 42 4
[E] Write a note on homomorphic filtering with the help of suitable derivations.
- The illumination – reflectance model can be used to develop a frequency domain
procedure for improving the appearance of an image by simultaneous intensity
range compression and contrast enhancement.
- f(x,y)=i(x,y) r(x,y)
- This equation can not be used directly to operate on the frequency components
of illumination and reflectance because the Fourier transform of a product is not
the product of the transform.
- L[f(x,y]≠ L[i(x,y)]L[r(x,y)]
- Suppose that we define,
- z(x,y) = ln f(x,y) = ln i(x,y) + ln r(x,y)
- L[z(x,y)] = L[ln f(x,y)] = L[ln i(x,y)] + L[ln r(x,y)]
- Z(u,v) = Fi(u,v) + Fr(u,v)
- Where Fi(u,v) and Fr(u,v) are the Fourier Transform of ln i(x,y) and ln r(x,y)
respectively.
- We can filter Z(u,v) using a filter H(u,v) so that
- S(u,v) = H(u,v) Z(u,v)
- S(u,v) = H(u,v) Fi(u,v) + H(u,v) Fr(u,v)
- The filtered image in the spatial domain is
- s(x,y)= L-1{S(u,v)}
- s(x,y)= L-1{H(u,v) Fi(u,v)} + L-1{H(u,v) Fr(u,v)}
- By defining
- i’(x,y) = L-1{H(u,v) Fi(u,v)}
- r’(x,y) = L-1{H(u,v) Fr(u,v)}
- So we can write, s(x,y) = i’(x,y) + r’(x,y)
- Finally, because z(x,y) was formed by taking the natural logarithm of the input
image, we reverse the process by taking the exponential of the filtered result to
form the output image.
- g(x,y) = es(x,y)
- g(x,y) = ei’(x,y) er’(x,y) =i0(x,y) r0(x,y)
- i0(x,y) and r0(x,y) are the illumination and reflectance components of the output
(processed) image.

------------- GOOD LUCK -------------

You might also like