diff options
Diffstat (limited to 'SD-VBS/benchmarks/tracking/src/matlab/calcSobel.m')
-rwxr-xr-x | SD-VBS/benchmarks/tracking/src/matlab/calcSobel.m | 74 |
1 files changed, 0 insertions, 74 deletions
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)); | ||