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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
/********************************
Author: Sravanthi Kota Venkata
********************************/
#include "stitch.h"
F2D* harris(I2D* im)
{
F2D *img1;
F2D *g1, *g2, *g;
F2D *Ix, *Iy;
F2D *Ix2, *Iy2, *IxIy;
F2D *v, *R, *Rmax, *Rnm;
float eps;
F2D *sobel, *sob, *temp, *temp1;
I2D *win, *x, *y;
int i;
g1 = fSetArray(5,5,0);
g2 = fSetArray(3,3,0);
asubsref(g1,0) = 1;
asubsref(g1,1) = 4;
asubsref(g1,2) = 6;
asubsref(g1,3) = 4;
asubsref(g1,4) = 1;
asubsref(g1,5) = 4;
asubsref(g1,6) = 16;
asubsref(g1,7) = 24;
asubsref(g1,8) = 16;
asubsref(g1,9) = 4;
asubsref(g1,10) = 6;
asubsref(g1,11) = 24;
asubsref(g1,12) = 36;
asubsref(g1,13) = 24;
asubsref(g1,14) = 6;
asubsref(g1,15) = 4;
asubsref(g1,16) = 16;
asubsref(g1,17) = 24;
asubsref(g1,18) = 16;
asubsref(g1,19) = 4;
asubsref(g1,20) = 1;
asubsref(g1,21) = 4;
asubsref(g1,22) = 6;
asubsref(g1,23) = 4;
asubsref(g1,24) = 1;
asubsref(g2,0) = 1;
asubsref(g2,1) = 2;
asubsref(g2,2) = 1;
asubsref(g2,3) = 2;
asubsref(g2,4) = 4;
asubsref(g2,5) = 2;
asubsref(g2,6) = 1;
asubsref(g2,7) = 2;
asubsref(g2,8) = 1;
g = fDivide(g1, 256);
sob = fMallocHandle(1,3);
asubsref(sob,0) = -0.5;
asubsref(sob,1) = 0;
asubsref(sob,2) = 0.5;
{
F2D* imf;
imf = fiDeepCopy(im);
img1 = ffConv2(imf, g);
fFreeHandle(imf);
}
Ix = ffConv2(img1, sob);
fFreeHandle(sob);
sob = fMallocHandle(3,1);
asubsref(sob,0) = -0.5;
asubsref(sob,1) = 0;
asubsref(sob,2) = 0.5;
Iy = ffConv2(img1, sob);
fFreeHandle(g);
g = fDivide(g2, 16);
eps = 2.2204e-16;
sobel = fTimes(Ix, Ix);
Ix2 = ffConv2(sobel, g);
fFreeHandle(sobel);
sobel = fTimes(Iy, Iy);
Iy2 = ffConv2(sobel, g);
fFreeHandle(sobel);
sobel = fTimes(Ix, Iy);
IxIy = ffConv2(sobel, g);
fFreeHandle(sobel);
temp = fTimes(Ix2, Iy2);
temp1 = fTimes(IxIy, IxIy);
sobel = fMinus(temp, temp1);
fFreeHandle(temp);
temp = fPlus(Ix2, Iy2);
for(i=0; i<(temp->height*temp->width); i++)
asubsref(temp,i) += eps;
R = ffDivide(sobel, temp);
win = iSetArray(1,2,3);
Rmax = maxWindow(R, win);
Rnm = supress(R, Rmax);
v = fFind3(Rnm);
iFreeHandle(win);
fFreeHandle(Rmax);
fFreeHandle(Rnm);
fFreeHandle(R);
fFreeHandle(img1);
fFreeHandle(g1);
fFreeHandle(g2);
fFreeHandle(g);
fFreeHandle(Ix);
fFreeHandle(Iy);
fFreeHandle(Ix2);
fFreeHandle(Iy2);
fFreeHandle(IxIy);
fFreeHandle(sobel);
fFreeHandle(sob);
fFreeHandle(temp);
fFreeHandle(temp1);
// iFreeHandle(x);
// iFreeHandle(y);
return v;
}
|