@Override public List<? extends IndependentPair<Point2d, Point2d>> getInliers() { return robustFitter.getInliers(); }
@Override public HomographyModel getModel() { return robustFitter.getModel(); }
@Override public int numItemsToEstimate() { return robustFitter.numItemsToEstimate(); }
if (matches.size() < modelfit.numItemsToEstimate()) { System.out.println("Not enough matches to check consistency!"); return false; if (modelfit.fitData(li_p2d)) { model = modelfit.getModel(); for (final IndependentPair<Point2d, Point2d> p : modelfit.getInliers()) { final Object op = p; consistentMatches.add((Pair<T>) op);
@Override public boolean fitData(List<? extends IndependentPair<Point2d, Point2d>> data) { final Pair<Matrix> norms = TransformUtilities.getNormalisations(data); final List<? extends IndependentPair<Point2d, Point2d>> normData = TransformUtilities.normalise(data, norms); // Use a robust fitting technique to find the inliers and estimate a // model using DLT if (!robustFitter.fitData(normData)) { // just go with full-on DLT estimate rather than a robust one robustFitter.getModel().estimate(normData); robustFitter.getModel().denormaliseFundamental(norms); return false; } // remap the inliers and outliers from the normalised ones to the // original space inliers.clear(); for (final IndependentPair<Point2d, Point2d> pair : robustFitter.getInliers()) { inliers.add(data.get(normData.indexOf(pair))); } outliers.clear(); for (final IndependentPair<Point2d, Point2d> pair : robustFitter.getOutliers()) { outliers.add(data.get(normData.indexOf(pair))); } // denormalise the estimated matrix before the non-linear step robustFitter.getModel().denormaliseFundamental(norms); // Now apply non-linear optimisation to get a better estimate final Matrix optimised = refinement.refine(robustFitter.getModel().getF(), inliers); robustFitter.getModel().setF(optimised); return true; }
@SuppressWarnings("unchecked") @Override public boolean findMatches(List<T> keys1) { // if we're gonna re-use the object, we need to reset everything! consistentMatches = new ArrayList<Pair<T>>(); // find the initial matches using the inner matcher innerMatcher.findMatches(keys1); final List<Pair<T>> matches = innerMatcher.getMatches(); if (matches.size() < modelfit.numItemsToEstimate()) { consistentMatches.clear(); consistentMatches.addAll(matches); return false; } final List<Pair<Point2d>> li_p2d = new ArrayList<Pair<Point2d>>(); for (final Pair<T> m : matches) { li_p2d.add(new Pair<Point2d>(m.firstObject(), m.secondObject())); } // fit the model final boolean didfit = modelfit.fitData(li_p2d); // get the inliers and build the list of consistent matches for (final IndependentPair<Point2d, Point2d> p : modelfit.getInliers()) { final Object op = p; consistentMatches.add((Pair<T>) op); } return didfit; }
@Override public boolean fitData(List<? extends IndependentPair<Point2d, Point2d>> data) { // Use a robust fitting technique to find the inliers and estimate a // model using DLT if (!robustFitter.fitData(data)) { // just go with full-on DLT estimate rather than a robust one robustFitter.getModel().estimate(data); return false; } return true; }
@Override public List<? extends IndependentPair<Point2d, Point2d>> getOutliers() { return robustFitter.getOutliers(); } }
if (matches.size() < modelfit.numItemsToEstimate()) { System.out.println("Not enough matches to check consistency!"); return false; if (modelfit.fitData(li_p2d)) { model = modelfit.getModel(); for (final IndependentPair<Point2d, Point2d> p : modelfit.getInliers()) { final Object op = p; consistentMatches.add((Pair<T>) op);
@Override public boolean fitData(List<? extends IndependentPair<Point2d, Point2d>> data) { final Pair<Matrix> norms = TransformUtilities.getNormalisations(data); final List<? extends IndependentPair<Point2d, Point2d>> normData = TransformUtilities.normalise(data, norms); // Use a robust fitting technique to find the inliers and estimate a // model using DLT if (!robustFitter.fitData(normData)) { // just go with full-on DLT estimate rather than a robust one robustFitter.getModel().estimate(normData); robustFitter.getModel().denormaliseHomography(norms); return false; } // remap the inliers and outliers from the normalised ones to the // original space inliers.clear(); for (final IndependentPair<Point2d, Point2d> pair : robustFitter.getInliers()) { inliers.add(data.get(normData.indexOf(pair))); } outliers.clear(); for (final IndependentPair<Point2d, Point2d> pair : robustFitter.getOutliers()) { outliers.add(data.get(normData.indexOf(pair))); } // denormalise the estimated matrix before the non-linear step robustFitter.getModel().denormaliseHomography(norms); // Now apply non-linear optimisation to get a better estimate final Matrix optimised = refinement.refine(robustFitter.getModel().getTransform(), inliers); robustFitter.getModel().setTransform(optimised); return true; }
@SuppressWarnings("unchecked") @Override public boolean findMatches(List<T> keys1) { // if we're gonna re-use the object, we need to reset everything! consistentMatches = new ArrayList<Pair<T>>(); // find the initial matches using the inner matcher innerMatcher.findMatches(keys1); final List<Pair<T>> matches = innerMatcher.getMatches(); if (matches.size() < modelfit.numItemsToEstimate()) { consistentMatches.clear(); consistentMatches.addAll(matches); return false; } final List<Pair<Point2d>> li_p2d = new ArrayList<Pair<Point2d>>(); for (final Pair<T> m : matches) { li_p2d.add(new Pair<Point2d>(m.firstObject(), m.secondObject())); } // fit the model final boolean didfit = modelfit.fitData(li_p2d); // get the inliers and build the list of consistent matches for (final IndependentPair<Point2d, Point2d> p : modelfit.getInliers()) { final Object op = p; consistentMatches.add((Pair<T>) op); } return didfit; }
@Override public AffineTransformModel getModel() { return robustFitter.getModel(); }
@Override public int numItemsToEstimate() { return robustFitter.numItemsToEstimate(); }
@Override public Model<Point2d, Point2d> getModel() { return modelfit.getModel(); }
@Override public int numItemsToEstimate() { return robustFitter.numItemsToEstimate(); }
@Override public FundamentalModel getModel() { return robustFitter.getModel(); }
@Override public Model<Point2d, Point2d> getModel() { return modelfit.getModel(); }