diff options
Diffstat (limited to 'SD-VBS/benchmarks/tracking/src/matlab/script_run_profile.m')
-rwxr-xr-x | SD-VBS/benchmarks/tracking/src/matlab/script_run_profile.m | 178 |
1 files changed, 0 insertions, 178 deletions
diff --git a/SD-VBS/benchmarks/tracking/src/matlab/script_run_profile.m b/SD-VBS/benchmarks/tracking/src/matlab/script_run_profile.m deleted file mode 100755 index 62d367f..0000000 --- a/SD-VBS/benchmarks/tracking/src/matlab/script_run_profile.m +++ /dev/null | |||
@@ -1,178 +0,0 @@ | |||
1 | function script_run_profile(dataDir, resultDir, type, common, toolDir) | ||
2 | |||
3 | if(~isdeployed) | ||
4 | addpath(fullfile(toolDir, '/lagrcv/')); | ||
5 | addpath(fullfile(toolDir, '/toolbox_basic/filter/')); | ||
6 | addpath(fullfile(toolDir, '/ikkjin/')); | ||
7 | end | ||
8 | IMAGE_DIR=dataDir; | ||
9 | |||
10 | path(path,common); | ||
11 | |||
12 | tol = 2; | ||
13 | |||
14 | %% Input params | ||
15 | N_FEA=1600; | ||
16 | WINSZ=4; %size of sum-up window | ||
17 | NO_PYR=2; | ||
18 | SUPPRESION_RADIUS=10; | ||
19 | LK_ITER=20; | ||
20 | counter = 2; | ||
21 | accuracy = 0.03; | ||
22 | |||
23 | if(strcmp(type,'test')) | ||
24 | WINSZ = 2; | ||
25 | N_FEA = 10; | ||
26 | LK_ITER = 2; | ||
27 | counter = 2; | ||
28 | accuracy = 0.1; | ||
29 | elseif(strcmp(type, 'sim_fast')) | ||
30 | WINSZ = 2; | ||
31 | N_FEA = 100; | ||
32 | LK_ITER = 2; | ||
33 | counter = 4; | ||
34 | elseif(strcmp(type,'sim')) | ||
35 | WINSZ = 2; | ||
36 | N_FEA = 200; | ||
37 | LK_ITER = 2; | ||
38 | counter = 4; | ||
39 | elseif(strcmp(type,'sqcif')) | ||
40 | WINSZ = 8; | ||
41 | N_FEA = 500; | ||
42 | LK_ITER = 15; | ||
43 | counter = 2; | ||
44 | elseif(strcmp(type, 'qcif')) | ||
45 | WINSZ = 12; | ||
46 | N_FEA = 400; | ||
47 | LK_ITER = 15; | ||
48 | counter = 4; | ||
49 | elseif(strcmp(type,'cif')) | ||
50 | WINSZ = 20; | ||
51 | N_FEA = 500; | ||
52 | LK_ITER = 20; | ||
53 | counter = 4; | ||
54 | elseif(strcmp(type, 'vga')) | ||
55 | WINSZ = 32; | ||
56 | N_FEA = 400; | ||
57 | LK_ITER = 20; | ||
58 | counter = 4; | ||
59 | elseif(strcmp(type,'fullhd')) | ||
60 | WINSZ = 48; | ||
61 | N_FEA = 500; | ||
62 | LK_ITER = 20; | ||
63 | counter = 4; | ||
64 | elseif(strcmp(type,'wuxga')) | ||
65 | WINSZ = 64; | ||
66 | N_FEA = 500; | ||
67 | LK_ITER = 20; | ||
68 | counter = 4; | ||
69 | end | ||
70 | |||
71 | imgName = [dataDir, '/1.bmp']; | ||
72 | Icur=readImage(imgName); | ||
73 | |||
74 | [rows,cols] = size(Icur); | ||
75 | fprintf(1,'Input size\t\t- (%dx%d)\n', rows, cols); | ||
76 | |||
77 | %% Timing | ||
78 | start = photonStartTiming; | ||
79 | |||
80 | Icur = imageBlur(double(Icur)); | ||
81 | |||
82 | Jpyr = cell(2,1); | ||
83 | Jpyr{1} = Icur; | ||
84 | Jpyr{2} = imageResize(Icur); | ||
85 | |||
86 | [dX, dY] = calcSobel(double(Icur)); | ||
87 | sizeWin = size(dX); | ||
88 | [lambda, tr, det, c_xx, c_xy, c_yy] = calcGoodFeature(dX, dY, sizeWin(2), sizeWin(1), WINSZ, dataDir); | ||
89 | |||
90 | imgsz=size(lambda); | ||
91 | lambda([1:WINSZ,end-WINSZ:end],:)=0; | ||
92 | lambda(:,[1:WINSZ,end-WINSZ:end])=0; | ||
93 | |||
94 | [temp,idx]=sort(lambda(:), 'descend'); | ||
95 | featureIdx=idx(1:N_FEA); | ||
96 | features=zeros(3, N_FEA); | ||
97 | features(1,:)=ceil(featureIdx/imgsz(1)); | ||
98 | |||
99 | fIdxT = featureIdx'; | ||
100 | features(2,:)=fIdxT-(features(1,:)-1)*imgsz(1); | ||
101 | features(3,:)=lambda(featureIdx); | ||
102 | |||
103 | for i=1:N_FEA | ||
104 | features(3,i) = lambda(idx(i)); | ||
105 | end | ||
106 | |||
107 | f1T = features(1,:)'; | ||
108 | f2T = features(2,:)'; | ||
109 | f3T = features(3,:)'; | ||
110 | |||
111 | interestPnt=getANMS(f1T, f2T, f3T, SUPPRESION_RADIUS, dataDir); | ||
112 | |||
113 | interestPnt=interestPnt'; | ||
114 | features=interestPnt(1:2,:); | ||
115 | |||
116 | %% Timing | ||
117 | endC = photonEndTiming; | ||
118 | elapsed = photonReportTiming(start, endC); | ||
119 | |||
120 | for iter=1:counter | ||
121 | imgName = [dataDir, '/', num2str(iter), '.bmp']; | ||
122 | Iprev=Icur; | ||
123 | Icur=readImage(imgName); | ||
124 | |||
125 | %% Self check params | ||
126 | tol = 0.1; | ||
127 | %% Timing | ||
128 | start = photonStartTiming; | ||
129 | |||
130 | Icur = imageBlur(double(Icur)); | ||
131 | |||
132 | Ipyr=Jpyr; | ||
133 | |||
134 | Jpyr = cell(2,1); | ||
135 | Jpyr{1} = Icur; | ||
136 | Jpyr{2} = imageResize(Icur); | ||
137 | |||
138 | dxPyr = cell(2,1); | ||
139 | dyPyr = cell(2,1); | ||
140 | |||
141 | [dxPyr{1}, dyPyr{1}] = calcSobel(Jpyr{1}); | ||
142 | [dxPyr{2}, dyPyr{2}] = calcSobel(Jpyr{2}); | ||
143 | |||
144 | sizeWin = size(dxPyr{2}); | ||
145 | nFeatures = size(features); | ||
146 | |||
147 | [newpoints, currStatus] = calcPyrLKTrack(Ipyr, dxPyr, dyPyr, Jpyr, double(features), nFeatures(2), WINSZ, 0.03, LK_ITER); | ||
148 | |||
149 | newpoints=newpoints(:,find(currStatus)); | ||
150 | |||
151 | %% Timing | ||
152 | stop = photonEndTiming; | ||
153 | |||
154 | temp = photonReportTiming(start, stop); | ||
155 | elapsed(1) = elapsed(1) + temp(1); | ||
156 | elapsed(2) = elapsed(2) + temp(2); | ||
157 | |||
158 | % figure(1); | ||
159 | % imagesc(Icur);colormap gray | ||
160 | % hold on; | ||
161 | % scatter(newpoints(1,:), newpoints(2,:), 'r+'); | ||
162 | % hold off; | ||
163 | % drawnow | ||
164 | % | ||
165 | features=newpoints; | ||
166 | |||
167 | end | ||
168 | |||
169 | %% Self checking | ||
170 | fWriteMatrix(features, dataDir); | ||
171 | |||
172 | photonPrintTiming(elapsed); | ||
173 | |||
174 | if(~isdeployed) | ||
175 | rmpath(fullfile(toolDir, '/lagrcv/')); | ||
176 | rmpath(fullfile(toolDir, '/toolbox_basic/filter/')); | ||
177 | rmpath(fullfile(toolDir, '/ikkjin/')); | ||
178 | end | ||