-
Notifications
You must be signed in to change notification settings - Fork 1
Code structure
The source code of the library is located in the file "robest.hpp". It is very compact and its entire basic structure is divided into two classes:
class EstimationProblem
The Estimation Problem class is abstract, and includes blanks for future functions for estimating model parameters, loss functions, etc. This class is a template and is designed to separate the bodies of the main RANSAC algorithms from specific implementations of methods for estimating mathematical models.
class AbstractEstimator
The Abstract Estimator class is a base in the library, all subclasses implementing RANSAC algorithms are inherited from it. Also it includes the entire list of methods that are the same for each algorithm.
At the moment, the library has 3 main algorithms implemented, they are presented in the form of subclasses:
class RANSAC : public AbstractEstimator
class MSAC : public AbstractEstimator
class LMedS : public AbstractEstimator
Since these subclasses are also abstract, this makes it impossible to instantiate them. In order to be able to use them, first of all it is necessary to define all virtual methods of the class EstimationProblem
.
In addition to the source code, which is the main body of the library, in the tests folder you can find several examples for implementing the fitting algorithms:
class LineFittingProblem : public robest::EstimationProblem
class CircleFittingProblem : public robest::EstimationProblem
class SphereFittingProblem : public robest::EstimationProblem
class PlaneFittingProblem : public robest::EstimationProblem
These subclasses are inherited from the EstimationProblem
class, but unlike it, they are not abstract because they include the definition of its virtual methods. The implementation of these methods depends on the subclass, and in particular on the geometric shape being fitted.
It is worth noting that these implementations of the fitting algorithms are not the only ones, some parts can be changed in accordance with the requirements of the project.
To test the fitting algorithms, we use Google tests. To get acquainted with the basic principles and features of these kinds of tests, read the documentation (link).