Ask Your Question
2

MatOfDMatch how can it be used?

asked 2012-11-11 00:41:38 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >50 is welcome to improve it.

I am using android to compare some images, and I get the keypoints detecting done, the descriptionextraction, and then the matching of the two descriptors. I get the matched MatOfDMatch, but I don't quite get how I evaluate it. Any pointers?

Imgproc.cvtColor(mRgba, mGray, Imgproc.COLOR_RGBA2GRAY); detector.detect(mGray, keypoints); descriptorExtractor.compute(mGray, keypoints, descriptors);

MatOfDMatch temp = new MatOfDMatch(); matcher.match(descriptors,trained, temp);

And then? Peter

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2012-11-12 08:38:30 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >50 is welcome to improve it.

Hi,

you can convert the MatOfDMatch to a Java list and then go through it with the List iterator as you do in a any Java program:

List<DMatch> myList = temp.toList();

Iterator itr = myList.iterator(); 
while(itr.hasNext()) 
{
      DMatch element = itr.next(); 
      // your code here
}

You can check the documentation of DMatch here, basically every DMatch element corresponds to a match between the two images: when comparing only two images (trained is just a simple list of descriptors) then you only need the queryIdx and trainIdx fields which indicate the index of the feature in the query image (in your case keypoints) and in the train image, respectively. In case your trained descriptors are a list of list of descriptors (so you are comparing your image to a set of images) then the imgIdx will tell you the index of the image that has the match.

Hope it helps

S.

edit flag offensive delete link more

Comments

thank you got the job done :)

Szippy gravatar imageSzippy ( 2012-11-15 12:57:48 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2012-11-11 00:41:38 -0500

Seen: 3,292 times

Last updated: Nov 12 '12