CSC566-Assignment 2 (Testing)
CSC566-Assignment 2 (Testing)
ASSIGNMENT 2 (10%)
MORPHOLOGICAL AND IMAGE SEGMENTATION
INSTRUCTIONS
CSC566/November2022
UiTM Cawangan Melaka Kampus Jasin
QUESTION 1
Remove the noise from the input image. Submit your code and the output image. Provide reason of the
selected technique and write a conclusion based on the output obtained. The input image is Q4_1
ANSWER
QUESTION 1
Input Image
Output Image
CSC566/November2022
UiTM Cawangan Melaka Kampus Jasin
Source Code
i = imread('Q4_1.tif');
h = ones(5,5) / 25;
I2 = imfilter(I_noise,h);
figure
Justification of the Remove the noise by using multiplicative noise with variance var_speckle
selected method & because the noise components are multiplied to each pixel of the original
Conclusion image. It will adds multiplicative noise to the image I, using the equation J
= I+n*I, where n is uniformly distributed random noise with mean 0 and
variance v. Create a normalized, 5- by-5, averaging filter and apply the
averaging filter to the grayscale image using imfilter. Conclusion, the
noise of the input image be reduced by using this method.
CSC566/November2022
UiTM Cawangan Melaka Kampus Jasin
QUESTION 2
Extract the gradient parts from the input image. Provide reason of the selected technique and write a
conclusion based on the output obtained. The input image is Q4_2
ANSWER
QUESTION 2
Input Image
CSC566/November2022
UiTM Cawangan Melaka Kampus Jasin
Output Image
Source Code
I = imread('Q4_2.tif');
>> figure
Justification of the Extract the gradient parts by calculating gradient magnitude and gradient
selected method & direction using the prewitt gradient operator because it will compute an
Conclusion approximation of the gradient of the image intensity function. Conclusion,
the input of the image becomes more clear with the details of the image in
gdir(right) and gmag(left).
QUESTION 3
CSC566/November2022
UiTM Cawangan Melaka Kampus Jasin
Extract the rice objects from the input image. Provide reason of the selected technique and write a
conclusion based on the output obtained. The input image is Q4_3
ANSWER
QUESTION 3
Input Image
Output Image
CSC566/November2022
UiTM Cawangan Melaka Kampus Jasin
Source Code
I1 = imread('Q4_3.tif');
BW = imbinarize(I1,'adaptive');
imshow(BW);
Justification of the Extract the rice image by creating the binary image from the input image
selected method & using a locally adaptive thresholding method because it will select an
Conclusion individual threshold for each pixel based on the range of intensity values
in its local neighborhood. Conclusion, the output of the rice image
becomes clear and turn to black and white.
QUESTION 4
Separate the two types of blobs in the input image. Provide reason of the selected technique and write a
conclusion based on the output obtained. The input image is Q4_4
ANSWER
QUESTION 4
CSC566/November2022
UiTM Cawangan Melaka Kampus Jasin
Input Image
Output Image
xy =
21.1508 10.4221
12.2393 80.9709
5.4955 184.8318
7.1667 334.9634
17.6782 406.9789
CSC566/November2022
UiTM Cawangan Melaka Kampus Jasin
7.1829 470.9593
19.2874 587.4686
23.9588 250.9849
42.0399 528.0530
49.0371 339.0302
56.0440 119.9855
62.9657 209.0596
65.0179 478.0165
87.0398 32.0247
92.0603 267.0480
96.0878 595.9257
101.9144 410.0836
113.0454 170.0165
114.0075 527.9767
118.0628 96.9508
128.9815 327.9725
149.9684 446.0041
151.0124 571.9931
164.0116 255.9360
171.9685 165.9747
174.0124 63.9595
174.0620 5.9137
191.9759 387.0454
194.9876 513.0880
210.9966 451.9870
218.9822 106.0007
220.0543 306.9801
226.0240 176.9718
234.0233 559.0164
CSC566/November2022
UiTM Cawangan Melaka Kampus Jasin
240.9367 410.0282
242.0062 23.9848
241.9924 236.0385
270.0082 470.0055
273.0497 79.0228
276.0274 339.9280
282.0336 145.0075
285.0582 590.6650
313.9637 525.9542
313.9889 212.0232
299.9807 291.9904
312.9636 35.9938
327.9985 408.0171
344.9626 112.9871
367.0227 329.0197
375.9661 580.4443
391.0630 14.9044
394.9934 496.0606
419.0346 241.9849
430.0402 381.9651
434.0295 75.0313
452.0033 155.9909
459.0147 556.0341
478.0260 305.0192
485.9722 472.9932
497.9508 5.0181
513.0388 69.0232
529.0280 392.0050
531.0174 190.0010
CSC566/November2022
UiTM Cawangan Melaka Kampus Jasin
553.9601 272.0126
553.0391 586.1568
574.5797 124.9883
575.7310 515.9906
576.5914 25.4825
588.3305 367.9346
Justification of the Separate the two types of blobs in input image using regionprops method
selected method & properties Area and Centroid to get blobs because it will give the actual
Conclusion number of pixels in the region, returned as a scalar and center of mass of
the region. CSC566/November2022 UiTM Cawangan Melaka Kampus
Jasin Extract the small blobs and larger blobs using ismember(A,B)
because conjunction with regionprops for selecting regions based on
certain criteria. Conclusion, the output of the image is smallBlobs and
largeBlobs and the regionprops method is useful to get blobs.
CSC566/November2022
UiTM Cawangan Melaka Kampus Jasin