summaryrefslogtreecommitdiffstats
path: root/all_pairs/source/susan/susan.c
diff options
context:
space:
mode:
authorJoshua Bakita <bakitajoshua@gmail.com>2019-10-07 19:13:39 -0400
committerJoshua Bakita <bakitajoshua@gmail.com>2019-10-07 19:13:39 -0400
commit386b7d3366f1359a265da207a9cafa3edf553b64 (patch)
treec76120c2c138faed822e4ae386be6ef22a738a78 /all_pairs/source/susan/susan.c
parent54a3f7091a2146b29c73a6fdc4b62a5c4ad7a3d8 (diff)
Reorganize and commit all the modified TACLeBench code and run scripts
Diffstat (limited to 'all_pairs/source/susan/susan.c')
-rw-r--r--all_pairs/source/susan/susan.c2014
1 files changed, 2014 insertions, 0 deletions
diff --git a/all_pairs/source/susan/susan.c b/all_pairs/source/susan/susan.c
new file mode 100644
index 0000000..fb990b1
--- /dev/null
+++ b/all_pairs/source/susan/susan.c
@@ -0,0 +1,2014 @@
1/**********************************************************************\
2
3 SUSAN Version 2l by Stephen Smith
4 Oxford Centre for Functional Magnetic Resonance Imaging of the Brain,
5 Department of Clinical Neurology, Oxford University, Oxford, UK
6 (Previously in Computer Vision and Image Processing Group - now
7 Computer Vision and Electro Optics Group - DERA Chertsey, UK)
8 Email: steve@fmrib.ox.ac.uk
9 WWW: http://www.fmrib.ox.ac.uk/~steve
10
11 (C) Crown Copyright (1995-1999), Defence Evaluation and Research Agency,
12 Farnborough, Hampshire, GU14 6TD, UK
13 DERA WWW site:
14 http://www.dera.gov.uk/
15 DERA Computer Vision and Electro Optics Group WWW site:
16 http://www.dera.gov.uk/imageprocessing/dera/group_home.html
17 DERA Computer Vision and Electro Optics Group point of contact:
18 Dr. John Savage, jtsavage@dera.gov.uk, +44 1344 633203
19
20 A UK patent has been granted: "Method for digitally processing
21 images to determine the position of edges and/or corners therein for
22 guidance of unmanned vehicle", UK Patent 2272285. Proprietor:
23 Secretary of State for Defence, UK. 15 January 1997
24
25 This code is issued for research purposes only and remains the
26 property of the UK Secretary of State for Defence. This code must
27 not be passed on without this header information being kept
28 intact. This code must not be sold.
29
30\**********************************************************************/
31
32/**********************************************************************\
33
34 SUSAN Version 2l
35 SUSAN = Smallest Univalue Segment Assimilating Nucleus
36
37 Email: steve@fmrib.ox.ac.uk
38 WWW: http://www.fmrib.ox.ac.uk/~steve
39
40 Related paper:
41 @article{Smith97,
42 author = "Smith, S.M. and Brady, J.M.",
43 title = "{SUSAN} - A New Approach to Low Level Image Processing",
44 journal = "Int. Journal of Computer Vision",
45 pages = "45--78",
46 volume = "23",
47 number = "1",
48 month = "May",
49 year = 1997}
50
51 To be registered for automatic (bug) updates of SUSAN, send an email.
52
53 Compile with:
54 gcc -O4 -o susan susan2l.c -lm
55
56 See following section for different machine information. Please
57 report any bugs (and fixes). There are a few optional changes that
58 can be made in the "defines" section which follows shortly.
59
60 Usage: type "susan" to get usage. Only PGM format files can be input
61 and output. Utilities such as the netpbm package and XV can be used
62 to convert to and from other formats. Any size of image can be
63 processed.
64
65 This code is written using an emacs folding mode, making moving
66 around the different sections very easy. This is why there are
67 various marks within comments and why comments are indented.
68
69
70 SUSAN QUICK:
71
72 This version of the SUSAN corner finder does not do all the
73 false-corner suppression and thus is faster and produced some false
74 positives, particularly on strong edges. However, because there are
75 less stages involving thresholds etc., the corners that are
76 correctly reported are usually more stable than those reported with
77 the full algorithm. Thus I recommend at least TRYING this algorithm
78 for applications where stability is important, e.g., tracking.
79
80 THRESHOLDS:
81
82 There are two thresholds which can be set at run-time. These are the
83 brightness threshold (t) and the distance threshold (d).
84
85 SPATIAL CONTROL: d
86
87 In SUSAN smoothing d controls the size of the Gaussian mask; its
88 default is 4.0. Increasing d gives more smoothing. In edge finding,
89 a fixed flat mask is used, either 37 pixels arranged in a "circle"
90 (default), or a 3 by 3 mask which gives finer detail. In corner
91 finding, only the larger 37 pixel mask is used; d is not
92 variable. In smoothing, the flat 3 by 3 mask can be used instead of
93 a larger Gaussian mask; this gives low smoothing and fast operation.
94
95 BRIGHTNESS CONTROL: t
96
97 In all three algorithms, t can be varied (default=20); this is the
98 main threshold to be varied. It determines the maximum difference in
99 greylevels between two pixels which allows them to be considered
100 part of the same "region" in the image. Thus it can be reduced to
101 give more edges or corners, i.e. to be more sensitive, and vice
102 versa. In smoothing, reducing t gives less smoothing, and vice
103 versa. Set t=10 for the test image available from the SUSAN web
104 page.
105
106 ITERATIONS:
107
108 With SUSAN smoothing, more smoothing can also be obtained by
109 iterating the algorithm several times. This has a different effect
110 from varying d or t.
111
112 FIXED MASKS:
113
114 37 pixel mask: ooo 3 by 3 mask: ooo
115 ooooo ooo
116 ooooooo ooo
117 ooooooo
118 ooooooo
119 ooooo
120 ooo
121
122 CORNER ATTRIBUTES dx, dy and I
123 (Only read this if you are interested in the C implementation or in
124 using corner attributes, e.g., for corner matching)
125
126 Corners reported in the corner list have attributes associated with
127 them as well as positions. This is useful, for example, when
128 attempting to match corners from one image to another, as these
129 attributes can often be fairly unchanged between images. The
130 attributes are dx, dy and I. I is the value of image brightness at
131 the position of the corner. In the case of susan_corners_quick, dx
132 and dy are the first order derivatives (differentials) of the image
133 brightness in the x and y directions respectively, at the position
134 of the corner. In the case of normal susan corner finding, dx and dy
135 are scaled versions of the position of the centre of gravity of the
136 USAN with respect to the centre pixel (nucleus).
137
138 BRIGHTNESS FUNCTION LUT IMPLEMENTATION:
139 (Only read this if you are interested in the C implementation)
140
141 The SUSAN brightness function is implemented as a LUT
142 (Look-Up-Table) for speed. The resulting pointer-based code is a
143 little hard to follow, so here is a brief explanation. In
144 setup_brightness_lut() the LUT is setup. This mallocs enough space
145 for *bp and then repositions the pointer to the centre of the
146 malloced space. The SUSAN function e^-(x^6) or e^-(x^2) is
147 calculated and converted to a uchar in the range 0-100, for all
148 possible image brightness differences (including negative
149 ones). Thus bp[23] is the output for a brightness difference of 23
150 greylevels. In the SUSAN algorithms this LUT is used as follows:
151
152 p=in + (i-3)*x_size + j - 1;
153 p points to the first image pixel in the circular mask surrounding
154 point (x,y).
155
156 cp=bp + in[i*x_size+j];
157 cp points to a position in the LUT corresponding to the brightness
158 of the centre pixel (x,y).
159
160 now for every pixel within the mask surrounding (x,y),
161 n+=*(cp-*p++);
162 the brightness difference function is found by moving the cp pointer
163 down by an amount equal to the value of the pixel pointed to by p,
164 thus subtracting the two brightness values and performing the
165 exponential function. This value is added to n, the running USAN
166 area.
167
168 in SUSAN smoothing, the variable height mask is implemented by
169 multiplying the above by the moving mask pointer, reset for each new
170 centre pixel.
171 tmp = *dpt++ * *(cp-brightness);
172
173\**********************************************************************/
174
175/**********************************************************************\
176
177 Success has been reported with the following:
178
179 MACHINE OS COMPILER
180
181 Sun 4.1.4 bundled C, gcc
182
183 Next
184
185 SGI IRIX SGI cc
186
187 DEC Unix V3.2+
188
189 IBM RISC AIX gcc
190
191 PC Borland 5.0
192
193 PC Linux gcc-2.6.3
194
195 PC Win32 Visual C++ 4.0 (Console Application)
</