Binary Robust Independent Elementary Features 1. Basic principles of BRIEF
We already know that the SIFT feature uses a 128-dimension feature description child. Because the floating point used to describe the child, it will occupy 512 bytes of space. Similarly, for the SURF feature, a 64-dimensional description is commonly used, which also occupies bytes of space. If an image contains 1000 feature points (not surprising, this is normal), The SIFT or SURF feature descriptor will occupy a large amount of memory space, for applications with tight resources, especially embedded applications, such feature descriptions are obviously not feasible. In addition, the larger the space occupied, the longer the matching time.
But in fact, not all dimensions play a substantial role in matching in the feature descriptor of SFIT or SURF. We can use PCA, LDA, and other feature dimensionality reduction methods to compress the feature description subdimensions. There are also some algorithms, such as LSH, which convert the feature descriptor of SIFT into a binary code string, and then use the Hamming distance to match the feature points. This method will greatly improve the matching between features, because the calculation of the Hamming distance can be achieved by using an exclusive or operation and then computing the binary digits, which is very convenient in the modern computer structure. Next we will extract the feature descriptor of a binary string.
BRIEF [1] came into being. It provides a shortcut to calculate binary strings without having to calculate a feature descriptor similar to SIFT. It first needs to smooth the image, and then select a Patch around the feature points. In this Patch, select $ n_d $ points through a selected method. Then, for each vertex $ (p, q) $, we will compare the brightness values of the two vertices, if $ I (p)> I (q) $ then this point generates a value of 1 in a binary string. If $ I (p) <I (q) $, the value corresponding to the binary string is-1, otherwise it is 0. When all $ n_d $ point pairs are compared, a $ n_d $ Long binary string is generated.
For $ n_d $ options, we can set them to 128,256 or 512. These three parameters are provided in OpenCV, but the default parameter in OpenCV is 256. In this case, the Hamming distance of non-matching points shows a Gaussian distribution with the mean value of 128 ratio features. Once the dimension is selected, we can use the Hamming distance to match these descriptors.
It is worth noting that for BRIEF, it is only a feature descriptor and does not provide a method to extract feature points. Therefore, if you need to locate a feature point, such as FAST, SIFT, and SURF. Here, we will use the CenSurE method to extract key points. For BRIEF, CenSurE performs a little better than SURF features.
In general, BRIEF is a very efficient method for extracting feature descriptors. At the same time, it has a good recognition rate, but when the image is rotated in a large plane.
2. Point-to-point selection
Set the size of the neighbor block of the feature point to $ S \ times S $ and select $ n_d $ points to $ (p, q) $, in Calonder's experiment, five sampling methods are tested:
1) Average sampling within the image block;
2) $ p $ and $ q $ both conform to the Gaussian distribution of $ (0, \ frac {1} {25} S ^ 2) $;
3) $ p $ matches the Gaussian distribution of $ (0, \ frac {1} {25} S ^ 2) $, while $ q $ Matches $ (0, \ frac {1} {100} S ^ 2) Gaussian distribution of $;
4) random sampling at discrete positions in space quantization polar coordinates
5) set $ p $ to $ (0, 0) $, $ q $ for average sampling around
The following is the result of the above five sampling methods.
2. OpenCV implementation of BRIEF
# Include <opencv2/core. hpp> # include <opencv2/highgui. hpp> # include <opencv2/imgproc. hpp> # include <opencv2/features2d/features2d. hpp> using namespace cv; int main (int argc, char ** argv) {Mat img_1 = imread ("box.png"); Mat img_2 = imread ("box_in_scene.png "); // -- Step 1: Detect the keypoints using STAR Detector std: vector <KeyPoint> keypoints_1, keypoints_2; StarDetector detector; detector. detect (img_1, keypoints_1); detector. detect (img_2, keypoints_2); // -- Stpe 2: Calculate descriptors (feature vectors) BriefDescriptorExtractor brief; Mat descriptors_1, descriptors_2; brief. compute (img_1, keypoints_1, descriptors_1); brief. compute (img_2, keypoints_2, descriptors_2); // -- Step 3: Matching descriptor vectors with a brute force matcher BFMatcher matcher (NORM_HAMMING); std: vector <DMatch> mathces; matcher. match (descriptors_1, descriptors_2, mathces); // -- dwaw matches Mat img_mathes; drawMatches (img_1, keypoints_1, img_2, keypoints_2, hcmates, img_mathes ); // -- show imshow ("Mathces", img_mathes); waitKey (0); return 0 ;}
[1] Michael Calonder, Vincent Lepetit, Christoph Strecha, and Pascal Fua, "BRIEF: Binary Robust Independent Elementary Features", 11th European Conference on Computer Vision (ECCV), Heraklion, Crete. LNCS Springer, September 2010.
BRIEF feature description