l'image de fond

fr       en

Interest Points Detection

Features from Accelerated Segment Test

Method

FAST means Features from Accelerated Segment Test. FAST use a circle around the central pixel as a base of computation. Let's take the next pixels as an example where pc is the central pixel.



A circle of radius 3 give us a vecteur of 16 pixels:



We compute for each pixel f the vector the difference between itself and the central pixel. A high and low threshold is then choose aroundthe value of the central pixel. We define 3 states according to the result of the difference:

To understand the algorythm, let's take the next example:



If we apply the previous algorythm, we find the next vector:



We can note that to detect corner, sequence of eleven 1 (or -1) must be contain in the vector. To render the detection more flexible, the algorythm detects sequence from 10 to 12 points.

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);
if length(size(img))>2
    img=mean(img,3);
end
[ligneorigine colonneorigine]=size(img);

%effet de bord
taille=3;
img = wextend(2,'zpd',img,taille);
dolong=0;
[ligne colonne]=size(img);
resultat = zeros(ligne,colonne);
for i = taille+1 : ligne-(taille+1)
    for j = taille+1 : colonne -(taille+1)
        p = img(i,j);
       
        threshold_haut = p+50;
        threshold_haut(threshold_haut>255)=255;
       
        threshold_bas = p-50;
        threshold_bas(threshold_bas<0)=0;
         
        v=[img(i-3,j) img(i-3,j+1) img(i-2,j+2) img(i-1,j+3) img(i,j+3) img(i+1,j+3) img(i+2,j+2) img(i+3,j+1) ...
           img(i+3,j) img(i+3,j-1) img(i+2,j-2) img(i+1,j-3) img(i,j-3) img(i-1,j-3) img(i-2,j-2) img(i-3,j-1)] ;
        v(v<threshold_bas)=-1;
        v(threshold_bas<=v & v<=threshold_haut)=0;
        v(threshold_haut<v)=1;
        v2=[v v];
        v=[img(i-3,j) img(i-3,j+1) img(i-2,j+2) img(i-1,j+3) img(i,j+3) img(i+1,j+3) img(i+2,j+2) img(i+3,j+1) ...
           img(i+3,j) img(i+3,j-1) img(i+2,j-2) img(i+1,j-3) img(i,j-3) img(i-1,j-3) img(i-2,j-2) img(i-3,j-1)] ;
        for ilong = 1 : 16
            if (sum(v2(ilong:ilong+9)) == 10) && (sum(v2(ilong:ilong+10)) ~= 11)
                resultat(i,j)= 1;
            elseif (sum(v2(ilong:ilong+10)) == 11) && (sum(v2(ilong:ilong+11)) ~= 12)
                resultat(i,j)= 1;
            elseif (sum(v2(ilong:ilong+11)) == 12) && (sum(v2(ilong:ilong+12)) ~= 13)
                resultat(i,j)= 1;  
            elseif (sum(v2(ilong:ilong+9)) == -10) && (sum(v2(ilong:ilong+10)) ~= -11)
                resultat(i,j)= 1;
            elseif (sum(v2(ilong:ilong+10)) == -11) &&  (sum(v2(ilong:ilong+11)) ~= -12)
                resultat(i,j)= -1;
            elseif (sum(v2(ilong:ilong+11)) == -12) &&  (sum(v2(ilong:ilong+12)) ~= -13)
                resultat(i,j)= -1;
            end
        end
    end
 
    i
end

resultat = resultat(taille:end-taille-1,taille:end-taille-1);
img = img(taille:end-taille-1,taille:end-taille-1);
figure(  'Name','corner detection FAST',...
         'NumberTitle','off',...
         'color',[0.3137 0.3137 0.5098]);
imshow(uint8(img))
hold on
[ligne colonne]=size(img);
for i = 1 :  ligne
    for j = 1 : colonne
        if resultat(i,j)==1
            plot([j-2 j-2 j+2 j+2 j-2],...
                 [i-2 i+2 i+2 i-2 i-2] ,'r','LineWidth',1)
        elseif resultat(i,j)==-1
            plot([j-2 j-2 j+2 j+2 j-2],...
                 [i-2 i+2 i+2 i-2 i-2] ,'g','LineWidth',1)
        end
    end
end
 

Here is an example

Copyright © 2010-2014, all rights reserved, contact: operationpixel@free.fr