Ask Your Question

List KeyPoint missing queryIdx

asked 2018-09-25 13:04:10 -0600

hayley gravatar image

updated 2018-09-26 09:12:59 -0600

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 the number of keypoints for my reference image does not match the number of keypoints detected 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) {

In the for-loop, I see there are often sceneKeypointsList.get(match.trainIdx).pt) but the sceneKeypointsList.get(match.queryIdx).pt) is blank.

edit retag flag offensive close merge delete


well, the error is likely in your code, so please append it to your question !

berak gravatar imageberak ( 2018-09-25 13:30:28 -0600 )edit

Hi @berak, I just updated my question. Thanks.

hayley gravatar imagehayley ( 2018-09-26 05:32:16 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2019-11-10 09:52:35 -0600

CV_WRAP virtual void compute( InputArray image, CV_OUT CV_IN_OUT std::vector<keypoint>& keypoints, OutputArray descriptors ); In this function:

@Param keypoints Input collection of keypoints. Keypoints for which a descriptor cannot becomputed are removed. Sometimes new keypoints can be added, for example: SIFT duplicates keypoint with several dominant orientations (for each orientation).
edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-09-25 13:04:10 -0600

Seen: 410 times

Last updated: Nov 10 '19