Description
Semester 1, AY2020/21
A. Feature Measurement (10 marks)
1. The test image is test1.bmp (image I).
2. Input image is I. Implement the intermeans algorithm to calculate the threshold π1 and use it to threshold I. The output image is I1. [intermeans.m]
3. Input image is I1. Calculate these features: perimeter, area, compactness, centroid, invariant moment π1. [features.m].
4. Note that:
(a) You can check your implementation intermeans.m by testing it on image βletter.bmpβ. The calculated threshold value should be 87.
(b) Perimeter and area β calculate using the method given in the notes or employ some other method that gives more accurate results.
(c) Centroid β calculate from the moment values. Take the image origin to be at the bottom left corner, with the x axis pointing to the right.
B. Feature Invariance (10 marks)
1. The test image is test2.bmp (image J).
2. What do you think is the optimum threshold ππππ‘ for segmenting the object accurately?
3. Obtain the intermeans threshold π2 using intermeans.m.
4. Threshold J using π2 and measure the features using features.m.
5. Threshold J with threshold ππππ‘ and measure the features using features.m.
6. Compare the segmentation results obtained with π2 and ππππ‘. Discuss the sensitivity of the measured feature values to the threshold values.
C Boundary Plot (5 marks)
1. Input image is the boundary image test3.bmp (image K).
2. Calculate the πβπ values and plot the graph. [rtheta.m]
D. Matlab Code
1. The same Matlab code is to be used for Sections A and B.
3. Follow the templates below to write your code as functions.
intermeans.m
% To calculate the intermeans threshold;
% input is the gray level image βtest1.bmpβ
% output is the threshold value T and the binary thresholded image Iout.
function [T,Iout] = intermeans(Iin)
%
% put your code here
% end
features.m
% To compute the features;
% input is the binary thresholded image
% outputs are the feature values
function [P, A, C, xbar, ybar, phione] = features(Iin)
%
% put your code here
% end
rtheta.m
% To compute the r-theta plot;
% input is a boundary image βtest3.bmpβ
% output is the array containing the r-theta value
function [r, theta] = rtheta(Iin)
%
% put your code here
% end
4. In addition to the above, you will also have to provide scripts to test your functions. run_A.m
%%%%% Section A %%%%%
% This m file is used to test your code for Section A
% Ensure that when you run this script file, the output images are generated and displayed correctly
%— 1. Display the thresholded image and the threshold
I = imread(‘./test1.bmp’); [T, IT] = intermeans(I); imshow(IT) % display image IT
output = T % display the intermeans threshold
%— 2. Display the measured feature values
[P, A, C, xbar, ybar, phione] = features(IT)
run_B.m
%%%%% Section B %%%%%
% This m file is used to test your code for Section B
% Ensure that when you run this script file, the output images are generated and displayed correctly
%— 1.
I = imread(‘./test2.bmp’); [T, IT] = intermeans(I); imshow(IT) % display image IT
output = T % display the intermeans threshold
%— 2
% display the measured feature values
[P, A, C, xbar, ybar, phione] = features(IT)
%— 3
Iopt = I >= Topt; % threshold J with Topt imshow(Iopt) % display image Iopt % display the measured feature values
[P, A, C, xbar, ybar, phione] = features(Iopt)
run_C.m
%%%%% Section C %%%%%
% This m file is used to test your code for Section C
% Ensure that when you run this script file, the r-theta plot
is displayed correctly
%— 1.
I = imread(‘./test3.bmp’);
[r, theta] = rtheta(I); % calculate r and theta % plot r-theta graph
E Report
1. Your report should focus on the results, observations, explanations and discussion. Relevant images should be included.
2. If you use any algorithms that are not from the lecture, you should explain how they work.
5. The file is to be named as follows:
matric number_full name.zip (e.g., A010134J_Tan_Shu_King.zip).
Reviews
There are no reviews yet.