FAST Algorithm for Corner Detection

In this demo, we will:

Sources:

Contents

Theory

We saw several feature detectors and many of them are really good. But when looking from a real-time application point of view, they are not fast enough. One best example would be SLAM (Simultaneous Localization and Mapping) mobile robot which have limited computational resources.

As a solution to this, FAST (Features from Accelerated Segment Test) algorithm was proposed by Edward Rosten and Tom Drummond in their paper "Machine learning for high-speed corner detection" in 2006 (later revised it in 2010). A basic summary of the algorithm is presented below. Refer to the original paper for more details (All the images are taken from original paper).

Feature Detection using FAST

This detector in itself exhibits high performance, but there are several weaknesses:

First 3 points are addressed with a machine learning approach. Last one is addressed using non-maximal suppression.

Machine Learning a Corner Detector

Non-maximal Suppression

Detecting multiple interest points in adjacent locations is another problem. It is solved by using Non-maximum Suppression.

Summary

It is several times faster than other existing corner detectors.

But it is not robust to high levels of noise. It is dependant on a threshold.

FAST Feature Detector in OpenCV

It is called as any other feature detector in OpenCV. If you want, you can specify the threshold, whether non-maximum suppression to be applied or not, the neighborhood to be used etc.

For the neighborhood, three flags are defined, TYPE_5_8, TYPE_7_12, and TYPE_9_16. Below is a simple code on how to detect and draw the FAST feature points.

load source image

img = cv.imread(fullfile(mexopencv.root(),'test','blox.jpg'), 'Grayscale',true);

create FAST object with default values, and find keypoints

fast = cv.FastFeatureDetector();
kp1 = fast.detect(img);
fprintf('%d keypoints with NonmaxSuppression\n', numel(kp1));
431 keypoints with NonmaxSuppression

disable NonmaxSuppression and find keypoints

fast.NonmaxSuppression = false;
kp2 = fast.detect(img);
fprintf('%d keypoints without NonmaxSuppression\n', numel(kp2));
1575 keypoints without NonmaxSuppression

draw keypoints from both cases, and show results

out1 = cv.drawKeypoints(img, kp1, 'Color',[255 0 0]);
out2 = cv.drawKeypoints(img, kp2, 'Color',[255 0 0]);
subplot(121), imshow(out1), title('FAST w/ NonmaxSuppression')
subplot(122), imshow(out2), title('FAST w/o NonmaxSuppression')

Additional Resources