l'image de fond

fr       en

Interest Points Detection

SUSAN corner detection algorithm

Method

SUSAN means Smallest Univalue Segment Assimilating Nucleus. SUSAN uses a mask in disk shape centred on the pixel to analyse. For each pixel 'p' belonged into the mask we do the comparizon with the nucleus 'pn' thanks to the next function:

c ( p ) = e - ( I ( p ) - I ( p n ) ) 6 t


where 't' is the radius of the disk. Then we compute the sum of each comparizon of the mask.

n ( p n ) = p c ( p )

Then, we use the next condition:

R ( p n ) = { g - n ( p n )  if  n(pn)<g  0  elsewhere  }

'g' is called geometric threshold. If 'g' is enough large, SUSAN become an edge detector.

Program

clear all;
close all;
[filename, pathname] = uigetfile({'*.jpg;*.tif;*.png;*.gif;*.bmp','All Image Files';...
          '*.*','All Files' },'mytitle',...
          'C:\Work\myfile.jpg')
img = imread(filename);
img=mean(img,3);

[ligneorigine colonneorigine]=size(img);
%h    = [0 0 1 1 1 0 0
%         0 1 1 1 1 1 0
%         1 1 1 1 1 1 1
%         1 1 1 1 1 1 1
%         1 1 1 1 1 1 1
%         0 1 1 1 1 1 0
%         0 0 1 1 1 0 0];
taille = 3;
h = double(fspecial('disk', taille)>0);
nb1 = sum(sum(h))





%effet de bord
img = wextend(2,'zpd',img,taille);

[ligne colonne]=size(img);
d=zeros(ligne,colonne);

somme=0;
g= 3*nb1/4;
radius = 2*taille;
for i = taille+1 : ligne-(taille+1)
    for j = taille+1 : colonne -(taille+1)
          for l = -taille : taille
              for c = -taille : taille
                  if h(l+taille+1,c+taille+1)
                    inter = (img(i+l,j+c)-img(i,j));
                    somme = somme + exp(-((inter/radius)^6));
                  end
              end
          end
          d(i,j)=somme;
          somme=0;

    end
    i
end

img = img(taille:end-taille-1,taille:end-taille-1);
d = d(taille:end-taille-1,taille:end-taille-1);

[ligne colonne]=size(img);
r=zeros(ligne,colonne);
nmax=max(max(d))*3/4;
nmax=max(max(d))/2;
for i = 1 : ligne
    for j = 1 : colonne
          if d(i,j)== 0
              r(i,j)=nmax;
          elseif d(i,j)< nmax
              r(i,j)=d(i,j);
          else
              r(i,j)=nmax;
          end
    end
end
r=abs(r-nmax);

h=h/sum(sum(h));
r=conv2(r,h,'same');
[zmax,imax,zmin,imin]= extrema2(r);

imshow(uint8(img))

hold on
nb=100;
if length(imax)>nb
    nbcorner = nb;
else
    nbcorner=length(imax);
end
for i = 1 :  nbcorner %length(imax)
    quotien= floor(imax(i)/ligne);
    reste = imax(i) - quotien*ligne;
    plot([quotien-2 quotien-2 quotien+2 quotien+2 quotien-2],...
        [reste-2 reste+2 reste+2 reste-2 reste-2] ,'r','LineWidth',1)
end

Example


pointinteret_susan
The SUSAN algorithm applied as a edge detector.
pointinteret_susanedge

Copyright © 2010-2014, tous droits réservés, contact : operationpixel@free.fr