Feature Descriptors always the same ?

asked 2014-01-20 16:09:24 -0600

Hey,

I am new to OpenCV and I'm working on an image recognition/matching iPhone App. The aim is to take a picture and to compare the matching to other pictures and find the correct picture.

For saving calculation time I wanted to store my descriptors of the images in a database. So I created some little classes, which handle that problem. But when I looked at my database every entry was exactly the same. This was not a fault of my code I think. I compared the cv::Mat descriptors output for all images and it exactly looks equal.

I know that my image recognition works quite good. But how could that work without different descriptors.

I am using ORBFeatureDetection and ORBDescriporExtraction

image description

At my picture you can see the output for my image. Which of these values are important for the BFMatcher or the FlannBasedMatcher to compare the images.

Here's an output of a different image:

image description

As you can see its exactly the same.

So how could the matcher two exactly same descriptors.

Here's some sample Code:

- (cv::Mat)getDescriptorForImage:(cv::Mat)image andKeypoints:(std::vector<cv::KeyPoint>)keypoints {
cv::Mat descriptors;

cv::OrbDescriptorExtractor extractor;
extractor.compute( image, keypoints, descriptors);

if ( descriptors.empty() )
    cvError(0,"MatchFinder","1st descriptor empty",__FILE__,__LINE__);

if(descriptors.type()!=CV_32F) {
    descriptors.convertTo(descriptors, CV_32F);
}

return descriptors;

}

edit retag flag offensive close merge delete

Comments

since the data ptr is the same for both items, i'm suspecting, the problem is more in the database --> descriptor code ( you don't show that ).

berak gravatar imageberak ( 2014-01-20 17:02:55 -0600 )edit

This data above is before converting it for the database. It's taken right after extracting it with the ORBDescriptorExtractor

I know that it works, because the matching works. But which is the important data for the matching? Everything looks like it is the same

AlexanderH gravatar imageAlexanderH ( 2014-01-21 01:07:57 -0600 )edit

Found the problem: I was not able to read out the "data" because it's somewhere in the memory. You could read it out if you write the Mat File to an XML file

AlexanderH gravatar imageAlexanderH ( 2014-01-25 05:20:12 -0600 )edit

"Which of these values are important for the BFMatcher or the FlannBasedMatcher to compare the images. " Non of these values, in fact. You only show the adresses (pointers) of your data and not the descriptors. You only have to save the descriptor matrix (and the keypoints).

NikolasE gravatar imageNikolasE ( 2014-01-25 05:22:25 -0600 )edit