Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7775969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:45:30+00:00 2026-06-01T17:45:30+00:00

Here’s my problem. I manually extracted key points features with SURF on multiple images.

  • 0

Here’s my problem. I manually extracted key points features with SURF on multiple images. But I also already know which pair of points are going to match. The thing is, I’m trying to create my matching pairs, but I don’t understand how. I tried by looking at the code, but it’s a mess.

Right now, I know that the size of the features.descriptors, a matrix, is the same as the number of key points (the other dimension is 1). In the code, to detect matching pairs, it’s only using the descriptors, so it’s comparing rows (or columns, I’m not sure) or two descriptors matrix and determined if there’s anything in common.

But in my case, I already know that there’s a match between keypoint i from image 1 and keypoint j from image 2. How do I describe that as a MatchesInfo value. Particularly the element matches of type std::vector< cv::DMatch >.

EDIT: So, for this, I don’t need to use any matcher or anything like this. I know which pairs are going together!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:45:31+00:00Added an answer on June 1, 2026 at 5:45 pm

    If I understood you’re question correctly, I assume that you want the keypoint matches in std::vector<cv::DMatch> for the purpose of drawing them with the OpenCV cv::drawMatches or usage with some similar OpenCV function. Since I was also doing matching “by hand” recently, here’s my code that draws up arbitrary matches contained originally in a std::vector<std::pair <int, int> > aMatches and displays them in a window:

    const cv::Mat& pic1 = img_1_var;
    const cv::Mat& pic2 = img_2_var;
    const std::vector <cv::KeyPoint> &feats1 = img_1_feats;
    const std::vector <cv::KeyPoint> &feats2 = img_2_feats;
        // you of course can work directly with original objects
        // but for drawing you only need const references to
        // images & their corresponding extracted feats
    
    std::vector <std::pair <int, int> > aMatches;
        // fill aMatches manually - one entry is a pair consisting of
        //      (index_in_img_1_feats, index_in_img_2_feats)
    
    
    // the next code draws the matches:
    std::vector <cv::DMatch> matches;
    matches.reserve((int)aMatches.size());
    
    for (int i=0; i < (int)aMatches.size(); ++i)
        matches.push_back(cv::DMatch(aMatches[i].first, aMatches[i].second,
                          std::numeric_limits<float>::max()));
    
    cv::Mat output;
    
    cv::drawMatches(pic1, feats1, pic2, feats2, matches, output);
    
    cv::namedWindow("Match", 0);
    cv::setWindowProperty("Match", CV_WINDOW_FULLSCREEN, 1);
    cv::imshow("Match", output);    
    cv::waitKey();
    cv::destroyWindow("Match");
    

    Alternatively, if you need fuller information about the matches for purposes more complicated than drawing then you might also want to set the distance between matches to a proper value. E.g. if you want to calculate distances using L2 distance, you should replace the following line:

    for (int i=0; i < (int)aMatches.size(); ++i)
        matches.push_back(cv::DMatch(aMatches[i].first, aMatches[i].second,
                          std::numeric_limits<float>::max()));
    

    with this (note, for this a reference to feature descriptor vectors is also needed):

    cv::L2<float> cmp;
    
    const std::vector <std::vector <float> > &desc1 = img_1_feats_descriptors;
    const std::vector <std::vector <float> > &desc2 = img_2_feats_descriptors;
    
    for (int i=0; i < (int)aMatches.size(); ++i){
        float *firstFeat = &desc1[aMatches[i].first];
        float *secondFeat = &desc2[aMatches[i].second];
        float distance = cmp(firstFeat, secondFeat, firstFeat->size());
        matches.push_back(cv::DMatch(aMatches[i].first, aMatches[i].second,
                          distance));
    }
    

    Note that in the last snippet, descX[i] is a descriptor for featsX[i], each element of the inner vector being one component of the descriptor vector. Also, note that all descriptor vectors should have the same dimensionality.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's a problem I ran into recently. I have attributes strings of the form
Here's a coding problem for those that like this kind of thing. Let's see
Here's an interesting problem. On a recently installed Server 2008 64bit I opened IE
Here is my problem : I have a post controller with the action create.
Here my problem: @Assert\Regex( * pattern=/^[A-Za-z0-9][A-Za-z0-9\]*$/, * groups={creation, creation_logged} * ) I'm using the
Here's the link: www.mchenry.edu/maps/google.asp Why won't the location balloon display correctly? Also, the pop-up
Here is the situation. I am making changes to an application but I do
Here is my code sample, let me know if it can be further improved?
here's what we have today: * NxM grid of points in 3D * we
Here is another spoj problem that asks how to find the number of distinct

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.