Lab 3 - Instructions
Lab 3 - Instructions
Lab 3 - Instructions
2. Low pass filters and image denoising. Load image “brain_pet.tif” into variable brain
and display. You can observe that the image is noisy. In this exercise we will compare
different denoising filters.
a. Use command fspecial to create three different denoising filters. Check help to
create these filters with size 3 × 3:
• arithmetic averaging filter
• weighted averaging filter – Gaussian, stdev=1
• weighted averaging filter – Gaussian, stdev=0.5
Display these filters in one figure using subplot, setting intensity range to
[0,0.5]. Can you predict which filter will be most effective in reducing noise and
which will result in most blurring?
b. Blur the image brain with the kernels from the previous exercise using
command imfilter. Additionally, also apply median filter using Matlab function
medfilt2. Which filter was most effective in reducing noise and preserving
edges?
b. Calculate gradient magnitude given by equation 𝑀 = √𝑔𝑥2 + 𝑔𝑦2 and display. Does
it highlight well the edges in the image?
c. Create the Laplacian filter using command
l = fspecial('laplacian');
To check which type of the Laplacian filter Matlab created, write on command
line l*6. Is the central value of the filter positive or negative?
d. Filter the brain using l. To produce sharpening effect, enhance the image by
taking away the result of Laplacian filtering from the original image (remember
from the lecture that if the central point of the Laplacian filter is negative, we
need to take away the result of Laplacian filtering, rather than add). Display the
original image, the result of Laplacian filtering and the enhanced image in one
figure. Set the intensity range for the enhanced image to [0,255] (this is because
there are negative values). What can you say about this enhancement?
e. Now instead of enhancing the original image, enhance the image blurred by
Gaussian with standard deviation 1, that you created in question (2b). Display
the original image, the blurred image, and the sharpened blurred image. Did we
manage to reduce blurring while preserving the denoising effect of Gaussian
filter? Note: Laplacian of Gaussian is a commonly used filter for estimation of
Laplacian while avoiding noise enhancement.
f. Another type of image sharpening method is called unsharp masking. It is
performed in three steps:
• blur the image 𝑓 to obtain 𝑓 ̅
• subtract the blurred image from original to obtain the mask
𝑔mask = 𝑓 − 𝑓 ̅
• add the mask to the original image to create the enhanced image
𝑔 = 𝑓 + 𝑔mask
Compare unsharp masking to enhancing using Laplacian operator. Which one
has more noise enhancing effect?