summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/stitch/src/c/matchFeatures.c
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/benchmarks/stitch/src/c/matchFeatures.c')
-rw-r--r--SD-VBS/benchmarks/stitch/src/c/matchFeatures.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/SD-VBS/benchmarks/stitch/src/c/matchFeatures.c b/SD-VBS/benchmarks/stitch/src/c/matchFeatures.c
new file mode 100644
index 0000000..5450eb9
--- /dev/null
+++ b/SD-VBS/benchmarks/stitch/src/c/matchFeatures.c
@@ -0,0 +1,55 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include "stitch.h"
6
7I2D* matchFeatures(F2D* vecF1, F2D* vecF2)
8{
9 int m, n, n1, n2, n1c, n2c, i, j;
10 I2D *id, *retMatch, *t;
11 F2D *val, *temp;
12 int rows, cols;
13
14 n1 = vecF1->height;
15 n1c = vecF1->width;
16 n2 = vecF2->height;
17 n2c = vecF2->width;
18
19 retMatch = iMallocHandle(1, 2);
20
21 for(i=0; i<n1; i++)
22 {
23 id = iMallocHandle(1, n2);
24 t = iMallocHandle(1, n1c);
25
26 for(j=0; j<n1c; j++)
27 asubsref(t,j) = subsref(vecF1,i,j);
28
29 temp = dist2(t, vecF2);
30 val = fSort(temp,1);
31 id = fSortIndices(temp,1);
32
33 free(temp);
34 free(t);
35
36 if( asubsref(val,1) != 0 & (( asubsref(val,0) / asubsref(val,1) ) < 0.65))
37 {
38 t = retMatch;
39 rows = t->height + 1;
40 cols = t->width;
41 retMatch = iMallocHandle(rows, cols);
42 n = 0;
43
44 for(m=0; m<(t->height*t->width); m++)
45 {
46 asubsref(retMatch,n++) = asubsref(t,m);
47 }
48
49 asubsref(retMatch,n++) = i;
50 asubsref(retMatch,n) = asubsref(id,0);
51 }
52 }
53
54 return retMatch;
55}