Ask Your Question

Revision history [back]

Nearest Neighbors Ratio in Java


I am doing the feature matching with OpenCV in Java and it gets stuck into one point. After performing the detection, descriptor computation and matching, the result is a List<matofdmatch> and I am not quite sure how to handle this to remove "bad matches".

List<MatOfDMatch> listofmatches=new ArrayList<MatOfDMatch>();

    int k=2;

    BruteForce.knnMatch(descriptor1, descriptor2, listofmatches,k);

descriptor1 is Mat, which belongs to querry image and descriptor2 is train image.

How should I handle the listofmatches to remove bad matches? It is a little different as in C++.

Thank you very much