Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I figured it out! The Ransac array will be the same size as your matches. So every position of the Ransac array will be a directly linked to the every position in the matches.

The Ransac array will only contain '1's and '0's. '1' represents an inlier and '0' is an outlier.

So here is a simple way to filter the outlier matches and draw the inlier matches:

final MatOfDMatch inlierMatches = new MatOfDMatch();
for (int i = 0; i < RansacArray.height(); ++i) { if(RansacArray.get(i,0)[0] > 0.0){ inlierMatches.add(matches.get(i)); }
}

Features2d.drawMatches(img1, keypoints1, img2, keypoints2, inlierMatches, outImg);

Note: I am still plotting all keypoints but clearly I can see the outliers as I only match the inliers together.