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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
function script_run_profile(dataDir, resultDir, type, common, toolDir)
if(~isdeployed)
addpath(fullfile(toolDir, '/lagrcv/'));
addpath(fullfile(toolDir, '/toolbox_basic/filter/'));
addpath(fullfile(toolDir, '/ikkjin/'));
end
IMAGE_DIR=dataDir;
path(path,common);
tol = 2;
%% Input params
N_FEA=1600;
WINSZ=4; %size of sum-up window
NO_PYR=2;
SUPPRESION_RADIUS=10;
LK_ITER=20;
counter = 2;
accuracy = 0.03;
if(strcmp(type,'test'))
WINSZ = 2;
N_FEA = 10;
LK_ITER = 2;
counter = 2;
accuracy = 0.1;
elseif(strcmp(type, 'sim_fast'))
WINSZ = 2;
N_FEA = 100;
LK_ITER = 2;
counter = 4;
elseif(strcmp(type,'sim'))
WINSZ = 2;
N_FEA = 200;
LK_ITER = 2;
counter = 4;
elseif(strcmp(type,'sqcif'))
WINSZ = 8;
N_FEA = 500;
LK_ITER = 15;
counter = 2;
elseif(strcmp(type, 'qcif'))
WINSZ = 12;
N_FEA = 400;
LK_ITER = 15;
counter = 4;
elseif(strcmp(type,'cif'))
WINSZ = 20;
N_FEA = 500;
LK_ITER = 20;
counter = 4;
elseif(strcmp(type, 'vga'))
WINSZ = 32;
N_FEA = 400;
LK_ITER = 20;
counter = 4;
elseif(strcmp(type,'fullhd'))
WINSZ = 48;
N_FEA = 500;
LK_ITER = 20;
counter = 4;
elseif(strcmp(type,'wuxga'))
WINSZ = 64;
N_FEA = 500;
LK_ITER = 20;
counter = 4;
end
imgName = [dataDir, '/1.bmp'];
Icur=readImage(imgName);
[rows,cols] = size(Icur);
fprintf(1,'Input size\t\t- (%dx%d)\n', rows, cols);
%% Timing
start = photonStartTiming;
Icur = imageBlur(double(Icur));
Jpyr = cell(2,1);
Jpyr{1} = Icur;
Jpyr{2} = imageResize(Icur);
[dX, dY] = calcSobel(double(Icur));
sizeWin = size(dX);
[lambda, tr, det, c_xx, c_xy, c_yy] = calcGoodFeature(dX, dY, sizeWin(2), sizeWin(1), WINSZ, dataDir);
imgsz=size(lambda);
lambda([1:WINSZ,end-WINSZ:end],:)=0;
lambda(:,[1:WINSZ,end-WINSZ:end])=0;
[temp,idx]=sort(lambda(:), 'descend');
featureIdx=idx(1:N_FEA);
features=zeros(3, N_FEA);
features(1,:)=ceil(featureIdx/imgsz(1));
fIdxT = featureIdx';
features(2,:)=fIdxT-(features(1,:)-1)*imgsz(1);
features(3,:)=lambda(featureIdx);
for i=1:N_FEA
features(3,i) = lambda(idx(i));
end
f1T = features(1,:)';
f2T = features(2,:)';
f3T = features(3,:)';
interestPnt=getANMS(f1T, f2T, f3T, SUPPRESION_RADIUS, dataDir);
interestPnt=interestPnt';
features=interestPnt(1:2,:);
%% Timing
endC = photonEndTiming;
elapsed = photonReportTiming(start, endC);
for iter=1:counter
imgName = [dataDir, '/', num2str(iter), '.bmp'];
Iprev=Icur;
Icur=readImage(imgName);
%% Self check params
tol = 0.1;
%% Timing
start = photonStartTiming;
Icur = imageBlur(double(Icur));
Ipyr=Jpyr;
Jpyr = cell(2,1);
Jpyr{1} = Icur;
Jpyr{2} = imageResize(Icur);
dxPyr = cell(2,1);
dyPyr = cell(2,1);
[dxPyr{1}, dyPyr{1}] = calcSobel(Jpyr{1});
[dxPyr{2}, dyPyr{2}] = calcSobel(Jpyr{2});
sizeWin = size(dxPyr{2});
nFeatures = size(features);
[newpoints, currStatus] = calcPyrLKTrack(Ipyr, dxPyr, dyPyr, Jpyr, double(features), nFeatures(2), WINSZ, 0.03, LK_ITER);
newpoints=newpoints(:,find(currStatus));
%% Timing
stop = photonEndTiming;
temp = photonReportTiming(start, stop);
elapsed(1) = elapsed(1) + temp(1);
elapsed(2) = elapsed(2) + temp(2);
% figure(1);
% imagesc(Icur);colormap gray
% hold on;
% scatter(newpoints(1,:), newpoints(2,:), 'r+');
% hold off;
% drawnow
%
features=newpoints;
end
%% Self checking
fWriteMatrix(features, dataDir);
photonPrintTiming(elapsed);
if(~isdeployed)
rmpath(fullfile(toolDir, '/lagrcv/'));
rmpath(fullfile(toolDir, '/toolbox_basic/filter/'));
rmpath(fullfile(toolDir, '/ikkjin/'));
end
|