DIGITAL IMAGE PROCESSING – ASSIGNMENT NO 2
SUBMITTED BY: WARDAH SALEEM
ROLL NO: F-101032
SUBMITTED TO: ENGR SOBIA YOUSAF
Problem No. 1: [CLO 2, C-5]
Noise Reduction:
a) Display the image attached. Filter the images using the MATLAB function 'conv2' and
masks of all ones of size 2x2 and 3x3, and print/submit. How does the size of the mask
affect blurring and noise reduction? Which do you think provides a better tradeoff
between blurring and noise reduction for this image?
Code:
Output:
Answer:
Larger the mask we use, the more noise reduction we obtain and it also increases
the blur effect on the edges of the image. So, 3*3 mask is better than 2*2 mask to reduce
noise reduction. It reduces more noise than 2*2 masks and gives clear visibility but it also
increases the blurring effect on the edges as compare to small mask i.e. (2*2) as shown
on the above figure.
b) "Sharpen" the 3x3 blurred image by convolving with the Laplacian mask
Display and submit. Does this operation reduce the blurring? What about the
original noise? You might need to rescale this image after convolving to make the
effect more visible and to make the contrast more pleasing.
Code:
Output:
Answer:
Laplacian filter is applied to emphasis the edges in the image. When we apply
composite Laplacian filter to sharpen the image it increases the noise as well as it blurs
the image.
So, that we have to rescale the image for better visibility. Thus, rescaled image shows
better visual and also reduces the blurring effect than the original filtered image.
c) Apply a second sharpening step as in (b). Display and submit. Would repeated
sharpening help image interpretation? Again, rescaling will be needed to see the
effect
Code:
Output:
Answer:
No, repeated sharpening increases the blurring effect as well as noise on the image. And
also rescaling of repeated sharpen image has no effect on the image. It remains same.
Problem No. 2: [CLO 2, C-5]
Image Enhancement:
a) Read the image file taken on a bright sunny day. Enhance the image, increase the
contrast and the brightness of the dark areas, and reduce the brightness of the
sunny areas.
Code:
Output:
Problem No. 3: [CLO 2, C-5]
Intensity level reduction:
b) Write a computer program capable of reducing the number of intensity levels in an
image from 256 to 2, in integer powers of 2. The desired number of intensity levels
needs to be a variable input to your program.
Code:
Output: