Ask Your Question
1

Use cv::DescriptorMatcher to match my own feature descriptors

asked 2018-06-09 05:49:20 -0600

sazr gravatar image

Can I use cv::DescriptorMatcher to find matches for my custom keypoint descriptors? As a learning exercise I have created my own simple keypoint descriptor. I now need to determine, given 2 lists of descriptors, which match. I came across OpenCV's cv::DescriptorMatcher, can I simply use this for my own custom keypoint descriptors?

Heres my simple keypoint descriptor:

struct MyDescriptor {
    double meanIntensity;
    double stdDevIntensity;
    double meanMag;
    double stdDevMag;
    double meanDir;
    double stdDevDir;
};

Will this work? I imagine I need to convert each of my descriptors from a struct to a vector of length 6 then I just feed it into the cv::DescriptorMatcher? Do I also need to implement a comparison function that measures the 'closeness'/similarity between 2 descriptors or will the class do this for me?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2018-06-09 05:59:02 -0600

berak gravatar image

i think, that's a nice idea !

the DescriptorMatcher classes expect a cv::Mat as input, so your struct won't do, but a vector<double> will be automatically converted to a cv::Mat.

Do I also need to implement a comparison function

no. but you should make sure, that your DescriptorMatcher is using the L2 distance, like:

BFMatcher(NORM_L2);

or

FlannBasedMatcher(); // kmeansindex by default, using L2

(only problem might be, that 6 numbers only are somewhat short. maybe you can look at a slightly larger area around your keypoint, split that up into smaller patches, compute features for those patches, and concatenate those)

good luck with it !

edit flag offensive delete link more

Comments

@berak thanks I'll give it a go :)

sazr gravatar imagesazr ( 2018-06-09 06:01:07 -0600 )edit

well you'll definitely learn something .. ;)

for giggles, have a look at the LUCID descriptor (in opencv_contrib), it's just the color pixels around the keypoint !

berak gravatar imageberak ( 2018-06-09 06:26:21 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-06-09 05:49:20 -0600

Seen: 650 times

Last updated: Jun 09 '18