@Override public boolean init(List<?> data, EstimatableModel<?, ?> model) { numItemsToEstimate = model.numItemsToEstimate(); numDataItems = data.size(); this.limit = calculateMinInliers(); this.iteration = 0; this.currentProb = 1.0; this.maxInliers = 0; return true; }
private int calculateMinInliers() { double pi, sum; int i, j; for (j = numItemsToEstimate + 1; j <= numDataItems; j++) { sum = 0; for (i = j; i <= numDataItems; i++) { pi = (i - numItemsToEstimate) * Math.log(inlierIsBadProbability) + (numDataItems - i + numItemsToEstimate) * Math.log(1.0 - inlierIsBadProbability) + log_factorial(numDataItems - numItemsToEstimate) - log_factorial(i - numItemsToEstimate) - log_factorial(numDataItems - i); /* * Last three terms above are equivalent to log( n-m choose * i-m ) */ sum += Math.exp(pi); } if (sum < desiredErrorProbability) break; } return j; }
new RANSAC<Point2d, Point2d, AffineTransformModel>(new AffineTransformModel(), new SingleImageTransferResidual2d<AffineTransformModel>(), 5.0, 100, new RANSAC.ProbabilisticMinInliersStoppingCondition(0.01), true) ); normalmatcher.setModelFeatures(carpetNormalKPTs); new RANSAC<Point2d, Point2d, AffineTransformModel>(new AffineTransformModel(), new SingleImageTransferResidual2d<AffineTransformModel>(), 5.0, 100, new RANSAC.ProbabilisticMinInliersStoppingCondition(0.01), true) ); altmatcher.setModelFeatures(carpetAltKPTs);
final RANSAC<Point2d, Point2d, HomographyModel> ransac = new RANSAC<Point2d, Point2d, HomographyModel>( model, new SingleImageTransferResidual2d<HomographyModel>(), 3.0, 1500, new RANSAC.ProbabilisticMinInliersStoppingCondition(0.01), true); this.matcher = new ConsistentLocalFeatureMatcher2d<Keypoint>( new FastBasicKeypointMatcher<Keypoint>(8));
final RANSAC<Point2d, Point2d, HomographyModel> ransac = new RANSAC<Point2d, Point2d, HomographyModel>( model, new SingleImageTransferResidual2d<HomographyModel>(), 3.0, 1500, new RANSAC.ProbabilisticMinInliersStoppingCondition(0.01), true); this.matcher = new ConsistentLocalFeatureMatcher2d<Keypoint>( new FastBasicKeypointMatcher<Keypoint>(8));