An interface for RANSAC model fitting.  
 More...
#include <RANSACModel.hpp>
|  | 
|  | RANSACModel () | 
|  | Constructor. 
 | 
|  | 
| virtual MODEL | make (const std::vector< DATA > &data) const | 
|  | Creates a new model of this type using provided data. 
 | 
|  | 
| virtual | ~RANSACModel () | 
|  | Destructor. 
 | 
|  | 
| bool | operator< (const MODEL &model) const | 
|  | 'Worse than' operator.  More... 
 | 
|  | 
| bool | operator> (const MODEL &model) const | 
|  | 'Better than' operator.  More... 
 | 
|  | 
| virtual double | fitError (const DATA &sample) const =0 | 
|  | Calculates the fitting error of a sample. 
 | 
|  | 
| virtual bool | belongsTo (const DATA &sample, double threshold) const | 
|  | Check whether a sample belongs to the model.  More... 
 | 
|  | 
| virtual bool | invalid () const =0 | 
|  | Checks whether the model is invalid. 
 | 
|  | 
| virtual double | refit (const std::vector< DATA > &data)=0 | 
|  | Recalculates the model based on provided samples.  More... 
 | 
|  | 
| virtual int | getMinReqData () const =0 | 
|  | Returns the number of samples required to create the model.  More... 
 | 
|  | 
| virtual bool | same (const MODEL &model, double threshold) const =0 | 
|  | Tests whether the model is same to a threshold of another model.  More... 
 | 
|  | 
| size_t | getNumberOfInliers () const | 
|  | Get the number of inliers. 
 | 
|  | 
| double | getQuality () const | 
|  | Get the model quality.  More... 
 | 
|  | 
| void | setQuality (double quality) | 
|  | Set the model quality.  More... 
 | 
|  | 
| std::vector< DATA > & | getData () | 
|  | Access data. 
 | 
|  | 
| const std::vector< DATA > & | getData () const | 
|  | Access data. 
 | 
|  | 
| std::vector< size_t > | getInlierIndices () const | 
|  | Get the vector of inlier indices.  More... 
 | 
|  | 
|  | 
| static std::vector< MODEL > | findModels (const std::vector< DATA > &data, int maxIterations, int dataRequired, double dataThreshold, double modelThreshold) | 
|  | Find models fitting a set of observations.  More... 
 | 
|  | 
| static MODEL | bestModel (const std::vector< MODEL > &models) | 
|  | Select the model with the largest number of inliers.  More... 
 | 
|  | 
| static MODEL | likelyModel (const std::vector< MODEL > &models) | 
|  | Select a model randomly, with a chance based on the number of inliers.  More... 
 | 
|  | 
|  | 
| std::vector< DATA > | _data | 
|  | 
| double | _quality | 
|  | 
| std::vector< size_t > | _indices | 
|  | 
template<class MODEL, class DATA>
class rwlibs::algorithms::RANSACModel< MODEL, DATA >
An interface for RANSAC model fitting. 
- Todo:
- A model needs to remember the indices of inliers from the set of data... 
◆ belongsTo()
  
  | 
        
          | virtual bool belongsTo | ( | const DATA & | sample, |  
          |  |  | double | threshold |  
          |  | ) |  | const |  | inlinevirtual | 
 
Check whether a sample belongs to the model. 
Returns true when the sample is within a threshold distance of the model. 
 
 
◆ bestModel()
  
  | 
        
          | static MODEL bestModel | ( | const std::vector< MODEL > & | models | ) |  |  | inlinestatic | 
 
Select the model with the largest number of inliers. 
In case of ties, pick the model with better quality. 
 
 
◆ findModels()
  
  | 
        
          | static std::vector<MODEL> findModels | ( | const std::vector< DATA > & | data, |  
          |  |  | int | maxIterations, |  
          |  |  | int | dataRequired, |  
          |  |  | double | dataThreshold, |  
          |  |  | double | modelThreshold |  
          |  | ) |  |  |  | inlinestatic | 
 
Find models fitting a set of observations. 
Function performs maxIterations iterations and finds a number of initial models. The models are then filtered, and those within a distance of modelThreshold are merged together.
- Parameters
- 
  
    | data | [in] set of data points to find a model for |  | maxIterations | [in] number of iterations to perform |  | dataRequired | [in] a number of data points required to fit into model to consider it plausible |  | dataThreshold | [in] a threshold for fitting error of a data point |  | modelThreshold | [in] a difference between models neccesary to consider them different |  
 
- Returns
- a vector of fitted models 
 
 
◆ getInlierIndices()
  
  | 
        
          | std::vector<size_t> getInlierIndices | ( |  | ) | const |  | inline | 
 
Get the vector of inlier indices. 
- Returns
- a vector of indices of inliers in the data vector supplied to findModels function. 
 
 
◆ getMinReqData()
  
  | 
        
          | virtual int getMinReqData | ( |  | ) | const |  | pure virtual | 
 
 
◆ getQuality()
  
  | 
        
          | double getQuality | ( |  | ) | const |  | inline | 
 
Get the model quality. 
The model quality is a sum of fitting errors for all its inliers. 
 
 
◆ likelyModel()
  
  | 
        
          | static MODEL likelyModel | ( | const std::vector< MODEL > & | models | ) |  |  | inlinestatic | 
 
Select a model randomly, with a chance based on the number of inliers. 
Given a vector of models {model1(45 inliers), model2(30 inliers), model3(20 inliers), model4(5 inliers)}, it will pick:
- model1 - 45% chance,
- model2 - 30% chance,
- model3 - 20% chance,
- model4 - 5% chance 
 
 
◆ operator<()
  
  | 
        
          | bool operator< | ( | const MODEL & | model | ) | const |  | inline | 
 
'Worse than' operator. 
Used for sorting. Compares the number of inliers the models have. In case of ties, compares quality. 
 
 
◆ operator>()
  
  | 
        
          | bool operator> | ( | const MODEL & | model | ) | const |  | inline | 
 
'Better than' operator. 
Used for sorting. Compares the number of inliers the models have. In case of ties, compares quality. 
 
 
◆ refit()
  
  | 
        
          | virtual double refit | ( | const std::vector< DATA > & | data | ) |  |  | pure virtual | 
 
Recalculates the model based on provided samples. 
- Returns
- Fit error on a set of provided samples. 
 
 
◆ same()
  
  | 
        
          | virtual bool same | ( | const MODEL & | model, |  
          |  |  | double | threshold |  
          |  | ) |  | const |  | pure virtual | 
 
 
◆ setQuality()
  
  | 
        
          | void setQuality | ( | double | quality | ) |  |  | inline | 
 
Set the model quality. 
- Parameters
- 
  
    | quality | [in] fitting error of the model |  
 
 
 
The documentation for this class was generated from the following file: