Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Digital Image Processing (CS -306)

Assignment # II-01
Topic Noise Reduction

Course Instructor: Dr. Syed M. Adnan


Total Marks: 20
Issue Date:
Submission Date: 26-06-2020

Registration# Name
Submitted by: 17-CS-48 Abdul Basit Anwar

Obtained Marks:

Department of Computer Science, University of Engineering


and Technology (UET) Taxila
Digital Image Processing (CS -306)
Q. No. 1:

How can you defend this statement that circularly symmetric filter gives more smooth effect then
box averaging filter?

Answer :

Gaussian filters (circularly symmetric filter) weigh pixels a bell-curve around the center pixel.
This means that farther pixels get lower weights.
Mean-filter known as box-filter, just average the pixel values of all neighboring pixels. This is
equivalent to giving an equal weight to all pixels around the center regardless of the distance
from the center pixel.
Box-filters can be calculated faster than Gaussian filter (circularly symmetric filter).

Q. No. 2:

i. Load a good quality image of your choice. Add some noise in it using some scaling factor
Sigma.
ii. Display the noisy image.
iii. Create a Gaussian filter using fspecial function
iv. Apply your filter to remove noise from that particular noisy image.
v. Try out different parameters/values for noise generation and smooth effect.

Specifications:

a. You are required to upload your Matlab code file with comments for each step of coding.
b. Also provide MS Word file of your code and its output like noisy and smooth images
should be pasted. Use Font style “Calibri Light” for it, font size 10 or lower but must be
readable.

Department of Computer Science, University of Engineering


and Technology (UET) Taxila
Digital Image Processing (CS -306)
Answer:

Original Image

% reading original image


I = imread('fruits.jpg');
% setting value of sigma
filter_sigma = 0.50;
% adding noise to image
J = imnoise(I,'gaussian', filter_sigma);
% showing noisy image
imshow(J)

noisy image

Department of Computer Science, University of Engineering


and Technology (UET) Taxila
Digital Image Processing (CS -306)
% reading noisy image
im = imread('noisy.jpg');
% applying fspecial function
h=fspecial('gaussian',13,.9);
% creating filter
s=imfilter(im,h,'conv');
% output of noisy image
subplot(1,2,1),imshow(im)
% output of image after removing noise
subplot(1,2,2),imshow(s)

Noisy and Smooth Image

Department of Computer Science, University of Engineering


and Technology (UET) Taxila
Digital Image Processing (CS -306)

Changing Values of Variables

% reading original image


I = imread('fruits.jpg');
% setting value of sigma
filter_sigma = 0.60;
% adding noise to image
J = imnoise(I,'gaussian', filter_sigma);
% showing noisy image
imshow(J)

Changing Sigma Value

% reading noisy image


im = imread('changingSigmaValues.jpg');
% applying fspecial function
h=fspecial('gaussian',15,.8);
% creating filter
s=imfilter(im,h,'conv');
% output of noisy image
subplot(1,2,1),imshow(im)
% output of image after removing noise
subplot(1,2,2),imshow(s)

Department of Computer Science, University of Engineering


and Technology (UET) Taxila
Digital Image Processing (CS -306)

Changing values of filter for removing noise

Department of Computer Science, University of Engineering


and Technology (UET) Taxila

You might also like