Fast feature detection

Source: Internet
Author: User
Features From Accelerated Segment Test1. principles of the FAST algorithm

The blog has introduced many Image feature detection operators. We can use LoG or DoG to detect Blobs in images ), the Harris corner can be obtained based on the local auto-correlation function of the image ), two excellent feature points and their description methods are described later. The SURF feature is an approximation of the SIFT feature to improve the computing efficiency. Although it has been achieved in some experimental environments in real time, in our practical engineering applications, feature extraction and matching are only part of the entire application algorithm. Therefore, we must have higher requirements for feature extraction. From this point of view, the feature vertices mentioned earlier cannot be extracted.

To solve this problem, Edward Rosten and Tom Drummond proposed a FAST feature in the "Machine learning for high-speed corner detection [1]" article published in 2006, this paper was revised in 2010 and then published again [2]. FAST is called Features From Accelerated Segment Test. Rosten et al. defined the FAST corner point as: if a certain pixel is in a different area from enough pixels in the surrounding area, the pixel may be a corner point. That is to say, some attributes are different. For a gray image, if the gray value of the point is large or small than the gray value of enough pixels in its surrounding area, the point may be an angle.

2. FAST algorithm steps

 

  1. Select a pixel $ P $ from the image. Next we will determine whether it is a feature point. First, set the brightness value to $ I _p $.
  2. Set an appropriate threshold value $ t $.
  3. Consider a discretization Bresenham circle with a radius equal to 3 pixels centered on this pixel. The boundary of this circle has 16 pixels (1 ).

    Figure 1 FAST feature

  4. Now, if $ n $ consecutive pixels exist on a 16-pixel circle, their pixel values are either larger than $ I _p + t $, it is either smaller than $ I _p-t $, so it is an angle. (As shown in the white dotted line in 1 ). The value of $ n $ can be set to 12 or 9. Experiments show that 9 may have better results.

 

In the above algorithm, for each vertex in the image, we need to traverse the 16 vertices on the neighboring Circle, which is less efficient. We propose an efficient test (high-speed test) to quickly exclude a majority of non-corner pixels. This method only checks pixels at positions 1, 9, 5, and 13. First, it detects positions 1 and 9. If they are darker than the threshold or brighter than the threshold, then we can detect location 5 and location 13. If $ P $ is a corner, at least three of the above four pixels must be greater than $ I _p + t $ or less than $ I _p-t $, because if it is a corner, the part with more than 3/4 circles must meet the judgment conditions. If not, $ p $ cannot be a corner. After the preliminary detection of all vertices, the qualified vertices will become candidate vertices. We will perform a complete test on the candidate vertices, it is used to detect all vertices on a circle.

 

The above algorithm is actually very efficient, but it has some disadvantages:

  1. When we set $ n <12 $, we cannot use a fast algorithm to filter non-corner points;
  2. The detected corner points are not optimal because their efficiency depends on the sorting of problems and the distribution of corner points;
  3. Corner analysis results are discarded;
  4. Multiple feature points are easily merged.
3. Use machine learning as a corner classifier

 

  1. First, select many test images in the application scenario where you extract corner points.
  2. Run the FAST corner detection algorithm to obtain all corner features of the test image set.
  3. For each corner point, we store the 16 points in the adjacent circle in a vector and process the corner points obtained in step 2, and store them in $ P $.
  4. For the point $ p $ on the image, the position on the surrounding circle is $ x, the point of x \ in \ {1 \ dots16 \} $ is represented as $ p \ to x $. You can use the following judgment formula to divide the Point $ p \ to x $ into three categories: $ S _ {p \ to x }=\begin {cases} d, & I _ {p \ to x} \ le I _p-t & (darker) \ s, & I _p-t \ le I _ {p \ to x} <I _p + t & (similar) \ B, & I _p + t \ le I _ {p \ to x} & (brighter) \ end {cases} $
  5. Set $ P $ to the set of all pixels in the training image set. One of the 16 positions is $ x $. You can divide the set $ P $ into three parts. $ P_d, p_s $ and $ P_ B $. The definitions of $ P_d $ are as follows. The definitions of $ P_s $ and $ P_ B $ are similar to those of $ P_ B =\{ p \ in P: S _ {p \ to x} = B \} $ in other words, for any given position $ x $, points in all images can be divided into three types, class 1 $ P_d $ includes pixels at all locations $ x $, which are hidden from the center pixel at the threshold $ t $, class 2 $ P_s $ includes pixels at all positions $ x $. The pixels are similar to the center pixels at the threshold $ t $, $ P_ B $ includes pixels at all locations $ x $, which are highlighted in the center pixel at the threshold $ t $.
  6. Define a new Boolean variable $ K_p $. If $ p $ is a corner, those $ K_p $ values are values, otherwise they are false.
  7. The ID3 algorithm (decision tree classifier) is used to query each subset.
  8. Recursively calculates all subsets until the entropy of $ K_p $ is 0;
  9. The created decision tree is used for FAST detection of other images.
4. Non-maximum suppression

Selecting multiple feature points from neighboring locations is another problem. We can use Non-Maximal Suppression to solve this problem.

  1. Calculate the response size (score function) $ V $ for each detected feature. Here $ V $ is defined as the sum of absolute deviations between the vertex $ p $ and the 16 pixels around it.
  2. Consider two adjacent feature points and compare their $ V $ values.
  3. Points with a lower value of $ V $ will be deleted.
5. FAST feature detection in OpenCV

The FAST feature extraction function in OpenCV is FAST. It has four parameters. The first parameter is the input image, the second parameter is the returned feature point, the third parameter is the defined threshold, and the fourth parameter determines whether to use non-maximum suppression.

Void FAST (InputArray image, vector <KeyPoint> & keypoints, int threshold, bool nonmaxSuppression = true) C ++: void FASTX (InputArray image, vector <KeyPoint> & keypoints, int threshold, bool nonmaxSuppression, int type)

Another interface is FASTX, which provides the fifth parameter type to specify the parameters of the pixel circle in FAST detection: TYPE_9_16, TYPE_7_12, and TYPE_5_8.

# Include <opencv2/core. hpp> # include <opencv2/highgui. hpp> # include <opencv2/imgproc. hpp> # include <opencv2/features2d/features2d. hpp> using namespace cv; using namespace std; int main (int argc, char ** argv) {Mat img = imread ("box.png"); std :: vector <KeyPoint> keypoints; FAST (img, keypoints, 20); // -- Draw keypoints Mat img_keypoints; drawKeypoints (img, keypoints, img_keypoints, Scalar: all (-1 ), drawMatchesFlags: DEFAULT); // -- Show detected (drawn) keypoints imshow ("Keypoints", img_keypoints); waitKey (0); return 0 ;}

    

6. Summary

The FAST algorithm is much faster than other known corner detection algorithms, but it is not robust when there is a large amount of noise in the image, in addition, the algorithm effect depends on a threshold value of $ t $. In addition, FAST does not generate multi-scale features and FAST feature points do not have direction information, which will lead to loss of rotation immutability.

[1] Edward Rosten and Tom Drummond, "Machine learning for high speed corner detection" in 9th European Conference on Computer Vision, vol. 1, 2006, pp. 430-443.

[2] Edward Rosten, Reid Porter, and Tom Drummond, "Faster and better: a machine learning approach to corner detection" in IEEE Trans. pattern Analysis and Machine Intelligence, 2010, vol 32, pp. 105-119.

Fast feature detection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.