-
Notifications
You must be signed in to change notification settings - Fork 0
/
susan.m
66 lines (47 loc) · 1.41 KB
/
susan.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
function [ I ] = susan( I, percentage, threshold, d )
%I = imread('C:\\Users\\rramele\\Google Drive\\ATI.Image.Processing\\Imagenes\\Test.png');
%I = I(:,:,1);
%figure;
%imshow(I,[0 255]);
%percentage = 0.64;
%percentage = 0.40;
%threshold = 1;
%d = 0.01;
SUSAN = zeros(size(I,1),size(I,2));
%I( I == 0) = 1;
for i=1:size(I,1)
for j=1:size(I,2)
Patch = circularpatch(I,i-3:i+3,j-3:j+3);
C = zeros(size(Patch,1),size(Patch,2));
for ii=1:size(Patch,1)
for jj=1:size(Patch,2)
if (Patch(ii,jj)>=0)
% Marca los valores del parche circular
val = abs( I(i,j) - Patch(ii,jj) );
% Si la diferencia supera el umbral, lo marca en 1
if ( val < threshold )
C(ii,jj) = 1;
end
end
end
end
% Cada pixel acumula el grado de similitud, de homogeneidad
SUSAN(i,j) = 1-sum( C(:) )/(37.0);
end
end
%figure;
%imshow(SUSAN);
for i=1:size(I,1)
for j=1:size(I,2)
%if ( (SUSAN(i,j) < (percentage + d)) && (SUSAN(i,j)>(percentage-d)) )
if ( (percentage-d) < SUSAN(i,j) && SUSAN(i,j) < (percentage+d))
SUSAN2(i,j) = 255;
else
SUSAN2(i,j) = 0;
end
end
end
%figure;
%imshow(SUSAN2);
I = SUSAN2;
end