@Override public int getInputIndex(int matchIndex) { return mm.getInputIndex(matchIndex); }
public void getInliers( List<Point2D_F64> left , List<Point2D_F64> right , List<Point2D_F64> inliersLeft , List<Point2D_F64> inliersRight ) { int N = robustH.getMatchSet().size(); for( int i = 0; i < N; i++ ) { int index = robustH.getInputIndex(i); inliersLeft.add( left.get(index) ); inliersRight.add( right.get(index) ); } }
/** * Save a list of inliers in pixel coordinates */ private void createInliersList( ModelMatcher<Se3_F64, AssociatedPair> epipolarMotion ) { inliersPixel = new ArrayList<>(); FastQueue<AssociatedIndex> matches = associate.getMatches(); int N = epipolarMotion.getMatchSet().size(); for( int i = 0; i < N; i++ ) { AssociatedIndex a = matches.get( epipolarMotion.getInputIndex(i)); Point2D_F64 p1 = locationSrc.get( a.src ); Point2D_F64 p2 = locationDst.get( a.dst ); inliersPixel.add( new AssociatedPair(p1,p2)); } }
/** * Make sure the function getInputIndex() returns the original index */ @Test public void checkMatchSetToInputIndex() { double mean = 2.5; double tol = 0.2; // generate the points with a smaller tolerance to account for fitting error // later on. ModelMatcher<double[],Double> alg = createModel(4, tol * 0.95); List<Double> samples = createSampleSet(100, mean, tol, 0.1); assertTrue(alg.process(samples)); List<Double> matchSet = alg.getMatchSet(); // sanity check to make sure there is a large enough match set assertTrue(matchSet.size() > 20); int orderNotTheSame = 0; for( int i = 0; i < matchSet.size(); i++ ) { int expected = samples.indexOf(matchSet.get(i)); int found = alg.getInputIndex(i); if( found != i ) orderNotTheSame++; assertEquals(expected, found); } // sanity check to make sure the order has been changed assertTrue(orderNotTheSame != matchSet.size()); }