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);