diff options
author | leochanj <jbakita@cs.unc.edu> | 2020-10-21 01:52:54 -0400 |
---|---|---|
committer | leochanj <jbakita@cs.unc.edu> | 2020-10-21 15:59:54 -0400 |
commit | 0efc775370d2ff91927d1b383a99eab78dc5538f (patch) | |
tree | a41fe470fee5adc4d944ecd6b917bc48df8c7e0f /SD-VBS/benchmarks/tracking/src | |
parent | e2b50015cebdfba68699abd6e8575e38230f5a78 (diff) |
debug libextra and remove matlab
FLUSH_CACHES
Diffstat (limited to 'SD-VBS/benchmarks/tracking/src')
11 files changed, 0 insertions, 600 deletions
diff --git a/SD-VBS/benchmarks/tracking/src/matlab/Filtering.m b/SD-VBS/benchmarks/tracking/src/matlab/Filtering.m deleted file mode 100755 index d42ebb7..0000000 --- a/SD-VBS/benchmarks/tracking/src/matlab/Filtering.m +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | function imageOut = Filtering(imageIn, rows, cols, kernel, kernelSize) | ||
2 | |||
3 | imageOut = zeros(rows, cols);%initalize output image to all zeros | ||
4 | imageIn = double(imageIn);%convert to double to allow image arithmetic | ||
5 | |||
6 | intialCol = ((kernelSize+1)/2); | ||
7 | endCol = round(cols - ((kernelSize+1)/2)); | ||
8 | halfKernel = (kernelSize-1)/2; | ||
9 | |||
10 | initialRow = ((kernelSize+1)/2); | ||
11 | endRow = (rows - ((kernelSize+1)/2)); | ||
12 | |||
13 | %% Start 1-D filtering row-wise first. | ||
14 | |||
15 | for i=initialRow:endRow | ||
16 | for j=initialCol:endCol | ||
17 | imageOut(i,j) = sum(imageIn(i,j-halfKernel:j+halfKernel).*kernel)/sum(kernel);%actual filtering step | ||
18 | end | ||
19 | end | ||
20 | |||
21 | %% Start 1-D filtering col-wise first. | ||
22 | |||
23 | % kernelT = kernel'; | ||
24 | % for i=initialRow:endRow | ||
25 | % for j=initialCol:endCol | ||
26 | % imageOut(i,j) = sum(imageOut(i-halfKernel:i+halfKernel,j).*kernelT)/sum(kernel);%kernel to be transposed for performing multiplcation | ||
27 | % end | ||
28 | % end | ||
29 | % | ||
30 | % %imshow(uint8(imageOut)); | ||
diff --git a/SD-VBS/benchmarks/tracking/src/matlab/calcAreaSum.m b/SD-VBS/benchmarks/tracking/src/matlab/calcAreaSum.m deleted file mode 100755 index f8dd3da..0000000 --- a/SD-VBS/benchmarks/tracking/src/matlab/calcAreaSum.m +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | %calcAreaSum: | ||
2 | % sizeX = cols | ||
3 | % sizeY = rows | ||
4 | function ret = calcAreaSum(src, sizeX, sizeY, winSize, dataDir) | ||
5 | |||
6 | src = double(src); | ||
7 | nave = winSize; | ||
8 | nave_half = floor((nave+1)/2); | ||
9 | a1=zeros(1,sizeX+nave); | ||
10 | |||
11 | for i=1:sizeY | ||
12 | %pull out one row | ||
13 | for j=1:sizeX | ||
14 | a1(j+nave_half)=src(i,j); | ||
15 | end | ||
16 | |||
17 | a1sum=0; | ||
18 | %sum up values within a window | ||
19 | for k=1:nave | ||
20 | a1sum = a1sum+a1(k); | ||
21 | end | ||
22 | |||
23 | for j=1:sizeX | ||
24 | ret(i,j) = a1sum; | ||
25 | a1sum = a1sum + a1(j+nave) - a1(j); | ||
26 | end | ||
27 | end | ||
28 | |||
29 | a1=zeros(1,sizeY+nave); | ||
30 | for i=1:sizeX | ||
31 | |||
32 | %pull out one col | ||
33 | for j=1:sizeY | ||
34 | a1(j+nave_half)=ret(j,i); | ||
35 | end | ||
36 | |||
37 | a1sum=0; | ||
38 | %sum up values within a window | ||
39 | for k=1:nave | ||
40 | a1sum = a1sum+a1(k); | ||
41 | end | ||
42 | |||
43 | for j=1:sizeY | ||
44 | ret(j,i) = a1sum; | ||
45 | a1sum = a1sum + a1(j+nave) - a1(j); | ||
46 | end | ||
47 | end | ||
48 | |||
diff --git a/SD-VBS/benchmarks/tracking/src/matlab/calcGoodFeature.m b/SD-VBS/benchmarks/tracking/src/matlab/calcGoodFeature.m deleted file mode 100755 index b83faa6..0000000 --- a/SD-VBS/benchmarks/tracking/src/matlab/calcGoodFeature.m +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | %calcGoodFeature: | ||
2 | |||
3 | function [lambda, tr, det,c_xx, c_xy, c_yy] = calcGoodFeature(dX, dY, sizeX, sizeY, winSize, dataDir) | ||
4 | |||
5 | for i=1:sizeY | ||
6 | for j=1:sizeX | ||
7 | xx(i,j)=dX(i,j)*dX(i,j); | ||
8 | xy(i,j)=dX(i,j)*dY(i,j); | ||
9 | yy(i,j)=dY(i,j)*dY(i,j); | ||
10 | end | ||
11 | end | ||
12 | |||
13 | c_xx=calcAreaSum(xx, sizeX, sizeY, winSize,dataDir); | ||
14 | c_xy=calcAreaSum(xy, sizeX, sizeY, winSize,dataDir); | ||
15 | c_yy=calcAreaSum(yy, sizeX, sizeY, winSize,dataDir); | ||
16 | |||
17 | for i=1:sizeY | ||
18 | for j=1:sizeX | ||
19 | tr(i,j)= c_xx(i,j)+c_yy(i,j); | ||
20 | det(i,j)= c_xx(i,j)*c_yy(i,j)-c_xy(i,j)*c_xy(i,j); | ||
21 | % if( tr(i,j) == 0 ) | ||
22 | % lambda(i,j) = 0; | ||
23 | % else | ||
24 | lambda(i,j)=det(i,j)/(tr(i,j) + 0.00001); | ||
25 | % end | ||
26 | end | ||
27 | end | ||
28 | |||
diff --git a/SD-VBS/benchmarks/tracking/src/matlab/calcPyrLKTrack.m b/SD-VBS/benchmarks/tracking/src/matlab/calcPyrLKTrack.m deleted file mode 100755 index c965c2b..0000000 --- a/SD-VBS/benchmarks/tracking/src/matlab/calcPyrLKTrack.m +++ /dev/null | |||
@@ -1,108 +0,0 @@ | |||
1 | function [newFPnt, valid] = calcPyrLKTrack(iP, iDxP, iDyP, jP, fPnt, nFeatures, winSize, accuracy_th, max_iter) | ||
2 | |||
3 | cellDims = size(iP); | ||
4 | GOOD_FEATURE_LAMBDA_TH = accuracy_th; | ||
5 | |||
6 | for i=1:(cellDims(1)) | ||
7 | curImgDims = size(iP{i}); | ||
8 | imgDims(i,1)= curImgDims(1); | ||
9 | imgDims(i,2)= curImgDims(2); | ||
10 | |||
11 | end | ||
12 | |||
13 | pLevel = cellDims(1); | ||
14 | |||
15 | rate=[1, 0.5, 0.25, 0.125, 0.0625, 0.03125]; | ||
16 | winSizeSq=4*winSize*winSize; | ||
17 | iPatch=cell(1, winSizeSq); | ||
18 | jPatch=cell(1, winSizeSq); | ||
19 | iDxPatch=cell(1,winSizeSq); | ||
20 | iDyPatch=cell(1,winSizeSq); | ||
21 | |||
22 | valid(1:nFeatures) = 1; | ||
23 | newFPnt = zeros(2,nFeatures); | ||
24 | |||
25 | for i=1:nFeatures | ||
26 | |||
27 | dX=0; | ||
28 | dY=0; | ||
29 | |||
30 | %% x is rows here and y is cols | ||
31 | |||
32 | x=fPnt(1,i)*rate(pLevel+1); %half size of real level | ||
33 | y=fPnt(2,i)*rate(pLevel+1); | ||
34 | |||
35 | for level=pLevel:-1:1 | ||
36 | |||
37 | x = x+x; | ||
38 | y = y+y; | ||
39 | dX = dX+dX; | ||
40 | dY = dY+dY; | ||
41 | imgSize(1)=imgDims(level,1); %y,x | ||
42 | imgSize(2)=imgDims(level,2); %y,x | ||
43 | |||
44 | c_xx = 0; | ||
45 | c_xy = 0; | ||
46 | c_yy = 0; | ||
47 | |||
48 | %when feature goes out to the boundary. | ||
49 | |||
50 | if ((x-winSize)<1 || (y-winSize)<1 || (y+winSize+1)>imgSize(1) || (x+winSize+1)>imgSize(2)) | ||
51 | %winSize+1due to interpolation | ||
52 | %error or skip the level?? | ||
53 | valid(i) = 0; | ||
54 | break; | ||
55 | end | ||
56 | |||
57 | |||
58 | iPatch = getInterpolatePatch(iP{level}, imgSize(1), imgSize(2), x, y, winSize); | ||
59 | iDxPatch = getInterpolatePatch(iDxP{level}, imgSize(1), imgSize(2), x, y, winSize); | ||
60 | iDyPatch = getInterpolatePatch(iDyP{level}, imgSize(1), imgSize(2), x, y, winSize); | ||
61 | |||
62 | for idx=1:winSizeSq | ||
63 | c_xx = c_xx + iDxPatch(idx) * iDxPatch(idx); | ||
64 | c_xy = c_xy + iDxPatch(idx) * iDyPatch(idx); | ||
65 | c_yy = c_yy + iDyPatch(idx) * iDyPatch(idx); | ||
66 | end | ||
67 | |||
68 | c_det = c_xx * c_yy - c_xy * c_xy; | ||
69 | |||
70 | if (c_det/(c_xx+c_yy+0.00001)) < GOOD_FEATURE_LAMBDA_TH | ||
71 | valid(i)=0; | ||
72 | break; | ||
73 | end | ||
74 | |||
75 | c_det=1/c_det; | ||
76 | |||
77 | for k=1:max_iter | ||
78 | if ((x+dX-winSize)<1 || (y+dY-winSize)<1 || (y+dY+winSize+1)>imgSize(1) || (x+dX+winSize+1)>imgSize(2)) | ||
79 | %winSize+1due to interpolation | ||
80 | %error or skip the level?? | ||
81 | valid(i)=0; | ||
82 | break; | ||
83 | end | ||
84 | |||
85 | jPatch = getInterpolatePatch(jP{level}, imgSize(1), imgSize(2), x+dX, y+dY, winSize); | ||
86 | eX = 0; | ||
87 | eY = 0; | ||
88 | for idx=1:winSizeSq | ||
89 | dIt = iPatch(idx) - jPatch(idx); | ||
90 | eX = eX + (dIt*iDxPatch(idx)); | ||
91 | eY = eY + (dIt*iDyPatch(idx)); | ||
92 | end | ||
93 | |||
94 | mX = c_det*(eX*c_yy-eY*c_xy); | ||
95 | mY = c_det*(-eX*c_xy+eY*c_xx); | ||
96 | dX = dX + mX; | ||
97 | dY = dY + mY; | ||
98 | |||
99 | |||
100 | if ((mX*mX+mY*mY)<accuracy_th) | ||
101 | break; | ||
102 | end | ||
103 | end | ||
104 | end | ||
105 | |||
106 | newFPnt(1, i) = fPnt(1,i)+dX; | ||
107 | newFPnt(2, i) = fPnt(2,i)+dY; | ||
108 | end | ||
diff --git a/SD-VBS/benchmarks/tracking/src/matlab/calcSobel.m b/SD-VBS/benchmarks/tracking/src/matlab/calcSobel.m deleted file mode 100755 index 8617c25..0000000 --- a/SD-VBS/benchmarks/tracking/src/matlab/calcSobel.m +++ /dev/null | |||
@@ -1,74 +0,0 @@ | |||
1 | function [Dx, Dy] = calcSobel(imageIn) | ||
2 | |||
3 | imsize = size(imageIn); | ||
4 | rows = imsize(1); | ||
5 | cols = imsize(2); | ||
6 | |||
7 | Dx = zeros(rows, cols); %initalize output image to all zeros | ||
8 | Dy = zeros(rows, cols); %initalize output image to all zeros | ||
9 | imageIn = double(imageIn); %convert to double to allow image arithmetic | ||
10 | |||
11 | kernel_1 = [1 2 1]; | ||
12 | kernel_2 = [1 0 -1]; | ||
13 | kernelSize = 3; | ||
14 | |||
15 | sum_kernel_1 = 4; | ||
16 | sum_kernel_2 = 2; | ||
17 | |||
18 | startCol = 2; %((kernelSize+1)/2); | ||
19 | endCol = cols - 1; %round(cols - ((kernelSize+1)/2)); | ||
20 | halfKernel = 1; %(kernelSize-1)/2; | ||
21 | |||
22 | startRow = 2; %((kernelSize+1)/2); | ||
23 | endRow = rows - 1; %(rows - ((kernelSize+1)/2)); | ||
24 | |||
25 | %imshow(uint8(imageIn)); | ||
26 | |||
27 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
28 | %% Calculate Gx (gradient in X-dir) | ||
29 | %% Gx = ([1 2 1]') * ([1 0 -1] * imageIn) | ||
30 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
31 | |||
32 | %% Start 1-D filtering row-wise first. | ||
33 | |||
34 | tempOut = zeros(rows, cols);%initalize temp image to all zeros | ||
35 | for i=startRow:endRow | ||
36 | for j=startCol:endCol | ||
37 | tempOut(i,j) = sum(imageIn(i,j-halfKernel:j+halfKernel).*kernel_2)/sum_kernel_2;%actual filtering step | ||
38 | end | ||
39 | end | ||
40 | |||
41 | % Start 1-D filtering col-wise first. | ||
42 | |||
43 | for i=startRow:endRow | ||
44 | for j=startCol:endCol | ||
45 | Dx(i,j) = sum(tempOut(i-halfKernel:i+halfKernel,j).*kernel_1')/sum_kernel_1;%kernel to be transposed for performing multiplcation | ||
46 | Dx(i,j) = Dx(i,j);% + 128; | ||
47 | end | ||
48 | end | ||
49 | |||
50 | |||
51 | %imshow(uint8(Dx)); | ||
52 | |||
53 | |||
54 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
55 | %% Calculate Gy (gradient in Y-dir) | ||
56 | %% Gy = ([1 0 -1]') * ([1 2 1] * imageIn) | ||
57 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
58 | |||
59 | %% Start 1-D filtering row-wise first. | ||
60 | |||
61 | for i=startRow:endRow | ||
62 | for j=startCol:endCol | ||
63 | tempOut(i,j) = sum(imageIn(i-halfKernel:i+halfKernel,j).*kernel_2')/sum_kernel_2;%kernel to be transposed for performing multiplcation | ||
64 | end | ||
65 | end | ||
66 | |||
67 | for i=startRow:endRow | ||
68 | for j=startCol:endCol | ||
69 | Dy(i,j) = sum(tempOut(i,j-halfKernel:j+halfKernel).*kernel_1)/sum_kernel_1; | ||
70 | end | ||
71 | end | ||
72 | |||
73 | |||
74 | %imshow(uint8(Dy)); | ||
diff --git a/SD-VBS/benchmarks/tracking/src/matlab/getInterpolatePatch.m b/SD-VBS/benchmarks/tracking/src/matlab/getInterpolatePatch.m deleted file mode 100755 index d0a64d3..0000000 --- a/SD-VBS/benchmarks/tracking/src/matlab/getInterpolatePatch.m +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | function [dstImg] = getInterpolatePatch(srcImg,rows, cols,centerX,centerY,winSize) | ||
2 | |||
3 | a=centerX-floor(centerX); | ||
4 | b=centerY-floor(centerY); | ||
5 | a11=(1-a)*(1-b); | ||
6 | a12=a*(1-b); | ||
7 | a21=(1-a)*b; | ||
8 | a22=a*b; | ||
9 | |||
10 | for i=-winSize:winSize-1 | ||
11 | srcIdxx=floor(centerY)+i; | ||
12 | dstIdxx=i+winSize+1; | ||
13 | for j=-winSize:winSize-1 | ||
14 | srcIdx = srcIdxx * cols + floor(centerX) + j; | ||
15 | dstIdx = dstIdxx*2*winSize+j+winSize+1; | ||
16 | dstImg(dstIdx)=srcImg(srcIdxx, floor(centerX)+j)*a11; | ||
17 | dstImg(dstIdx)= dstImg(dstIdx) + srcImg(srcIdxx, floor(centerX)+j+1)*a12; | ||
18 | dstImg(dstIdx)= dstImg(dstIdx) + srcImg(srcIdxx+1, floor(centerX)+j)*a21; | ||
19 | dstImg(dstIdx)= dstImg(dstIdx) + srcImg(srcIdxx+1, floor(centerX)+j+1)*a22; | ||
20 | end | ||
21 | end | ||
22 | |||
diff --git a/SD-VBS/benchmarks/tracking/src/matlab/getPyramid.m b/SD-VBS/benchmarks/tracking/src/matlab/getPyramid.m deleted file mode 100755 index 845456a..0000000 --- a/SD-VBS/benchmarks/tracking/src/matlab/getPyramid.m +++ /dev/null | |||
@@ -1,10 +0,0 @@ | |||
1 | function pyr=getPyramid(img, level) | ||
2 | kernel=[1/16,1/4,3/8,1/4,1/16]; | ||
3 | pyr=cell(level,1); | ||
4 | pyr{1}=double(img); | ||
5 | for i=2:level | ||
6 | % imgBlur=conv2(pyr{i-1}, kernel, 'same'); | ||
7 | % imgBlur=conv2(imgBlur, kernel, 'same'); | ||
8 | % pyr{i}=imgBlur(1:2:end, 1:2:end); | ||
9 | pyr{i}=calcResizedImgMex(pyr{i-1}); | ||
10 | end | ||
diff --git a/SD-VBS/benchmarks/tracking/src/matlab/imageBlur.m b/SD-VBS/benchmarks/tracking/src/matlab/imageBlur.m deleted file mode 100755 index fd6c199..0000000 --- a/SD-VBS/benchmarks/tracking/src/matlab/imageBlur.m +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | function imageOut = imageBlur(imageIn) | ||
2 | |||
3 | imsize = size(imageIn); | ||
4 | rows = imsize(1); | ||
5 | cols = imsize(2); | ||
6 | |||
7 | imageOut = zeros(rows, cols);%initalize output image to all zeros | ||
8 | imageIn = double(imageIn);%convert to double to allow image arithmetic | ||
9 | |||
10 | kernel = [1 4 6 4 1]; | ||
11 | kernelSize = 5; | ||
12 | |||
13 | startCol = 3; %((kernelSize+1)/2); | ||
14 | endCol = cols - 2; %round(cols - ((kernelSize+1)/2)); | ||
15 | halfKernel = 2; %(kernelSize-1)/2; | ||
16 | |||
17 | startRow = 3; %((kernelSize+1)/2); | ||
18 | endRow = rows - 2; %(rows - ((kernelSize+1)/2)); | ||
19 | |||
20 | %% Start 1-D filtering row-wise first. | ||
21 | |||
22 | tempOut = zeros(rows, cols);%initalize temp image to all zeros | ||
23 | for i=startRow:endRow | ||
24 | for j=startCol:endCol | ||
25 | tempOut(i,j) = sum(imageIn(i,j-halfKernel:j+halfKernel).*kernel)/sum(kernel);%actual filtering step | ||
26 | end | ||
27 | end | ||
28 | |||
29 | %% Start 1-D filtering col-wise first. | ||
30 | |||
31 | for i=startRow:endRow | ||
32 | for j=startCol:endCol | ||
33 | imageOut(i,j) = sum(tempOut(i-halfKernel:i+halfKernel,j).*kernel')/sum(kernel);%kernel to be transposed for performing multiplcation | ||
34 | end | ||
35 | end | ||
36 | |||
diff --git a/SD-VBS/benchmarks/tracking/src/matlab/imageResize.m b/SD-VBS/benchmarks/tracking/src/matlab/imageResize.m deleted file mode 100755 index e5fa7b8..0000000 --- a/SD-VBS/benchmarks/tracking/src/matlab/imageResize.m +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | function [imageOut] = imageResize(imageIn) | ||
2 | |||
3 | imageIn = double(imageIn); | ||
4 | imsize = size(imageIn); | ||
5 | rows = imsize(1); | ||
6 | cols = imsize(2); | ||
7 | |||
8 | %% level 1 is the base image. | ||
9 | |||
10 | outputRows = floor((rows+1)/2); | ||
11 | outputCols = floor((cols+1)/2); | ||
12 | |||
13 | kernel = [1,4,6,4,1]; | ||
14 | kernelSize = 5; | ||
15 | |||
16 | temp = zeros(rows, outputCols);%initalize output image to all zeros | ||
17 | imageOut = zeros(outputRows, outputCols);%initalize output image to all zeros | ||
18 | imageIn = double(imageIn);%convert to double to allow image arithmetic | ||
19 | |||
20 | initialCol = 3; %((kernelSize+1)/2); | ||
21 | endCol = cols - 2; %round(cols - ((kernelSize+1)/2)); | ||
22 | halfKernel = 2; %(kernelSize-1)/2; | ||
23 | |||
24 | initialRow = 3; %((kernelSize+1)/2); | ||
25 | endRow = rows - 2; %(rows - ((kernelSize+1)/2)); | ||
26 | |||
27 | %% Start 1-D filtering row-wise first. | ||
28 | |||
29 | for i=initialRow:endRow | ||
30 | k = 1; | ||
31 | for j=initialCol:2:endCol | ||
32 | temp(i,k) = sum(imageIn(i,j-halfKernel:j+halfKernel).*kernel)/sum(kernel);%actual filtering step | ||
33 | k = k+1; | ||
34 | end | ||
35 | end | ||
36 | |||
37 | %imshow(uint8(temp)); | ||
38 | |||
39 | %% Start 1-D filtering col-wise first. | ||
40 | % | ||
41 | kernelT = kernel'; | ||
42 | j = 1; | ||
43 | for i=initialRow:2:endRow | ||
44 | for k=1:outputCols | ||
45 | imageOut(j,k) = sum(temp(i-halfKernel:i+halfKernel,k).*kernelT)/sum(kernel);%kernel to be transposed for performing multiplcation | ||
46 | end | ||
47 | j = j + 1; | ||
48 | end | ||
49 | |||
50 | % %imshow(uint8(imageOut)); | ||
diff --git a/SD-VBS/benchmarks/tracking/src/matlab/rgb2gray_f2_f3.m b/SD-VBS/benchmarks/tracking/src/matlab/rgb2gray_f2_f3.m deleted file mode 100755 index 23397a3..0000000 --- a/SD-VBS/benchmarks/tracking/src/matlab/rgb2gray_f2_f3.m +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | %! _rgb2gray_f2_f3 | ||
2 | |||
3 | function grayImage = rgb2gray_f2_f3(colorImage) | ||
4 | |||
5 | %0.2989 * R + 0.5870 * G + 0.1140 * B | ||
6 | rows = size(colorImage, 1); | ||
7 | cols = size(colorImage, 2); | ||
8 | rgb = size(colorImage, 3); | ||
9 | |||
10 | grayImage = zeros(rows, cols); | ||
11 | for i = 1:rows | ||
12 | for j = 1:cols | ||
13 | grayImage(i,j) = 0.2989 * colorImage(i,j,1) + 0.5870 * colorImage(i,j,2) + 0.1140 * colorImage(i,j,3); | ||
14 | end | ||
15 | end | ||
16 | \ No newline at end of file | ||
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 | ||