-
Notifications
You must be signed in to change notification settings - Fork 0
/
harriscorner.m
52 lines (35 loc) · 908 Bytes
/
harriscorner.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
function [ Iout ] = harriscorner( I, threshold )
% HarrisCorner
%
% Reimplementation of the Harris Corner Detector.
%
% I Grey Image
% threshold Image Threshold (0-255)
%
%threshold = 10;
%I = imread('C:\\Users\\rramele\\Google Drive\\ATI.Image.Processing\\Imagenes\\Test.png');
%I = I(:,:,1);
%figure;
%imshow(I);
% Detector de borde de Sobel (ver maskaras)
[AI, Ix, Iy] = sobel(I);
Ix2 = Ix .* Ix;
Iy2 = Iy .* Iy;
Ixy = Ix .* Iy;
Ix2 = gaussiansmoothing(Ix2, 3);
Iy2 = gaussiansmoothing(Iy2, 3);
Ixy = gaussiansmoothing(Ixy, 3);
k=0.04;
% Surge directamente del det M - k traza M
cim1(:,:) = ( Ix2 .* Iy2 - Ixy .* Ixy) - k * (Ix2 + Iy2) .^ 2;
% La salida de cim1 no es una imagen en los valores, hay que escalarla.
I=imagenize(cim1);
%figure;
%imshow(I);
mmax = max(max(I));
I(I>=(mmax-threshold))=255;
I(I<(mmax-threshold))=0;
%figure;
%imshow(I);
Iout = I;
end