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 7572081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:50:05+00:00 2026-05-30T15:50:05+00:00

I have to implement a logo detection algoritm for android for my masterthesis. I’m

  • 0

I have to implement a logo detection algoritm for android for my masterthesis.
I’m currently using the openCV android library with NDK and have already managed to detect keypoints and setup descriptors for these keypoints using SURF.

Next step for me is to find 2 nearest matches for every keypoint using knnMatch, afterwards i’m throwing away the matches where the best knn match isn’t very distinguishable compared with the second (the distance ration of these two is too low)
here’s a part of my code:

private static List<DMatch> knn(Mat queryDescriptors, Mat trainDescriptors) {
    List<List<DMatch>> matches = new ArrayList<List<DMatch>>();
    List<DMatch> retMatches = new ArrayList<DMatch>();
    DescriptorMatcher matcher = DescriptorMatcher
            .create(DescriptorMatcher.BRUTEFORCE);
    matcher.knnMatch(queryDescriptors, trainDescriptors, matches, 2);

My problem here is that when I have for example 500 descriptors for the query logo and 400 for the train logo, knn returns 500 matches, but every single one is for one and the same keypoint. Normally, it returns the 2 best matches for every descriptor, so 500 different descriptors, now they return 500 times the best matches for one and the same descriptor.

So when i draw these knn matches, there is 1 match line, drawn 500 times, between always the same keypoints

When I try the simple matcher, who simply returns the best match, I get more lines.
I’ve tested this with comparing an image to itself. Knn return this one line, where a simple match draws all 500 matches, who are in this case ofcourse correct.

I can’t find any posts where this similar issue has been treated, does any one had this problem or knows what i’m doing wrong here?

Thanx in advance.

  • 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-05-30T15:50:07+00:00Added an answer on May 30, 2026 at 3:50 pm

    Next time you face a bug in OpenCV, please check if it’s already submitted at OpenCV bug tracker and submit a new one if not found.
    What you faced is a bug in the JNI wrapper to C++ matcher, the fix has been just commited to OpenCV trunk.
    But you can make it locally in your copy of OpenCV-2.3.1, this is just one line of code:

    1. open org.opencv.utils.Converters::Mat_to_vector_vector_DMatch(Mat m, List> lldm) in OpenCV-2.3.1 Android library project (Converters.java)
    2. move the line List<DMatch> ldm = new ArrayList<DMatch>(); two lines down to make it the 1st line of the cycle for (Mat mi : mats)
    3. rebuild the OpenCV-2.3.1 project and your own in Eclipse
    4. make sure that now the matcher returns correct results
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to implement a IExceptionHandler for the Enteprise Library 4.1. In my particular
I have implement paypal library for payment in my iphone project. How can I
I have implement a small web service using .net 3.5. I have used linq
I have implement Wikitude SDK and I manage to initialize using this code: -(IBAction)launchAR:(id)sender{
I have implement GridView Row Editing feature in my .net application using <asp:CommandField .
How can i sort ArrayList in java without using comparator.? I have already used
I have to implement a digital envelope using AES and RSA, but I am
I have an existing android app. I added a simple widget to it using
I have to implement the VinPower application. They offer a Java version, a C
I have to implement MPI system in a cluster. If anyone here has any

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.