blob: 9eac35228d1961a47b28ead64578e9774ae05fd6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
clc;
close;
//Given image matrix is F
F = [1 2; 5 4]
//Threshold value(Thresh) = 3
Thresh = [2 2; 2 1];
//Thresholded Image after applying Threshold
for i = 1:4
if (F(i)>=Thresh(i)) then //If the pixel value is >= Threshold , the output is 1
F(i) = 1;
else
F(i) = 0; //If the pixel value is not >= Threshold , the output is 0
end
end
disp(F,'F = ','The Output ')//The output after thresholding
|