RANSAC and other model fitting algorithms

// typedefs

typedef RANSAC_Template<double> mrpt::math::RANSAC;

// classes

class mrpt::math::ModelSearch;

template <
    typename NUMTYPE = double,
    typename DATASET = CMatrixDynamic<NUMTYPE>,
    typename MODEL = CMatrixDynamic<NUMTYPE>
    >
class mrpt::math::RANSAC_Template;

// global functions

template <typename NUMTYPE>
void mrpt::math::ransac_detect_3D_planes(
    const CVectorDynamic<NUMTYPE>& x,
    const CVectorDynamic<NUMTYPE>& y,
    const CVectorDynamic<NUMTYPE>& z,
    std::vector<std::pair<size_t, TPlane>>& out_detected_planes,
    const double threshold,
    const size_t min_inliers_for_valid_plane = 10
    );

template <typename NUMTYPE>
void mrpt::math::ransac_detect_2D_lines(
    const CVectorDynamic<NUMTYPE>& x,
    const CVectorDynamic<NUMTYPE>& y,
    std::vector<std::pair<size_t, TLine2D>>& out_detected_lines,
    const double threshold,
    const size_t min_inliers_for_valid_line = 5
    );

template <class POINTSMAP>
void mrpt::math::ransac_detect_3D_planes(
    const POINTSMAP* points_map,
    std::vector<std::pair<size_t, TPlane>>& out_detected_planes,
    const double threshold,
    const size_t min_inliers_for_valid_plane
    );

template <typename T>
size_t mrpt::math::ransacDatasetSize(const CMatrixDynamic<T>& dataset);

Typedefs

typedef RANSAC_Template<double> mrpt::math::RANSAC

The default instance of RANSAC, for double type.

Global Functions

template <typename NUMTYPE>
void mrpt::math::ransac_detect_3D_planes(
    const CVectorDynamic<NUMTYPE>& x,
    const CVectorDynamic<NUMTYPE>& y,
    const CVectorDynamic<NUMTYPE>& z,
    std::vector<std::pair<size_t, TPlane>>& out_detected_planes,
    const double threshold,
    const size_t min_inliers_for_valid_plane = 10
    )

Fit a number of 3-D planes to a given point cloud, automatically determining the number of existing planes by means of the provided threshold and minimum number of supporting inliers.

Parameters:

out_detected_planes

The output list of pairs: number of supporting inliers, detected plane.

threshold

The maximum distance between a point and a temptative plane such as the point is considered an inlier.

min_inliers_for_valid_plane

The minimum number of supporting inliers to consider a plane as valid.

template <typename NUMTYPE>
void mrpt::math::ransac_detect_2D_lines(
    const CVectorDynamic<NUMTYPE>& x,
    const CVectorDynamic<NUMTYPE>& y,
    std::vector<std::pair<size_t, TLine2D>>& out_detected_lines,
    const double threshold,
    const size_t min_inliers_for_valid_line = 5
    )

Fit a number of 2-D lines to a given point cloud, automatically determining the number of existing lines by means of the provided threshold and minimum number of supporting inliers.

Parameters:

out_detected_lines

The output list of pairs: number of supporting inliers, detected line.

threshold

The maximum distance between a point and a temptative line such as the point is considered an inlier.

min_inliers_for_valid_line

The minimum number of supporting inliers to consider a line as valid.

template <class POINTSMAP>
void mrpt::math::ransac_detect_3D_planes(
    const POINTSMAP* points_map,
    std::vector<std::pair<size_t, TPlane>>& out_detected_planes,
    const double threshold,
    const size_t min_inliers_for_valid_plane
    )

A stub for ransac_detect_3D_planes() with the points given as a mrpt::maps::CPointsMap.

template <typename T>
size_t mrpt::math::ransacDatasetSize(const CMatrixDynamic<T>& dataset)

Define overloaded functions for user types as required.

This default implementation assumes datasets in matrices, with each sample being a column, the dimensionality being the number of rows.