Random sampling consistency Algorithm (RANSAC) reprint

Source: Internet
Author: User

These two days to see "Multi-View geometry in computer vision" people have been blindfolded, reproduced some dry to see

Transfer from Wang Xianrong http://www.cnblogs.com/xrwang/archive/2011/03/09/ransac-1.html

Wang Xianrong
This article is translated from Wikipedia, the English original address is: HTTP://EN.WIKIPEDIA.ORG/WIKI/RANSAC, if your English is good, we suggest you directly to see the original text.
The RANSAC is the abbreviation for "Random sample Consensus (consistent randomly sampled)". It allows you to iteratively estimate the parameters of a mathematical model from a set of observational datasets that contain "outliers". It is an indeterminate algorithm-it has a certain probability to get a reasonable result, and the number of iterations must be increased in order to improve the probability. The algorithm was first proposed by Fischler and Bolles in 1981.
The basic assumptions of RANSAC are:
(1) The data is composed of "insider points", for example: the distribution of data can be explained by some model parameters;
(2) "Outliers" are data that cannot be adapted to the model;
(3) The data in addition is noise.
The reasons for the outliers are: the extreme value of the noise, the method of measuring the error, and the false hypothesis of the data.
Ransac also makes the assumption that given a set of (usually very small) insider points, there is a process for estimating model parameters that can be interpreted or applied to an insider point.

This article
1 Example
2 Overview
3 algorithm
4 parameters
5 pros and cons
6 apply
7 references
8 External links

I., example
    A simple example is to find the right 2-dimensional line from a set of observations. It is assumed that the observed data contains an inside point and an outer point, in which the inter-point approximation is passed by a straight line, and the outliers are far away from the line. The simple least squares method cannot find a straight line that adapts to the internal point, because the least squares method tries to accommodate all points including outliers. Instead, RANSAC can conclude that a model is calculated using only an insider's point, and that the probability is high enough. However, RANSAC does not guarantee that the results must be correct, in order to ensure that the algorithm has a reasonable probability of high enough, we must carefully select the parameters of the algorithm.

Left: Datasets with many outliers        right: Ransac found lines (outliers do not affect results)


Ii. Overview
The input of the RANSAC algorithm is a set of observational data, a parametric model that can be interpreted or adapted to observational data, and some credible parameters.
Ransac the goal by repeatedly selecting a set of random subsets in the data. The selected subset is assumed to be an insider, and is validated using the following method:
1. There is a model adapted to the hypothetical insider point, where all the unknown parameters can be calculated from the hypothetical insider points.
2. Use the model obtained in 1 to test all other data, if a point applies to the estimated model, it is considered an insider point.
3. If there are enough points to be classified as hypothetical insider points, then the estimated model is reasonable enough.
4. The model is then re-evaluated with all the hypothetical insider points, as it is only estimated by the initial assumption-points.
5. Finally, the model is evaluated by estimating the error rate of the insider and the model.
This process is repeated for a fixed number of times, and each time the resulting model is either discarded because it is too small, or is chosen better than the existing model.


third, the algorithm
The pseudo-code form of the algorithm is as follows:
Input:
data--a set of observational data
model--models adapted to the data
n--minimum number of data for a model
Number of iterations of the k--algorithm
t--is used to determine whether the data fits into the model's thresholds
d--determining whether a model is suitable for data sets
Output:
best_model--the model parameter that best matches the data (returns NULL if no good model is found)
best_consensus_set--estimating the data points of the model
best_error--estimated model errors related to data

Iterations = 0
Best_model = null
Best_consensus_set = null
Best_error = Infinity
while (Iterations < k)
Maybe_inliers = Random selection of n points from the data set
Maybe_model = Model parameters suitable for maybe_inliers
Consensus_set = Maybe_inliers

For (points that do not belong to maybe_inliers in each data set)
if (if the point is appropriate for Maybe_model and the error is less than T)
Add a point to the Consensus_set
if (the number of elements in Consensus_set is greater than D)
Have found a good model, now test how good the model is
Better_model = Suitable for some model parameters in Consensus_set
This_error = Better_model exactly how to fit the measurements of these points
if (This_error < Best_error)
We found a better model than before, and saved the model until the best model appeared
Best_model = Better_model
Best_consensus_set = Consensus_set
Best_error = This_error
Increase the number of iterations
Back to Best_model, Best_consensus_set, Best_error

Some of the possible changes to the RANSAC algorithm include the following:
(1) If a good enough model is found (the model has a small enough error rate), jump out of the main loop. This may save time to calculate additional parameters.
(2) Calculate the This_error directly from the Maybe_model, without re-estimating the model from Consensus_set. This may save time comparing two model errors, but may be more sensitive to noise.

Iv. Parameters
We had to determine the parameters T and D based on the specific problem and data set through the experiment. However, the parameter K (iteration count) can be inferred from theoretical results. When we estimate the model parameters, we use p to denote the probability that the points randomly selected from the data set during the iterative process are the internal points, so the result model is likely to be useful, so p also characterizes the probability that the algorithm produces useful results. Use W to indicate the probability of selecting an insider point from the dataset each time, as shown in the following form:
w = number of insider points/number of datasets
Normally, we don't know the value of W in advance, but we can give some robust values. Assuming that the estimated model requires the selection of n points,WNis the probability that all n points are in-between points;1?   w n is the probability that at least one point in N points is an outlier, which indicates that we have estimated a bad model from the data set.   (1?   w n ) K means that the algorithm will never choose to have a probability that N points are an insider, and it is the same as 1-p. Therefore,
    1?   p  = (1?   w n ) k
    We take the logarithm on both sides of the upper type, and get the
    
    It is worth noting that this result assumes that n points are selected independently of each other. In other words, when a point is selected, it may be repeatedly selected by the subsequent iteration process. This method is often unreasonable, and the resulting k value is considered to be the upper bound of the selected non-repeating point. For example, to find a suitable line from a dataset, the RANSAC algorithm typically selects 2 points per iteration, and calculates a straight maybe_model through these two points, requiring that the two points must be unique.
    in order to obtain more credible parameters, the standard deviation or its product can be added to K. The standard deviation of k is defined as:
    
v. Advantages and disadvantages
    Ransac The advantage is that it can be robust to estimate model parameters. For example, it can estimate high-precision parameters from a dataset that contains a large number of outliers. The disadvantage of RANSAC is that it calculates the number of iterations with no upper limit, and if the maximum number of iterations is set, the resulting results may not be optimal and may even result in incorrect results. Ransac only a certain probability to obtain a credible model, the probability is proportional to the number of iterations. Another disadvantage of RANSAC is that it requires setting thresholds related to the problem.
    Ransac can only estimate a model from a specific data set, and if there are two (or more) models, RANSAC cannot find another model.


Vi.. Application
RANSAC algorithms are often used in computer vision, for example, to simultaneously solve related problems and estimate the basic matrix of stereoscopic cameras.


Vii. Reference Documents

  • Martin A. Fischler and Robert c. Bolles (June 1981). "Random Sample consensus:a Paradigm for Model Fitting with applications to Image analysis and automated cartography". Comm. of the ACM : 381–395.doi:10.1145/358669.358692.
  • David A. Forsyth and Jean Ponce (2003). Computer Vision, a modern approach. Prentice Hall. ISBN 0-13-085198-1.
  • Richard Hartley and Andrew Zisserman (2003). multiple View Geometry in computer Vision (2nd ed.). Cambridge University Press.
  • P.h.s. Torr and D.W Murray (1997). "The development and Comparison of robust Methods for estimating the fundamental Matrix". International Journal of computer Vision : 271–300. doi:10.1023/a:1007927408552.
  • Ondrej Chum (2005). "Two-view Geometry estimation by Random Sample and Consensus". PhD Thesis . Http://cmp.felk.cvut.cz/~chum/Teze/Chum-PhD.pdf
  • Sunglok Choi, Taemin Kim, and Wonpil Yu (2009). "Performance Evaluation of RANSAC Family". In Proceedings of the British machine Vision Conference (BMVC) . Http://www.bmva.org/bmvc/2009/Papers/Paper355/Paper355.pdf.

Viii. External Links

    • RANSAC Toolbox for MATLAB. A (and didactic) oriented Toolbox to explore, the RANSAC algorithm in MATLAB. It is highly configurable and contains the routines to solve a few relevant estimation problems.
    • Implementation in C + + as a generic template.
    • RANSAC for Dummies A Simple tutorial with many examples that uses the RANSAC Toolbox for MATLAB.
    • Years of RANSAC Workshop

Nine, something

In the process of translation, this paper refers to Shen Lejun's article "Random sampling consistency algorithm RANSAC source program and tutorial". ZIV Yaniv has been implemented in C + + RANSAC, you can click here to download the source program.

However, if time permits, I intend to use C # to implement the RANSAC algorithm, for two reasons:

(1) The best way to get familiar with the algorithm is to implement it yourself;

(2) easy to use. NET comrades use Ransac.

Thank you for your patience to read my lame translation, I hope you have some help.

Random sampling consistency Algorithm (RANSAC) reprint

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.