-
Notifications
You must be signed in to change notification settings - Fork 0
/
neu_bwthin.m
79 lines (70 loc) · 3.34 KB
/
neu_bwthin.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
function y = neu_bwthin (x)
% y = bwthin (x)
%
% Perform thinning on a binary image by Guo's method. See Louisa Lam,
% Seong-Whan Lee, and Ching Y. Wuen, "Thinning Methodologies - A
% Comprehensive Survey," IEEE TPAMI, vol. 14, no. 9, pp. 869-885, 1992. The
% algorithm is described at the bottom of the first column and the top of
% the second column on page 879.
%
% In:
% x binary image
%
% Out:
% y skeleton of the input image
%
% Copyright (C) 2004-2005 Antti Niemistö
% See angioquant.m for more copyright information.
lut1 = lutthin1;
lut2 = lutthin2;
y = x;
done = 0;
while ~done
lasty = y;
y = applylut(applylut(y,lut1),lut2);
done = isequal(lasty,y);
end
function y = lutthin1()
% y = lutthin1()
%
% Look-up table for the first subiteration of Guo's thinning method.
%
% Copyright (C) 2004-2005 Antti Niemistö
% See angioquant.m for more copyright information.
y = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 1 1 0 0 1 1 0 0 0 0 ...
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 0 0 0 ...
0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 ...
0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 ...
0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 ...
0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 ...
0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 ...
0 0 0 1 0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 ...
1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 ...
1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 ...
1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 1 ...
1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 ...
1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]';
function y = lutthin2()
% y = lutthin2()
%
% Look-up table for the second subiteration of Guo's thinning method.
%
% Copyright (C) 2004-2005 Antti Niemistö
% See angioquant.m for more copyright information.
y = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 0 ...
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 ...
0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 0 0 0 0 0 0 ...
0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1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