@Test public void testFilterConsensusMatches() { findAndValidateFoldTestConsensusSets(); final CanvasMatches noFoldMatches = CanvasMatches.fromJson(CanvasFeatureMatcherTest.NO_FOLD_MATCH_JSON); validateConsensusSets("no fold test", noFoldMatches, getTestMatcher(5f, 40), 1); }
public List<List<PointMatch>> filterConsensusMatches(final List<PointMatch> candidates) { final List<List<PointMatch>> listOfInliersLists = new ArrayList<>(); final int totalNumberOfCandidates = candidates.size(); boolean modelFound; do { final Model model = getModel(); final List<PointMatch> modelInliers = new ArrayList<>(); try { modelFound = model.filterRansac(candidates, modelInliers, iterations, maxEpsilon, minInlierRatio, minNumInliers); } catch (final NotEnoughDataPointsException e) { modelFound = false; } if (modelFound) { listOfInliersLists.add(modelInliers); candidates.removeAll(modelInliers); } } while (modelFound); final List<List<PointMatch>> processedListOfInliersLists = new ArrayList<>(listOfInliersLists.size()); final List<Integer> consensusSetSizes = new ArrayList<>(); int totalNumberOfInliers = 0; for (int i = 0; i < listOfInliersLists.size(); i++) { final List<PointMatch> modelInliers = listOfInliersLists.get(i); postProcessInliers(modelInliers); if (modelInliers.size() > 0) { processedListOfInliersLists.add(modelInliers); consensusSetSizes.add(modelInliers.size()); totalNumberOfInliers += modelInliers.size(); } else { LOG.warn("dropped consensus set {} because it was empty after post processing", i); } } LOG.info("filterConsensusMatches: filtered {} inlier set(s) with sizes {} for a total of {} inliers from {} candidates", processedListOfInliersLists.size(), consensusSetSizes, totalNumberOfInliers, totalNumberOfCandidates); return processedListOfInliersLists; }
CanvasFeatureMatcher implements Serializable { public List<List<PointMatch>> filterConsensusMatches(final List<PointMatch> candidates) { final List<List<PointMatch>> listOfInliersLists = new ArrayList<>(); final int totalNumberOfCandidates = candidates.size(); boolean modelFound; do { final Model model = getModel(); final List<PointMatch> modelInliers = new ArrayList<>(); try { modelFound = model.filterRansac(candidates, modelInliers, iterations, maxEpsilon, minInlierRatio, minNumInliers); } catch (final NotEnoughDataPointsException e) { modelFound = false; } if (modelFound) { listOfInliersLists.add(modelInliers); candidates.removeAll(modelInliers); } } while (modelFound); final List<List<PointMatch>> processedListOfInliersLists = new ArrayList<>(listOfInliersLists.size()); final List<Integer> consensusSetSizes = new ArrayList<>(); int totalNumberOfInliers = 0; for (int i = 0; i < listOfInliersLists.size(); i++) { final List<PointMatch> modelInliers = listOfInliersLists.get(i); postProcessInliers(modelInliers); if (modelInliers.size() > 0) { processedListOfInliersLists.add(modelInliers); consensusSetSizes.add(modelInliers.size()); totalNumberOfInliers += modelInliers.size(); } else { LOG.warn("dropped consensus set {} because it was empty after post processing", i); } } LOG.info("filterConsensusMatches: filtered {} inlier set(s) with sizes {} for a total of {} inliers from {} candidates", processedListOfInliersLists.size(), consensusSetSizes, totalNumberOfInliers, totalNumberOfCandidates); return processedListOfInliersLists; } }
CanvasFeatureMatcher implements Serializable { public List<List<PointMatch>> filterConsensusMatches(final List<PointMatch> candidates) { final List<List<PointMatch>> listOfInliersLists = new ArrayList<>(); final int totalNumberOfCandidates = candidates.size(); boolean modelFound; do { final Model model = getModel(); final List<PointMatch> modelInliers = new ArrayList<>(); try { modelFound = model.filterRansac(candidates, modelInliers, iterations, maxEpsilon, minInlierRatio, minNumInliers); } catch (final NotEnoughDataPointsException e) { modelFound = false; } if (modelFound) { listOfInliersLists.add(modelInliers); candidates.removeAll(modelInliers); } } while (modelFound); final List<List<PointMatch>> processedListOfInliersLists = new ArrayList<>(listOfInliersLists.size()); final List<Integer> consensusSetSizes = new ArrayList<>(); int totalNumberOfInliers = 0; for (int i = 0; i < listOfInliersLists.size(); i++) { final List<PointMatch> modelInliers = listOfInliersLists.get(i); postProcessInliers(modelInliers); if (modelInliers.size() > 0) { processedListOfInliersLists.add(modelInliers); consensusSetSizes.add(modelInliers.size()); totalNumberOfInliers += modelInliers.size(); } else { LOG.warn("dropped consensus set {} because it was empty after post processing", i); } } LOG.info("filterConsensusMatches: filtered {} inlier set(s) with sizes {} for a total of {} inliers from {} candidates", processedListOfInliersLists.size(), consensusSetSizes, totalNumberOfInliers, totalNumberOfCandidates); return processedListOfInliersLists; } CanvasFeatureMatcher(final MatchDerivationParameters matchParameters); }
CanvasFeatureMatcher implements Serializable { public List<List<PointMatch>> filterConsensusMatches(final List<PointMatch> candidates) { final List<List<PointMatch>> listOfInliersLists = new ArrayList<>(); final int totalNumberOfCandidates = candidates.size(); boolean modelFound; do { final Model model = getModel(); final List<PointMatch> modelInliers = new ArrayList<>(); try { modelFound = model.filterRansac(candidates, modelInliers, iterations, maxEpsilon, minInlierRatio, minNumInliers); } catch (final NotEnoughDataPointsException e) { modelFound = false; } if (modelFound) { listOfInliersLists.add(modelInliers); candidates.removeAll(modelInliers); } } while (modelFound); final List<List<PointMatch>> processedListOfInliersLists = new ArrayList<>(listOfInliersLists.size()); final List<Integer> consensusSetSizes = new ArrayList<>(); int totalNumberOfInliers = 0; for (int i = 0; i < listOfInliersLists.size(); i++) { final List<PointMatch> modelInliers = listOfInliersLists.get(i); postProcessInliers(modelInliers); if (modelInliers.size() > 0) { processedListOfInliersLists.add(modelInliers); consensusSetSizes.add(modelInliers.size()); totalNumberOfInliers += modelInliers.size(); } else { LOG.warn("dropped consensus set {} because it was empty after post processing", i); } } LOG.info("filterConsensusMatches: filtered {} inlier set(s) with sizes {} for a total of {} inliers from {} candidates", processedListOfInliersLists.size(), consensusSetSizes, totalNumberOfInliers, totalNumberOfCandidates); return processedListOfInliersLists; } CanvasFeatureMatcher(final MatchDerivationParameters matchParameters); CanvasFeatureMatchResult deriveMatchResult(final List<Feature> canvas1Features,
                                                      final List<Feature> canvas2Features); List<PointMatch> filterMatches(final List<PointMatch> candidates,
                                          final Model model); List<List<PointMatch>> filterConsensusMatches(final List<PointMatch> candidates); Model getModel(); }
CanvasFeatureMatcher implements Serializable { public List<List<PointMatch>> filterConsensusMatches(final List<PointMatch> candidates) { final List<List<PointMatch>> listOfInliersLists = new ArrayList<>(); final int totalNumberOfCandidates = candidates.size(); boolean modelFound; do { final Model model = getModel(); final List<PointMatch> modelInliers = new ArrayList<>(); try { modelFound = model.filterRansac(candidates, modelInliers, iterations, maxEpsilon, minInlierRatio, minNumInliers); } catch (final NotEnoughDataPointsException e) { modelFound = false; } if (modelFound) { listOfInliersLists.add(modelInliers); candidates.removeAll(modelInliers); } } while (modelFound); final List<List<PointMatch>> processedListOfInliersLists = new ArrayList<>(listOfInliersLists.size()); final List<Integer> consensusSetSizes = new ArrayList<>(); int totalNumberOfInliers = 0; for (int i = 0; i < listOfInliersLists.size(); i++) { final List<PointMatch> modelInliers = listOfInliersLists.get(i); postProcessInliers(modelInliers); if (modelInliers.size() > 0) { processedListOfInliersLists.add(modelInliers); consensusSetSizes.add(modelInliers.size()); totalNumberOfInliers += modelInliers.size(); } else { LOG.warn("dropped consensus set {} because it was empty after post processing", i); } } LOG.info("filterConsensusMatches: filtered {} inlier set(s) with sizes {} for a total of {} inliers from {} candidates", processedListOfInliersLists.size(), consensusSetSizes, totalNumberOfInliers, totalNumberOfCandidates); return processedListOfInliersLists; } CanvasFeatureMatcher(final MatchDerivationParameters matchParameters); CanvasFeatureMatchResult deriveMatchResult(final List<Feature> canvas1Features,
                                                      final List<Feature> canvas2Features); List<PointMatch> filterMatches(final List<PointMatch> candidates,
                                          final Model model); List<List<PointMatch>> filterConsensusMatches(final List<PointMatch> candidates); Model getModel();  }