You are on page 1of 3

National University

of Computer & Emerging Sciences-Islamabad


Chiniot-Faisalabad Campus

Dr. Hashim Yasin


Department of Computer Science.

EE402 – Digital Image Processing


Assignment No. 2
Roll No: _____________Name: ________________________________Section: _____________

Instructions:

1. Submit your assignment in soft form as well as in hard form (Report) within due date and
time. Soft form does not mean the photos of the hardcopy. Late submission will result in
deduction of marks.
2. Mention your names and roll numbers clearly on your document.
3. Name your zip or other folder/file that you want to submit according to the following
format: DIP_A2_RollNo_FirstName
4. Try to solve the each task of the assignment by your own.
5. No excuse or resubmission is permissible.
6. Do your assignment in group of maximum two members.
7. There is no any restriction of the language for the programming tasks.
8. In programming tasks, you are NOT allowed to use any built-in function of any library.

___________________________________________________________________

Question No. 1: Filters


Consider the image “White-Bars.png” where the white bars in the test pattern are
7 pixels wide and 210 pixels high. The separation between bars is 17 pixels. Write
a function where you implement the filters given below. What would this image
look like after application of these filters of sizes 3 × 3 and 5 × 5? Visualize the
resultant images and explain the results in detail as well.

(a) A geometric mean filter


(b) A harmonic mean filter
(c) A contraharmonic mean filter with 𝑄 = 1
(d) A contraharmonic mean filter with 𝑄 = −1
(e) Adaptive median filter
1
Question No. 2: Mean Filters
Consider the following images where left image is the result of using an arithmetic
mean filter of size 3 × 3 and the other image is the result of using a geometric mean
filter of the same size. Explain the followings:

(a) Why the image obtained with geometric mean filtering is less blurred.
(b) Why the black components in the right image are thicker.

Question No. 3: Derivative Filters

Create the matrices for the following convolution kernels according to the
mentioned size and visualize each of them in a separate figure,

(a) Gaussian of size 9 × 9 with 𝜎 = 3, 𝜎 = 4 and 𝜎 = 6,


(b) Derivative of Gaussian of size 3 × 3 along x-axis and y-axis,
(c) Laplacian of Gaussian (LoG) of size 3 × 3.

Question No. 4: Contraharmonic Filter

In case of contraharmonic filter,


(a) Explain why the filter is effective in elimination pepper noise when 𝑄 is
positive.
(b) Explain why the filter is effective in eliminating salt noise when 𝑄 is negative.

2
(c) Explain why the filter gives poor results when the wrong polarity is chosen
for 𝑄.
(d) Discuss the behavior of the filter when 𝑄 = −1
(e) Discuss (for positive and negative 𝑄) the behavior of the filter in areas of
constant intensity levels.

Question No. 5: Hessian Matrix

Consider the function 𝑓(𝑥1 , 𝑥2 , 𝑥3 ) = 𝑥14 + 𝑥1 𝑥2 𝑥3 + 2𝑥2 𝑥32 and compute the
followings:
𝜕𝑓
(a) Gradient vector ∇𝑓 = { }
𝜕𝑥𝑖
𝜕2 𝑓
(b) Hessian ∇2 𝑓 = { }
𝜕𝑥𝑖 𝑥𝑗
(c) Evaluate the gradient and the Hessian at point (2, 3, 1).

Question No. 6: Eigenvalues and Eigenvectors

1 2 2
Compute the eigenvalues and eigenvectors of matrix 𝐴 = {2 1 2}
2 2 1

You might also like