List KeyPoint missing queryIdx
I am doing some feature matching and I am seeing that some KeyPoints in the list don't have the queryIdx listed, only the trainIdx. Is there an explanation for that?
Also, I'm not sure if they are related but I noticed that I have more matches than the number of keypoints for my reference image does not match the number of keypoints detected Keypoints. from my test image.
Here is a snippet of my code:
private MSER mFeatureDetector = MSER.create();
mFeatureDetector.detect(ReferenceImage, ReferenceKeypoints);
mDescriptorExtractor.compute(ReferenceImage, ReferenceKeypoints, ReferenceDescriptors);
private final DescriptorExtractor mDescriptorExtractor = DescriptorExtractor.create(DescriptorExtractor.ORB);
mFeatureDetector.detect(TestImage, TestKeypoints);
mDescriptorExtractor.compute(TestImage, TestKeypoints, TestDescriptors);
private final DescriptorMatcher DescriptorMatcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMINGLUT);
DescriptorMatcher.match(ReferenceDescriptors,TestDescriptors, Matches);
final List<DMatch> matchesList = Matches.toList();
final List<KeyPoint> referenceKeypointsList = ReferenceKeypoints.toList();
final List<KeyPoint> sceneKeypointsList = TestKeypoints.toList();
final ArrayList<Point> goodReferencePointsList = new ArrayList<Point>();
final ArrayList<Point> goodScenePointsList = new ArrayList<Point>();
for (final DMatch match : matchesList) {
goodReferencePointsList.add(referenceKeypointsList.get(match.trainIdx).pt);
goodScenePointsList.add(sceneKeypointsList.get(match.queryIdx).pt);
}
In the for-loop, I see there are often sceneKeypointsList.get(match.trainIdx).pt) but the sceneKeypointsList.get(match.queryIdx).pt) is blank.