summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/tracking/src/matlab/imageResize.m
diff options
context:
space:
mode:
authorleochanj105 <leochanj@live.unc.edu>2020-10-19 23:09:30 -0400
committerleochanj105 <leochanj@live.unc.edu>2020-10-20 02:40:39 -0400
commitf618466c25d43f3bae9e40920273bf77de1e1149 (patch)
tree460e739e2165b8a9c37a9c7ab1b60f5874903543 /SD-VBS/benchmarks/tracking/src/matlab/imageResize.m
parent47ced4e96bbb782b9e780e8f2cfc637b2c21ff44 (diff)
initial sd-vbs
initial sd-vbs add sd-vbs sd-vbs
Diffstat (limited to 'SD-VBS/benchmarks/tracking/src/matlab/imageResize.m')
-rwxr-xr-xSD-VBS/benchmarks/tracking/src/matlab/imageResize.m50
1 files changed, 50 insertions, 0 deletions
diff --git a/SD-VBS/benchmarks/tracking/src/matlab/imageResize.m b/SD-VBS/benchmarks/tracking/src/matlab/imageResize.m
new file mode 100755
index 0000000..e5fa7b8
--- /dev/null
+++ b/SD-VBS/benchmarks/tracking/src/matlab/imageResize.m
@@ -0,0 +1,50 @@
1function [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));