Error matching of feature matching algorithm

Source: Internet
Author: User

Feature Matching

Feature matching is a frequently used step in computer vision. By accurately matching the image with the image or the description between the image and the map, we can reduce the heavy burden for the subsequent attitude estimation, optimization and other operations. However, due to the local characteristics of image features, the situation of mis-matching is widely existed. In the matching algorithm of OPENCV

In fact, some of the processing of mis-matching is integrated. Let's start by introducing the brute force matching algorithm.

Violent match

Cv::bfmatcher

Brute force matching refers to finding (exhaustive search) each descriptor in the first group is closest to which descriptor in the second group. Of course the initial violent match gets a lot of mis-matches. We can eliminate the mismatch by a certain degree by cross-matching filtering method.

The idea of this technique is to use a query set to match the training descriptor, and vice versa. Only the matches that appear in both matches are returned. When there are enough matches, this technique usually produces the best results when the number of outliers is minimal.

Cross-matching can be done in the Cv::bfmatcher class. To enable cross-detection experiments, to create an instance of the Cv::bfmatcher class, you would set the second parameter of the constructor to true:

true);

If you do not set a second parameter, it is a normal brute force matching algorithm

We can compare the results of both of these matches

Environment: ubuntu16.04, opencv-3.1.0

Using Orb Features

The code is as follows

#include <iostream>#include<opencv2/core/core.hpp>#include<opencv2/features2d/features2d.hpp>#include<opencv2/highgui/highgui.hpp>using namespacestd;using namespaceCV;intMainintargcChar**argv) {    if(ARGC! =3) {cout<<"usage:feature_extraction img1 Img2"<<Endl; return 1; } Mat img1= Imread (argv[1], Cv_load_image_color); Mat Img2= Imread (argv[2], Cv_load_image_color); //Std::vector<keypoint>Keypoints_1, keypoints_2;    Mat Descriptors_1, descriptors_2; Ptr<ORB> ORB = Orb::create ( -,1.2f,8, to,0,2, Orb::harris_score, to, - ); //Orb->Detect (IMG1, keypoints_1); Orb-Detect (Img2, keypoints_2); //Orb->Compute (IMG1, keypoints_1, descriptors_1); Orb-Compute (IMG2, keypoints_2, descriptors_2); //bfmatcher Matcher1 (norm_hamming); Vector<DMatch>matches1;    Matcher1.match (Descriptors_1, descriptors_2, matches1); //CV::P TR<CV::D escriptormatcher> matcher (New Cv::bfmatcher (Cv::norm HAMMING, true)); //Use in opencv2.xBfmatcher Matcher2 (norm_hamming,true); Vector<DMatch>Matches2;    Matcher2.match (Descriptors_1, descriptors_2, matches2);    Mat Img_match1;    Mat IMG_MATCH2;    Drawmatches (IMG1, Keypoints_1, Img2, Keypoints_2, Matches1, img_match1);    Drawmatches (IMG1, Keypoints_1, Img2, Keypoints_2, Matches2, IMG_MATCH2); Imshow ("Bfmatcher", IMG_MATCH1); Imshow ("Jiao cha match", IMG_MATCH2); Waitkey (0); return 0;}

Execute program get, match result

Violent match

Error matching of feature matching algorithm

Related Article

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.