diff options
Diffstat (limited to 'SD-VBS/benchmarks/stitch/src/matlab/harris.m')
-rwxr-xr-x | SD-VBS/benchmarks/stitch/src/matlab/harris.m | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/SD-VBS/benchmarks/stitch/src/matlab/harris.m b/SD-VBS/benchmarks/stitch/src/matlab/harris.m deleted file mode 100755 index 423330e..0000000 --- a/SD-VBS/benchmarks/stitch/src/matlab/harris.m +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | |||
2 | % Sample code for detecting Harris corners, following | ||
3 | % Brown et al, CVPR 2005 | ||
4 | % by Alyosha Efros, so probably buggy... | ||
5 | |||
6 | function [x,y,v] = harris(im, dataDir); | ||
7 | |||
8 | g1 = [1,4,6,4,1; 4,16,24,16,4;6,24,36,24,6;4,16,24,16,4;1,4,6,4,1]/256; | ||
9 | g2 = [1,2,1;2,4,2;1,2,1]/16; | ||
10 | |||
11 | img1 = conv2(im,g1,'same'); % blur image with sigma_d | ||
12 | |||
13 | Ix = conv2(img1,[-0.5 0 0.5],'same'); % take x derivative | ||
14 | Iy = conv2(img1,[-0.5;0;0.5],'same'); % take y derivative | ||
15 | |||
16 | % Compute elements of the Harris matrix H | ||
17 | %%% we can use blur instead of the summing window | ||
18 | Ix2 = conv2(Ix.*Ix,g2,'same'); | ||
19 | Iy2 = conv2(Iy.*Iy,g2,'same'); | ||
20 | IxIy = conv2(Ix.*Iy,g2,'same'); | ||
21 | |||
22 | R = (Ix2.*Iy2 - IxIy.*IxIy) ... % det(H) | ||
23 | ./ (Ix2 + Iy2 + eps); % trace(H) + epsilon | ||
24 | |||
25 | % don't want corners close to image border | ||
26 | [rows, cols] = size(im); | ||
27 | |||
28 | % non-maxima supression within 3x3 windows | ||
29 | nonmax = inline('max(x)'); | ||
30 | Rmax = colfilt(R,[3 3],'sliding',nonmax); % find neighbrhood max | ||
31 | Rnm = R.*(R == Rmax); % supress non-max | ||
32 | |||
33 | % extract all interest points | ||
34 | [y,x,v] = find(Rnm); | ||
35 | |||
36 | |||
37 | |||