2

I'm using openCV for android to implement a logo detection algorithm. my goal now is to find a predefined logo in a picture I've taken with the android camera.

I can't get ANY right matches.. I think this is very weird considering I'm almost only using openCV library functions.

First I detect keypoints using FAST detector, my images are 500x500 in size afterwards I use SURF to describe these keypoints. with knn I ask for the 2 best matches, and elliminate those who don't have A ratio smaller than 0.6 (first.distance/ second.distance).

I'm getting around 10 matches, but they are all wrong, when I draw every match (100+), they all seem to be wrong

I can't see what I'm doing wrong here, does anyone have the same problem, or know what I'm doing wrong?

    FeatureDetector FAST = FeatureDetector.create(FeatureDetector.FAST);

    // extract keypoints
    FAST.detect(image1, keypoints);
    FAST.detect(image2, logoKeypoints);

    DescriptorExtractor SurfExtractor = DescriptorExtractor
            .create(DescriptorExtractor.SURF);
    Mat descriptors = new Mat();
    Mat logoDescriptors = new Mat();

    SurfExtractor.compute(image1, keypoints, descriptors);
    SurfExtractor.compute(image2, logoKeypoints, logoDescriptors);

    List<DMatch> matches = new ArrayList<DMatch>();
    matches = knn(descriptors, logoDescriptors);
    Scalar blue = new Scalar(0, 0, 255);
    Scalar red = new Scalar(255, 0, 0);
    Features2d.drawMatches(image2, logoKeypoints, image1, keypoints,
            matches, rgbout, blue, red);
piepie
  • 125
  • 2
  • 10
  • 1
    Have you tried SURF features on SURF keypoints? – Andrey Kamaev Mar 27 '12 at 19:12
  • What is the knn function? Is it implemented correctly? –  Apr 04 '12 at 07:12
  • i tried almost every combination... SIFT-SIFT SURF-SURF FAST-SURF ... every combination has the same problem. the knn function gives you the 2 best matches, by comparing these two matches you can find the matches that really jump out, and have the best chance of being a true positive – piepie Apr 04 '12 at 11:41

1 Answers1

3

I think the problem is the matcher you are using. For floatbased such as (SURF)descriptors use FLANN as a matcher or BRUTEFORCE as a matcher. Also strive to use the same feature descriptor for both extraction and matching...i.e SURF features on SURF keypoints.

Read this post on stackoverflow,and the articles linked in it for better understanding. How Does OpenCV ORB Feature Detector Work?

Community
  • 1
  • 1
Thuita Wachira
  • 176
  • 2
  • 16