[Home] DMelt member access. Java source code: org.ddogleg.fitting.modelset.ransac.RansacMulti
/*
* Copyright (c) 2012-2015, Peter Abeles. All Rights Reserved.
*
* This file is part of DDogleg (http://ddogleg.org).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ddogleg.fitting.modelset.ransac;
import org.ddogleg.fitting.modelset.DistanceFromModel;
import org.ddogleg.fitting.modelset.ModelGenerator;
import org.ddogleg.fitting.modelset.ModelManager;
import org.ddogleg.fitting.modelset.ModelMatcherMulti;
import org.ddogleg.struct.FastQueue;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
*
* Modification of {@link Ransac RANSAC} that finds the best fit model and model parameters to a set of data. A model
* is a mathematical description of a specific object type (e.g. circle, square) and model parameters is the description
* (e.g. radius and center point for a circle). The minimum (or user specified) set of points is drawn from the
* set of all points. Then for each model parameters are estimated. The model and parameter pair with the largest
* inliers set is returned.
*
*
*
* To change the default behavior of the class for specific applications the child class can override internal
* functions. Suggestions are shown below.
*
*
*
{@link #checkExitIteration}: Override to provide custom logic for when the RANSAC iteration should stop
*
{@link #selectMatchSet}: Override to provide custom for how the inlier set is found. Be sure to
* set up matchToInput[] correctly.
*
*
* @author Peter Abeles
*/
public class RansacMulti implements ModelMatcherMulti {
// how many points are drawn to generate the model
protected int sampleSize;
// used to randomly select points/samples
protected Random rand;
// list of Points passed in by the user
protected List dataSet;
// list of points which are a candidate for the best fit set
protected List candidatePoints = new ArrayList();
// list of samples from the best fit model
protected List bestFitPoints = new ArrayList();
// List of information on objects which can fit the data
protected List objectTypes;
// Storage for object model parameters which bestFitParam can be set to
protected List