the .match(..) method returns MatOfDMatch object with zero ditances?!

asked 2015-03-30 08:04:42 -0600

RB gravatar image

updated 2015-03-30 08:11:41 -0600

in the below code, i am trying to display the values of the distances included in the matDMatch object, but as you see at the commented out for-loop, the distnces stored in the matDMatch object are zeros.

why the distnces are zeros and what does it mean?

Code:

MatOfDMatch matDMatch = new MatOfDMatch();
    DescriptorMatcher descripMatcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE);
    descripMatcher.match(mat_jf01_QueryDescriptor, mat_jf01_revQueryDescriptor, matDMatch);

    Highgui.imwrite(path_jf01_Matches, matDMatch);
    System.out.println("matDMatch.size: " + matDMatch.size());
    System.out.println("matDMatch.width: " + matDMatch.size().width);
    System.out.println("matDMatch.height: " + matDMatch.size().height);

    /*Draw Matches*/
    Mat mat_jf01_DrawnMatches = new Mat();
    Features2d.drawMatches(path2Mat(path_jf01), matKeyPts_jf01, path2Mat(path_jf01_rev), matKeyPts_jf01_rev, matDMatch, mat_jf01_DrawnMatches);
    Highgui.imwrite(path_jf01_DrawnMatches, mat_jf01_DrawnMatches);

    List<DMatch> dMatchList = matDMatch.toList();
    DMatch[] dMatArray = matDMatch.toArray();
    System.out.println("dMatchArray.length(): " + dMatArray.length);
    System.out.println("dMatchList.size(): " + dMatchList.size());

    /*for (int i = 0; i < dMatchList.size(); i++) {
        System.out.println("dMatchList.get(" + i + "): " + dMatchList.get(i).distance);// this line shows that the distnces are zeros, why?
    }*/
    float[] minMaxDist = thresolding(10, 100,dMatchList);
    goodMatches(minMaxDist, dMatchList);
}
edit retag flag offensive close merge delete