harris

PURPOSE ^

HARRIS obtains the Harris transform of image.

SYNOPSIS ^

function imgout=harris(img,win)

DESCRIPTION ^

 HARRIS obtains the Harris transform of image.
 
 HARRIS takes gets the Harris transform image of an input grayscale image.
 
 USAGE:
     imgout=harris(img); if win is not specified the default value is
     used min(size(img))/140
 
     imgout=harris(img,win); win is the window size of the Harris
     transform
 
 INPUTS:
     img: grayscale double class image
 
     win: scalar specifying the window size
 
 OUTPUTS:
 imgout: Harris transform image

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function imgout=harris(img,win)
0002 % HARRIS obtains the Harris transform of image.
0003 %
0004 % HARRIS takes gets the Harris transform image of an input grayscale image.
0005 %
0006 % USAGE:
0007 %     imgout=harris(img); if win is not specified the default value is
0008 %     used min(size(img))/140
0009 %
0010 %     imgout=harris(img,win); win is the window size of the Harris
0011 %     transform
0012 %
0013 % INPUTS:
0014 %     img: grayscale double class image
0015 %
0016 %     win: scalar specifying the window size
0017 %
0018 % OUTPUTS:
0019 % imgout: Harris transform image
0020 
0021 if ~exist('win','var')|| isempty(win)
0022     win=round(min(size(img))/140);
0023 end
0024 
0025 dx =[-1 0 1; -2 0 2;-1 0 1]; % The Mask
0026     dy = dx';
0027 
0028     
0029     ix = conv2(img, dx, 'same');   
0030     iy = conv2(img, dy, 'same');
0031     m = fspecial('average',win);
0032     
0033 
0034     a = conv2(ix.^2, m, 'same');  
0035     b = conv2(iy.^2, m, 'same');
0036     c = conv2(ix.*iy,m,'same');
0037 
0038     imgout = (a.*b - c.^2)./(a + b + eps);
0039     imgout=gscale(imgout,'minmax');

Generated on Sun 04-Apr-2010 17:13:59 by m2html © 2005