TooN Algorithm Library - tag  0.2
Classes | Functions
RANSAC robust estimation
Collaboration diagram for RANSAC robust estimation:

Classes

struct  tag::Point4SE3Estimation< ImagePlaneZ >
 
struct  tag::Homography
 
struct  tag::AffineHomography
 
struct  tag::CameraRotation
 
struct  tag::PlaneFromPoints
 

Functions

template<class Obs , class Trans , class Tol >
size_t tag::find_RANSAC_inliers (const std::vector< Obs > &observations, const Tol &tolerance, size_t N, Trans &best, std::vector< bool > &inlier, int sample_size=Trans::hypothesis_size)
 
template<class Obs , class Trans , class Tol >
size_t tag::find_RANSAC_inliers (const std::vector< Obs > &observations, int sample_size, const Tol &tolerance, size_t N, Trans &best, std::vector< bool > &inlier)
 
template<class Obs , class Trans , class Tol >
double tag::find_MSAC_inliers (const std::vector< Obs > &observations, const Tol &tolerance, size_t N, Trans &best, std::vector< bool > &inlier, int sample_size=Trans::hypothesis_size)
 
template<class Obs , class Trans , class Tol >
double tag::find_MSAC_inliers (const std::vector< Obs > &observations, int sample_size, const Tol &tolerance, size_t N, Trans &best, std::vector< bool > &inlier)
 
template<class Obs , class Trans , class Tol , class Prob >
size_t tag::find_RANSAC_inliers_guided_breadth_first (const std::vector< Obs > &observations, const Prob &prob, const Tol &tolerance, size_t N, size_t block_size, Trans &best, std::vector< bool > &inlier, int sample_size=Trans::hypothesis_size)
 
template<class Obs , class Trans , class Tol , class Prob >
size_t tag::find_RANSAC_inliers_guided_breadth_first (const std::vector< Obs > &observations, const Prob &prob, int sample_size, const Tol &tolerance, size_t N, size_t block_size, Trans &best, std::vector< bool > &inlier)
 
template<class Obs , class Trans , class Tol >
size_t tag::find_RANSAC_inliers_breadth_first (const std::vector< Obs > &observations, const Tol &tolerance, size_t N, size_t block_size, Trans &best, std::vector< bool > &inlier, int sample_size=Trans::hypothesis_size)
 
template<class Obs , class Trans , class Tol >
size_t tag::find_RANSAC_inliers_breadth_first (const std::vector< Obs > &observations, int sample_size, const Tol &tolerance, size_t N, size_t block_size, Trans &best, std::vector< bool > &inlier)
 
template<class T , class U >
void tag::remove_if_false (std::vector< T > &v, const std::vector< U > &flag)
 

Detailed Description

This group contains a set of RANSAC implementations to estimate an inlier set from a set of correspondences under a transformation. The functions are both templated on the correspondence data type and the estimator for the transformation.

Function Documentation

template<class Obs , class Trans , class Tol >
double tag::find_MSAC_inliers ( const std::vector< Obs > &  observations,
const Tol &  tolerance,
size_t  N,
Trans &  best,
std::vector< bool > &  inlier,
int  sample_size = Trans::hypothesis_size 
)

basic MSAC implementation. The function is templated on the observation data type and the transformation data type which must conform to the following interface:

class Estimator {
Estimator();
// Estimate from a sequence of observations
template <class It> bool estimate(It begin, It End);
// return the score for the given observation
template <class Obs, class Tol> double score(const Obs& obs) const;
// the number of observations to estimate one hypothesis
static const int hypothesis_size = XXX;
};

see the file ransac_estimators.h for some Estimator classes for various transformations.

Parameters
[in]observationsa vector of observations (usually point matches)
[in]sample_sizethe number of samples used estimate a transformation
[in]tolerancethe tolerance (passed with each observation) to the transformation to check for inliers
[in]Nthe number of hypotheses to test
[out]bestthe transformation hypothesis with the highest inlier count
[out]inliera vector of bools that describes the inlier set of the winning hypothesis
Returns
the score of the winning hypothesis

References tag::randomTuple().

Referenced by tag::find_MSAC_inliers().

template<class Obs , class Trans , class Tol >
double tag::find_MSAC_inliers ( const std::vector< Obs > &  observations,
int  sample_size,
const Tol &  tolerance,
size_t  N,
Trans &  best,
std::vector< bool > &  inlier 
)

backwards compatibility interface to find_MSAC_inliers

Deprecated:

References tag::find_MSAC_inliers().

template<class Obs , class Trans , class Tol >
size_t tag::find_RANSAC_inliers ( const std::vector< Obs > &  observations,
const Tol &  tolerance,
size_t  N,
Trans &  best,
std::vector< bool > &  inlier,
int  sample_size = Trans::hypothesis_size 
)

basic RANSAC implementation. The function is templated on the observation data type and the transformation data type which must conform to the following interface:

class Estimator {
Estimator();
// Estimate from a sequence of observations
template <class It> bool estimate(It begin, It End);
// Check whether the given observation is an inlier for this estimate (with specified tolerance)
template <class Obs, class Tol> bool isInlier(const Obs& obs, const Tol& tolerance) const;
// the number of observations to estimate one hypothesis
static const int hypothesis_size = XXX;
};

see the file ransac_estimators.h for some Estimator classes for various transformations.

Parameters
[in]observationsa vector of observations (usually point matches)
[in]sample_sizethe number of samples used estimate a transformation
[in]tolerancethe tolerance (passed with each observation) to the transformation to check for inliers
[in]Nthe number of hypotheses to test
[out]bestthe transformation hypothesis with the highest inlier count
[out]inliera vector of bools that describes the inlier set of the winning hypothesis
Returns
the number of inliers for the winning hypothesis

References tag::randomTuple().

Referenced by tag::find_RANSAC_inliers().

template<class Obs , class Trans , class Tol >
size_t tag::find_RANSAC_inliers ( const std::vector< Obs > &  observations,
int  sample_size,
const Tol &  tolerance,
size_t  N,
Trans &  best,
std::vector< bool > &  inlier 
)

backwards compatibility interface to find_RANSAC_inliers

Deprecated:

References tag::find_RANSAC_inliers().

template<class Obs , class Trans , class Tol >
size_t tag::find_RANSAC_inliers_breadth_first ( const std::vector< Obs > &  observations,
const Tol &  tolerance,
size_t  N,
size_t  block_size,
Trans &  best,
std::vector< bool > &  inlier,
int  sample_size = Trans::hypothesis_size 
)

Breadth-first RANSAC implementation. The function is templated on the observation data type, the tolerance for inliers, and the transformation data type which must conform to the following interface:

class Estimator {
Estimator();
// Estimate from a sequence of observations
template <class It> bool estimate(It begin, It End);
// Check whether the given observation is an inlier for this estimate (with specified tolerance)
template <class Obs, class Tol> bool isInlier(const Obs& obs, const Tol& tolerance) const;
// the number of observations to estimate one hypothesis
static const int hypothesis_size = XXX;
};

All hypotheses are generated first, and preemptively discarded as more observations are examined. see the file ransac_estimators.h for some Estimator classes for various transformations.

Parameters
[in]observationsa vector of observations (usually point matches)
[in]sample_sizethe number of samples used estimate a transformation
[in]tolerancethe tolerance (passed with each observation) to the transformation to check for inliers
[in]Nthe number of hypotheses to test
[in]block_sizethe number of hypotheses to test in a block (between culling hypotheses)
[out]bestthe transformation hypothesis with the highest inlier count
[out]inliera vector of bools that describes the inlier set of the winning hypothesis
Returns
the number of inliers for the winning hypothesis

References tag::getShrinkRatio(), and tag::randomTuple().

Referenced by tag::find_RANSAC_inliers_breadth_first().

template<class Obs , class Trans , class Tol >
size_t tag::find_RANSAC_inliers_breadth_first ( const std::vector< Obs > &  observations,
int  sample_size,
const Tol &  tolerance,
size_t  N,
size_t  block_size,
Trans &  best,
std::vector< bool > &  inlier 
)

backwards compatibility interface to find_RANSAC_inliers_breadth_first

Deprecated:

References tag::find_RANSAC_inliers_breadth_first().

template<class Obs , class Trans , class Tol , class Prob >
size_t tag::find_RANSAC_inliers_guided_breadth_first ( const std::vector< Obs > &  observations,
const Prob &  prob,
const Tol &  tolerance,
size_t  N,
size_t  block_size,
Trans &  best,
std::vector< bool > &  inlier,
int  sample_size = Trans::hypothesis_size 
)

Guided breadth-first RANSAC implementation. The function is templated on the observation data type, the probability density for observation correctness, the tolerance for inliers, and the transformation data type which must conform to the following interface:

class Estimator {
Estimator();
// Estimate from a sequence of observations
template <class It> bool estimate(It begin, It End);
// Check whether the given observation is an inlier for this estimate (with specified tolerance)
template <class Obs, class Tol> bool isInlier(const Obs& obs, const Tol& tolerance) const;
// the number of observations to estimate one hypothesis
static const int hypothesis_size = XXX;
};

All hypotheses are generated first, and preemptively discarded as more observations are examined. The sample sets for hypotheses are drawn probabilistically using the specified probability density. see the file ransac_estimators.h for some Estimator classes for various transformations.

Parameters
[in]observationsa vector of observations (usually point matches)
[in]probthe probability predicate applied (as a function object) to each observation to compute its prior probability of being correct
[in]sample_sizethe number of samples used estimate a transformation
[in]tolerancethe tolerance (passed with each observation) to the transformation to check for inliers
[in]Nthe number of hypotheses to test
[in]block_sizethe number of hypotheses to test in a block (between culling hypotheses)
[out]bestthe transformation hypothesis with the highest inlier count
[out]inliera vector of bools that describes the inlier set of the winning hypothesis
Returns
the number of inliers for the winning hypothesis

References tag::getShrinkRatio(), and tag::randomTuple().

Referenced by tag::find_RANSAC_inliers_guided_breadth_first().

template<class Obs , class Trans , class Tol , class Prob >
size_t tag::find_RANSAC_inliers_guided_breadth_first ( const std::vector< Obs > &  observations,
const Prob &  prob,
int  sample_size,
const Tol &  tolerance,
size_t  N,
size_t  block_size,
Trans &  best,
std::vector< bool > &  inlier 
)

backwards compatibility interface to find_RANSAC_inliers_guided_breadth_first

Deprecated:

References tag::find_RANSAC_inliers_guided_breadth_first().

template<class T , class U >
void tag::remove_if_false ( std::vector< T > &  v,
const std::vector< U > &  flag 
)

helper function for use with ransac functions. It removes elements of an input vector based on another vector which is interpreted as boolean flags signaling removal from the first vector or not.

Parameters
[in,out]vvector with data to remove
[in]flagvector interpreted as flags, if false the corresponding element from v is removed