OPENCV feature point detection------orb features

Source: Internet
Author: User

Orb algorithm

The Orb is the abbreviation of oriented brief. The description of the Orb is in the following article:

Ethan Rublee and Vincent Rabaud and Kurt Konolige and Gary Bradski, Orb:an efcient alternative to SIFT or SURF, ICCV 2011

Did not add the link is because the author did not release the paper, but OPENCV2.3RC has been implemented, Willowgarage has a talk also mentioned this algorithm, so I do not carry shallow, summed up here.

Brief is the abbreviation for binary robust independent elementary features. This characterization is presented by the calonder of EPFL in ECCV2010. The main idea is to randomly select several pairs of points near the feature points, combine the gray values of these points into a binary string, and use the binary string as the feature descriptor of the feature point. Detailed algorithm descriptions refer to the following papers:

Calonder M., Lepetit v., Strecha C., Fua P.: brief:binary robust Independent elementary Features. ECCV 2010

Note In brief eccv2010 's article, each of the brief descriptors is a binary comparison of randomly selected two pixel points. The article also mentions that prior to this, you need to select the appropriate Gaussian kernel to smooth the image. (why emphasize this, as the orb below has improved this.) )

The advantage of brief is the speed, the disadvantage is quite obvious:

1: Does not have rotational invariance.

2: Noise-sensitive

3: Do not have scale invariance.

The Orb is trying to solve the 1 and 2 of these drawbacks.

How to resolve rotation invariance:

In the Orb scheme, fast is used as the feature point detection operator. Fast application of a lot of, is famous fast, in case someone does not know, please see here:

In the SIFT scenario, the main direction of the feature point is determined by the direction of the maximum value of the gradient histogram and the bin corresponding to the sub-large value. It's a little too time consuming.

In the ORB scheme, the main direction of the feature point is calculated by the moment (moment), and the formula is as follows:

Once you have the main direction, you can extract the brief descriptors based on the main direction. However, the problem is that because the main direction will change, the correlation of random point pairs will be relatively large, thus reducing the discriminant of the descriptors. The solution is also straightforward, taking a greedy, brute-force approach to finding a less correlated random point pair.

How to address noise-sensitive issues:

As mentioned earlier, in the earliest eccv2010 article, brief used the size of pixel and pixel to construct each bit of the descriptor. The result is noise-sensitive. Thus, in the Orb scheme, this improvement was made, instead of using the Pixel-pair, but using the 9x9 Patch-pair, that is, comparing the pixel values of the patch. (can be calculated quickly with the integration chart).

About scale invariance:

The Orb does not attempt to solve scale invariance (because fast itself does not have scale invariance.) But this is only the speed of the feature descriptor, is generally applied in real-time video processing, so that can be traced by some heuristic strategy to solve the problem of scale invariance.

About calculation speed:

The orb is 100 times times the size of the SIFT, 10 times times the surf.

About Performance:

Below is a performance comparison, The Orb is still very powerful. Click to see a larger image.

Reference slides

Related Posts
    • ANDROID-OPENCV's Cvcamera (1)

Use of newly added ORB features in the latest version of OPENCV

Category: OpenCV study c++2011-11-30 12:1,511,612 people read comments (16) Favorite Reports

Floatimagedistancevectorobjectless

See OpenCV2.3.1 inside the Orb feature extraction algorithm is also inside, applied to the Surf feature example program to the Orb feature has been prompted wrong, type does not match God horse, because no sample program, can only find the answer.

(ORB feature paper: Orb:an efficient alternative to SIFT or SURF. Click to download the paper)

After finding:

Descriptor data types are float, such as Sift,surf descriptors, and Uchar, such as Orb,brief

For float matching methods are:

Flannbased

bruteforce<l2<float> >

bruteforce<sl2<float> >

bruteforce<l1<float> >

For Uchar there are:

Bruteforce

Bruteforce

bruteforcematcher< l2<float> > matcher;//Change of place

The complete code is as follows:

#include <iostream> #include "opencv2/core/core.hpp" #include "opencv2/features2d/features2d.hpp" #include " Opencv2/highgui/highgui.hpp "#include <iostream> #include <vector>using namespace cv;using namespace std; int main () {Mat img_1 = Imread ("d:\\image\\img1.jpg"); Mat img_2 = Imread ("d:\\image\\img2.jpg"), if (!img_1.data | |!img_2.data) {cout << "error reading images" << E ndl;return-1;} ORB orb;vector<keypoint> keypoints_1, keypoints_2; Mat Descriptors_1, Descriptors_2;orb (Img_1, Mat (), Keypoints_1, Descriptors_1), Orb (Img_2, Mat (), keypoints_2, Descriptors_2); Bruteforcematcher

In addition: SURF SIFT

/*
SIFT SIFT;
Sift (img_1, Mat (), Keypoints_1, descriptors_1);
Sift (Img_2, Mat (), keypoints_2, descriptors_2);
bruteforcematcher<l2<float> > Matcher;
*/
/*
SURF SURF;
Surf (img_1, Mat (), keypoints_1);
Surf (img_2, Mat (), keypoints_2);
Surfdescriptorextractor Extrator;
Extrator.compute (img_1, Keypoints_1, descriptors_1);
Extrator.compute (Img_2, keypoints_2, descriptors_2);
bruteforcematcher<l2<float> > Matcher;
*/

Effect:

The other is looking for a target match.

In the right scene, look for the Starbucks sign on the left side of the picture.

The effect is as follows:

You need to add the following code before the previous imshow to complete a simple feature display:

Localize the objectstd::vector<point2f> obj;std::vector<point2f> scene;for (size_t i = 0; i < Good_match Es.size (); ++i) {//Get the keypoints from the Good Matchesobj.push_back (keypoints_1[good_matches[i].queryidx].pt); scene.push_ Back (keypoints_2[good_matches[i].trainidx].pt);} Mat H = findhomography (obj, scene, CV_RANSAC);//Get the corners from the image_1std::vector<point2f> obj_corners ( 4); Obj_corners[0] = Cvpoint (0,0); obj_corners[1] = Cvpoint (img_1.cols, 0); obj_corners[2] = Cvpoint (Img_1.cols, img_1. rows); Obj_corners[3] = Cvpoint (0, img_1.rows);std::vector<point2f> scene_corners (4);p erspectivetransform (obj  _corners, Scene_corners, H);//Draw lines between the corners (the mapped object in the scene-image_2) line (Img_matches, Scene_corners[0] + point2f (img_1.cols, 0), scene_corners[1] + point2f (img_1.cols, 0), Scalar (0,255,0)); line (Img_matche S, Scene_corners[1] + point2f (img_1.cols, 0), scene_corners[2] + point2f (img_1.cols, 0), Scalar (0,255, 0)), line (Img_matches, scene_corners[2] + point2f (img_1.cols, 0), scene_corners[3] + point2f (img_1.cols, 0), Scalar (0,2 55,0)) line (Img_matches, scene_corners[3] + point2f (img_1.cols, 0), Scene_corners[0] + point2f (img_1.cols, 0), Scalar (0 , 255,0));

Code slices:

#include "opencv2/highgui/highgui.hpp" #include "opencv2/features2d/features2d.hpp" #include <iostream> int     Main () {CV::P tr<cv::featuredetector> detector = cv::featuredetector::create ("SIFT");     CV::P TR&LT;CV::D escriptorextractor> extractor = CV::D escriptorextractor::create ("SIFT");     Cv::mat im = Cv::imread ("Box.png", Cv_load_image_color);     Std::vector<cv::keypoint> keypoints;     Cv::mat descriptors;     Detector->detect (IM, keypoints);  Extractor->compute (im,keypoints,descriptors);  int duplicatenum = 0; for (int i=0;i<keypoints.size (), i++) {for (int j=i+1;j<keypoints.size (); j + +) {Float dist = ABS (Keypo  ints[i].pt.x-keypoints[j].pt.x)) +abs ((KEYPOINTS[I].PT.Y-KEYPOINTS[J].PT.Y));  if (dist = = 0) {Cv::mat Descriptordiff = Descriptors.row (i)-descriptors.row (j);              Double diffnorm = Cv::norm (Descriptordiff); std::cout<< "KeyPoint" <<i<< "equal to KeyPoint" <<j<< "Descriptor Distance" <<diffNorm<<std::endl;           duplicatenum++; }}} std::cout<< "Total KeyPoint:" <<keypoints.size () << ", Duplicatenum:" <<duplicat  enum<<std::endl;  return 1;   }


OPENCV feature point detection------orb features

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.