// Matching
DescriptorMatcher matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING);
MatOfDMatch matches = new MatOfDMatch();
matcher.match(descriptors1, descriptors2, matches);
List<DMatch> matchesList = matches.toList();
Double max_dist = 0.0;
Double min_dist = 100.0;
for (DMatch dMatch : matchesList) {
Double dist = (double) dMatch.distance;
if (dist < min_dist)
min_dist = dist;
if (dist > max_dist)
max_dist = dist;
}
List<DMatch> good_matches = new ArrayList<DMatch>();
for (DMatch aMatchesList : matchesList) {
if (aMatchesList.distance <= (1.5 * min_dist))
good_matches.add(aMatchesList);
}