

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


a) Write a MATLAB function โmy2DConvolutionโ for convolving a given grayscale image I with
a 2D convolution mask M. Your function should take care of the image boundary by mirroring the
image content appropriately. You cannot use the built in MATLAB functions like conv or conv2.
b) Convolve the given image using your function above with a 3x3 Gaussian mask.
You can blur an image using a filter โBโ and find ๐
๐ฆ
of an image using the filter โGโ, where โBโ and
โGโ are given as follows:
a) Are the above operations linear? If so, why?
b) You are asked to apply B to an image to generate a blurred image and then apply G to the
result to find the gradient of the blurred image. How would the output change if you apply G
first and then B?
c) If you are asked to apply one single filter S, instead of two filters in succession, how would
you find S?
a) Write a function โmy2DGaussian(S)โ to generate a 2D symmetric Gaussian blurring mask of a
given size โSโ. You should appropriately normalize the mask before returning it to the user.
b) Using the function in Q.1. (a) and the filter in Q.3.(a) above, convolve the given image
โpattern.tifโ with the following mask sizes: 9 ร 9 , 11 ร 11 , and 13 ร 13. Display the original
image and all the blurred images in juxtaposition.
c) Give your analysis of the results in (b).
a) Refer to figure 3.10(a) in your book. Using the coordinates (๐
1
1
) = ( 100 , 50 ) and (๐
2
2
( 200 , 230 ), give expression for the piecewise linear transform ๐(๐) to stretch the contrast of a
given grayscale image.
b) Write a MATLAB script to adjust contrast of the given image โpollen.pngโ using the above
transformation.
c) Now use (๐ 1
1
๐๐๐
, 0 ) and (๐
2
2
๐๐๐ฅ
, 255 ) to stretch contrast of the image.
d) Lastly, use histogram equalization to reset the contrast.
e) Show the results, i.e. the original image and the three contrast adjusted images in juxtaposition
and comment on your results.
a) Write a MATLAB function โshowImageBitPlanes()โ that would take an 8 - bit grayscale image
along with the optional argument to show some specific bit-planes of the given image. If no
argument is specified, the function should return all bit-planes. Note: You are required to write
transformation relations of the bit-planes using the sample template โtemplateBitPlanes.mโ.
b) Using only the two and four most significant bit-planes respectively, reconstruct the given
image โdollar.tifโ and save it as โreconstructedDollar 2 .tifโ and โreconstructedDollar 4 .tifโ.
c) Display both the original and the reconstructed images in a single figure window.
d) Given the original and the reconstructed image above, compute the mean squared error (MSE)
and the peak signal-to-noise ratio (PSNR) using the following formulae:
2
๐
๐= 1
๐
๐= 1
10
2
Using the provided image โmoon.tifโ, do the following:
i) Compute the Laplacian of the image with 90 - deg and 45 - deg isotropic filters and display the
results with proper scaling.
ii) Sharpen the original image by using the outputs of part (i) above.
iii) Display the original as well as the sharpened images from part (ii) and comment on your
results.
Note: Submit your homework as a zip file at course email by the due date.
Don't forget to include the code as attachment.