Ask Your Question
1

Object recognition knnmatch

asked 2013-01-29 22:25:11 -0600

muthu gravatar image

updated 2013-01-31 04:37:01 -0600

Hello... I extracted features from a train image and query image using

FeatureDetector detector = FeatureDetector.create(FeatureDetector.ORB);
detector.detect(pic, keypoints1);
DescriptorExtractor extractor = DescriptorExtractor.create(DescriptorExtractor.ORB);
extractor.compute(pic, keypoints1, featuresofqimg);

I did this for both images...i wanna match these features and i used

       DescriptorMatcher matches =DescriptorMatcher.create(DescriptorMatcher.FLANNBASED);
       matches.knnMatch(featuresofqimg, featuresoftrainimg,  matc, 2);

but the app stops unexpectedly... pls help me over here...

I initialized matc as follows

private List<MatofDMatch>             matc1;

and i don't know how to initialise it..

Also a 2-d variable is required for match...Mat is already 2d ,I wonder why List<matofdmatch> is needed..Its the syntax of the arguments in knnmatch();

pls help me over here.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2013-10-28 02:15:19 -0600

ThevenonP gravatar image

knnMatch outputs the list of k nearest neighbours as a vector<vector<dmatch>>. It means that for each feature in the query image, it will output k (or less) DMatch, hence the need for a 2D structure.

If you only need 1 neighbour for each query image feature, you can use the .match() method, with the output as a vector<dmatch>.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-01-29 22:25:11 -0600

Seen: 1,825 times

Last updated: Oct 28 '13