Skip to content

FAST corner detector

Fact Value
Also called Features from accelerated segment test
Status Implemented and tested
Family Texture, corners, blobs and features
Engine Browser
Type Nonlinear, spatial, segment test on a circle
Output Image
Operator shown as algorithm (exact)
Support radius 3, plus the minimum distance for the corners output
Code web/src/core/filters/features/corners.ts, fastFilter
Operator code web/src/core/filters/features/corners.ts, fastScore
Channels Brightness only, RGB

Overview

FAST, short for features from accelerated segment test, finds corners with comparisons only. It reads 16 pixels on a circle around each pixel. When a long run of them is all clearly brighter or all clearly darker than the center, the pixel is a corner. A score then lets non-maximum suppression keep one point per corner.

Three panels: two bright rectangles and a bright triangle on a dark background, the FAST score with small bright spots at the corners, and the corner points as single white dots at the eleven corners. Three panels: two bright rectangles and a bright triangle on a dark background, the FAST score with small bright spots at the corners, and the corner points as single white dots at the eleven corners.
FAST on bright shapes. The score is high at the corners, and the corner points mark them.

How it works

  1. Read the 16 pixels on a circle of radius 3 around each pixel.
  2. Look for at least n of them in a row that are all brighter than the center plus the threshold, or all darker than the center minus it.
  3. Score the pixels that pass by the summed contrast above the threshold.
  4. For corner points, keep the pixels whose score is the largest nearby.

Mathematical foundation

\[ R(p) = \max\left(\sum_{x \in S_b} \left(I_x - I_p - t\right),\ \sum_{x \in S_d} \left(I_p - I_x - t\right)\right) \;\text{ if } p \text{ passes the segment test, else } 0 \]

The formula shows the default parameter values.

where

  • \(I_p\): The value at the center
  • \(t\): The threshold
  • \(S_b, S_d\): The brighter and the darker circle pixels
  • \(n\): The run length

The circle holds 16 pixels at radius 3 around p. S_b holds the circle pixels brighter than I_p + t and S_d those darker than I_p - t. The segment test passes when at least n circle pixels in a row are all in S_b or all in S_d. Rosten and Drummond proposed this score for non-maximum suppression. Values are on a 0 to 1 scale. The corners output keeps pixels with a score above 0 that are the largest within the minimum distance. The segment test gives the same corners as skimage.feature.corner_fast, whose score is computed differently.

Along a straight edge, about half the circle is brighter and half is darker, so runs stay at about 8 pixels. At a corner, one side of the circle covers much more than half, so a run of 9 or more appears. Rosten and Drummond used machine learning to order the tests for speed, which does not change the result. The score sums |I - I_p| - t over the brighter or the darker circle pixels, whichever sum is larger.

Kernel or operator

There is no kernel. The Inspector lists the segment test and the score with the current run length and threshold.

Algorithm

  1. Extend the image by the support with the border mode and scale it to 0 to 1.
  2. Read the 16 circle pixels around each pixel.
  3. Test for a run of n circle pixels that are all brighter or all darker.
  4. Score the pixels that pass, and give 0 to the rest.
  5. For corner points, keep the local maxima of the score, and cut the extension off.

Parameters

Parameter Default Values Meaning
Run length n 9 9 to 16 How many circle pixels in a row must all be brighter or all be darker.
Threshold threshold 0.15 0 to 1 How much brighter or darker a circle pixel must be than the center. Values are on a 0 to 1 scale.
Output output FAST score FAST score, Corner points The score at every pixel, or the corner points as white pixels.
Minimum distance distance 1 1 to 20 px A corner must have the largest score within this many pixels in x and in y.
Output mapping outputMapping Stretch to full range Absolute value, Offset by 128, Stretch to full range, Clip to 0 to 255 How signed results, such as gradients, become 8-bit pixel values.
Border mode border Reflect 101 (default) Reflect 101 (default), Reflect, Replicate, Constant (zero), Wrap How pixels outside the image are filled when the window reaches past the edge.
Channels channelScope Brightness only RGB, Brightness only Which part of the color image the filter changes.

Implementation

fastScore in web/src/core/filters/features/corners.ts runs the segment test on every pixel and scores the pixels that pass. The filter extends the plane once by the support with the border mode, so strips and whole images agree. The filter runs in the browser engine, in Web Workers, through the shared filter framework in web/src/core/filters/run.ts, which handles the channel scope, alpha and the output mapping. By default it works on luma.

Worked example

Circle pixel 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Value 40 200 200 200 200 200 200 200 200 200 200 200 40 40 40 40

The center of a 7 x 7 patch has the value 40. The patch is 200 where x or y is 4 or more, so the center sits at the inside corner of a bright L. 11 circle pixels in a row are brighter than 40 / 255 + 0.15, and none are darker. With n = 9 the segment test passes, and the score is 11 x (200 / 255 - 40 / 255 - 0.15) = 5.2520. With n = 12 the run is too short, so the score is 0.

Complexity

  • Time: \(O(N)\)
  • Memory: \(O(N)\)

N is the number of pixels per channel. Each pixel reads 16 others.

Artifacts and limitations

Limitations

  • Not scale invariant. One circle size fits one corner size.
  • Sensitive to noise, since single pixels decide the test.

Artifacts

  • Clusters of corners along strong curved edges when the threshold is low.

Tests

The reference runs the same test and score with NumPy. Before the cases are written, the script checks that the segment test finds the same corners as skimage.feature.corner_fast on a random image. The reference rounds scores to 32-bit floats before comparing neighbors, as the filter does, so ties next to a reflected border agree. The cases cover two run lengths and thresholds and both outputs for all five border modes.

References