R7020E Lab1
R7020E Lab1
Prerequisites: The students should have a good background in the following areas:
Theoretical: Topics from Lectures 2-4 and related ’Further Reading’ book material
Practical: Matlab Image processing toolbox: https: // www. mathworks. com/ help/ images/
Practical: Peter Corke Machine Vision Toolbox: https: // petercorke. com/ toolboxes/ machine-vision-toolbox/
Lab Supplementary material: This lab is accompanied with the supplementary material to
support the assignments
1. Download lab1.zip file from Canvas and unzip it. The folder names correspond to the number
of each Task.
Lab Examination: There will be 1 to 1 discussions for each assignment on a specified time slot
where the students will provide substantial comments on their solutions and results. Moreover, the
students should upload their code solutions in Canvas.
2 Assignments
Task 1 (Getting familiar with images and processing tools) In this task you should load,
visualize and process images using predefined functions (Figure 1).
Given
• ’Barbara’ image in two formats (.mat and .png).
ToDo
• Load and visualize ’Barbara’image using 3 different ways 1).mat file, 2) .png file with Image
Processing Toolbox from Matlab, 3) .png file with Peter Corke toolbox in Matlab.
• Convert to grayscale.
• Check image size, number of channels, and convert between classes e.g. double to uint8 and
vice versa.
• Modify brightness and visualize their respective image histograms of the grayscale image in
its original size.
• Investigate other functions in matlab related to filtering, binarization, edge detection (e.g.
’fspecial’, ’imfilter’, ’imerode’, ’imadjust’, ’imhist’, ’histeq’, ’edge’, ’im2bw’, . . . )
Task 2 (Image Restoration - Noise Filtering) In this task you will be using filtering kernels
for noisy image restoration (Figure 2).
Figure 2: Original flower image that will be used for the noise restoration task
Given
• Image flower.mat
ToDo
• Corrupt image with Gaussian noise of zero mean and such variance, where the noisy image
to have 20dB Signal to Noise Ratio. Apply moving average and median filter to remove the
noise from the image.
• Corrupt image with salt and pepper noise of 20%. Apply moving average and median filter
to remove the noise from the image.
• Corrupt the image with Gaussian noise of zero mean and such variance, where the noisy
image to have 20dB Signal to Noise Ratio, followed by salt and pepper noise of 20%. Try
to restore image with a) moving average filter, b) median filter, c) sequential use of moving
average and median filter, based on your preferred order.
In all cases comment your findings.
Task 3 (Edge Detection) In this task, you will find the edges of an image (Figure 3).
Figure 3: Original clock image that will be used for the edge detection task
Given
• Image clock.
ToDo
• Use 3 different edge detection kernels (masks) and report your findings.
• Convert the resulting edge images to binary images using global thresholding method. Visu-
alize the results and comment on the threshold value selection.
Given
• Hint: Could you apply any morphological operation at some point of the processing pipeline?
ToDo
• Use the normalized correlation coefficient for similarity measure and visualize the location of
the template.