## introduction

**RANSAC** is an abbreviation for “RANDom Sample Consensus”. It is an iterative method of estimating the parameters of a mathematical model from a set of observed data that contains outliers. It is a non-deterministic algorithm in the sense that it gives a correct result only with a certain probability (probability (from lat. probabilitas) is an assessment of the probable character of a…), where this probability is related to the number increases (The notion of number in linguistics is discussed in the article “Number…”) of iterations is large. The algorithm was first published by Fischler and Bolles in 1981.

The basic assumption is that data consists of “inliers”, i.e. data whose distribution can be explained by a set (in set theory, a set intuitively denotes a collection…) of parameters of a model, and “outliers” are data that do not selected model. In addition, the data may be noisy (in a sane sense, the word noise is close to the main meaning of the word sound…). Outliers can be caused, for example, by extreme noise values, incorrect measurements or incorrect assumptions about the interpretation of the data. RANSAC (RANSAC is an abbreviation for “RANDom SAmple Consensus”. It’s a method…) also assumes that given a (usually small) set of inliers there is a method by which one can estimate the parameters of a model in order to best explain this data.

## Example

A simple example is fitting a 2D line to a set of observations. This set is assumed to contain both inliers, which are points that can be approximated to fit a line, and outliers, which are points that are far from that line pattern. A simple treatment by a least squares method (The least squares method, independently elaborated by Legendre in …) will yield a line that is poorly fitted to the inliers. In fact, the line fits all points perfectly, including outliers. RANSAC, on the other hand, can generate a model that only considers inliers, provided that the probability of selecting only inliers when selecting the data is high enough. However, there is no guarantee that this situation will be reached (in geography, the situation is a spatial concept that allows for the relative position of a…), and there are a certain number of parameters of the algorithm that must be carefully chosen , to maintain this probability high enough.

A data set with many outliers for which a line needs to be fitted. | Line adjusted with RANSAC method, outliers have no influence on the result. |

## The Algorithm

The generic RANSAC algorithm works in pseudocode as follows:

**entries**: data – a set of observations model – a model that can be fitted to data n – the minimum number of data needed to fit the model k – the maximum number of iterations of the algorithm t – a threshold to get to determine whether a datum ( In information technology (IT) a datum is a basic description, often …) matches a pattern d – the number of dates near the values required to argue that the pattern agrees well with the data **exits**:best_model – the model parameters that best fit the data (or Null (The digit zero (from Italian zero, derived from Arabic sifr, …) if no good model was found) best_set_points – data by which this model was estimated best_error – the error of this model in relation to the data iterator:= 0 best_model:= none best_set_points:= none best_error:= infinity (The word “infinity” (-e, -s; from Latin finish,.. .) **as long as** Iterator < k random_points:= n randomly selected values from the data possible_model:= model parameters corresponding to the random_points set_points:= random_points **For** each point (graph) of the data **not in** random_points **if** Point matches model_possible with error less than t Add point to set_points **if** Number of elements in set_points is > d (meaning we may have found a good model, now let’s test how correct it is) model_possible := model parameters have been readjusted at all points of set_points error : = a measure of how well these points fit possible_model **if** error < best_error (we found a model better than all previous ones, keep it until a better one is found) best_model:= possible_model best_points_set:= points_set best_error:= error iterator increment **to return** best_model, best_set_points, best_error

Possible variants of the RANSAC algorithm:

- Stop the main loop when a good enough pattern has been found, ie with a small enough error. Can additionally save computing time (time is a concept developed by humans to understand…) at the expense of a parameter (A parameter is in the broadest sense an information element to be considered…).
- Calculate errors directly from model_possible without re-estimating the model from set_points. Can save time at the expense of comparing errors related to models that are estimated from a small number of points and are therefore more sensitive to noise.