Basic Image AlgorithmS Library
2.8.0
|
Fast RANSAC after David Nister, "Preemptive RANSAC for Live Structure And Motion Estimation", Internation Conference on Computer Vision (ICCV) 2003. More...
#include <MathAlgo/PreemptiveRANSAC.hh>
Classes | |
struct | SolStruct |
Public Member Functions | |
void | AddDebugLevel (const long int lv) |
void | AddDebugLevel (const std::string &name) |
void | AddSolutionGuesses (const std::vector< SolutionType > &guesses) |
bool | DebugLevelIsSet (const long int lv) const |
bool | DebugLevelIsSet (const std::string &name) const |
int | GetDebugLevel () const |
std::ostream & | GetDebugStream () const |
void | GetDebugStream (std::ostream &os) const |
void | Init () |
long int | Name2DebugLevel (const std::string &name) const |
looks up a debuglevel in the internal map, returns 0 if not found More... | |
long int | NewDebugLevel (const std::string &name) |
creates a new debuglevel More... | |
PreemptiveRANSAC (RANSACEvaluatorInterface< SolutionType > *shi) | |
void | PrintDebugLevel (std::ostream &os=std::cout) const |
void | RemoveDebugLevel (const long int lv) |
void | RemoveDebugLevel (const std::string &name) |
void | SetDebugLevel (const long int lv) |
void | SetDebugLevel (const std::string &name) |
void | SetDebugStream (const std::ostream &os) |
void | SetEvaluationBlockSize (const unsigned eval_block_size) |
after each EvaluationBlockSize-th measurement, the solutions are compared and only the better half is kept More... | |
void | SetGreedy (const bool greedy) |
void | SetMaxSamples (const unsigned max_samples) |
Set max number of samples. More... | |
void | SetMinNumInitialInliers (const unsigned min_num_initial_inl) |
when less than MinNumInitialInliers are found, the solution is rejected straight away More... | |
void | SetMinSamples (const unsigned min_samples) |
Set min number of samples. More... | |
void | SetNumInitialChecked (const unsigned num_initial_checked) |
the number of measurements that is initially evaluated More... | |
void | SetRefineSolutions (const bool refine_solutions) |
void | ShowDebugLevel (std::ostream &os=std::cout) const |
prints all internally known debuglevels More... | |
int | SolveMaster (const double inlying_data_fraction, const double max_score, SolutionType &solution, std::vector< bool > &inliers, unsigned &num_inliers, double &score, const bool auto_compute_max_samples=false) |
virtual | ~PreemptiveRANSAC () |
Static Public Member Functions | |
static long int | GetGlobalDebugLevel () |
static void | SetGlobalDebugLevel (long int lev) |
Protected Member Functions | |
long | ConsumeNextFreeDebuglevel_ () |
returns the next available debuglevel More... | |
void | ConvertInliers_ (const std::vector< bool > &inliers_in_eval_order, std::vector< bool > &inliers) const |
void | EvaluateSolutions_ (const unsigned start_index, const unsigned data_size) |
void | GenerateEvaluationOrder_ (const unsigned data_size) |
int | GenerateRefinedSolutions_ (const unsigned data_size) |
returns the number of succesfully refined solutions More... | |
int | GenerateSolutions_ (const unsigned block_num, const unsigned sample_size, const unsigned data_size) |
returns the number of generated solution More... | |
int | GetSolution_ (const unsigned min_num_inliers, const double max_score, SolutionType &solution, std::vector< bool > &inliers, unsigned &num_inliers, double &score) const |
struct SolStruct * | GetSolutionMaxInliers_ (const unsigned min_num_inliers, const double max_score) const |
struct SolStruct * | GetSolutionMinScore_ (const unsigned min_num_inliers, const double max_score) const |
int | InitialRejectTcd_ (const unsigned min_num_inliers, const unsigned num_checked) |
returns the number of rejected solutions More... | |
bool | IsInlier_ (typename std::list< SolStruct >::iterator solution, const unsigned data_index, double &score) |
int | RejectSolutions_ (const unsigned eval_index) |
returns the number of rejected solutions More... | |
Protected Attributes | |
bool | _bGreedy |
should termination be aborted when first good solution is found? More... | |
bool | _bInitialised |
just to check if the class is used correctly More... | |
bool | _bRefineSolutions |
should the solutions be refined? More... | |
std::vector< unsigned > | _EvaluationOrder |
the order in which data is used for solutions evaluation More... | |
long int | _liDebugLevel |
long int | _liNextDebugLevel |
new concept, debuglevel are managed here in the debug class More... | |
RANSACEvaluatorInterface < SolutionType > * | _RANSACEvaluator |
the helper class for solution computation and sample evaluation More... | |
std::list< SolStruct > | _Solutions |
all (remaining) solutions More... | |
std::map< std::string, long int > | _String2Debuglevel |
unsigned | _uiDataSize |
the number of data for evaluation More... | |
unsigned | _uiEvaluationBlockSize |
after EvaluationBlockSize, bad solutions are removed More... | |
unsigned | _uiMaxSamples |
unsigned | _uiMinNumInitialInliers |
the minimum number of inlier from _uiNumInitialChecked More... | |
unsigned | _uiMinSamples |
the minimu and maximum number of samples investigated More... | |
unsigned | _uiNumInitialChecked |
the number of datat points that is initially checked More... | |
unsigned | _uiSampleSize |
the number of samples needed by GetSampleSolutions More... | |
BIAS::Random | randomizer_ |
randomizer instance used for evaluation order computation More... | |
int | sample_offset |
prevents that calls to GenerateSample_() generate the same random sample if sample solution creation fails! More... | |
Static Protected Attributes | |
static std::ostream | _zDebugStream |
static long int | GlobalDebugLevel = 0 |
Fast RANSAC after David Nister, "Preemptive RANSAC for Live Structure And Motion Estimation", Internation Conference on Computer Vision (ICCV) 2003.
The algorithm (preemptive RANSAC) is decoupled from the problem (for example HMatrix estimation) using a common interface class, the RANSACEvaluatorInterace. To use this class it is therefore necessary to derive from RANSACEvaluatorInterface and overload the functions:
bool IsInlier(const SolutionType& solution, const unsigned data_index, double& score) = 0;
int GetSampleSolutions(const std::vector<unsigned> &which_samples, std::vector<SolutionType> &solutions)= 0;
bool RefineSolution(const std::vector<bool>& inliers, SolutionType& solution) = 0;
Instantiate PreemptiveRANSAC with a pointer to the sibling of RANSACEvaluatorInterface as argment to the constructor and call alternatingly
Init() and SolveMaster()
Definition at line 85 of file PreemptiveRANSAC.hh.
BIAS::PreemptiveRANSAC< SolutionType >::PreemptiveRANSAC | ( | RANSACEvaluatorInterface< SolutionType > * | shi | ) |
Definition at line 278 of file PreemptiveRANSAC.hh.
References BIAS::PreemptiveRANSAC< SolutionType >::_RANSACEvaluator, BIAS::PreemptiveRANSAC< SolutionType >::_uiSampleSize, and BIAS::Debug::NewDebugLevel().
|
inlinevirtual |
Definition at line 90 of file PreemptiveRANSAC.hh.
|
inlineinherited |
Definition at line 355 of file Debug.hh.
Referenced by BIAS::GLProjectionParametersBase::AddDebugLevel(), BIAS::Triangulation::CorrectCorrespondences(), BIAS::FilterBase< InputStorageType, OutputStorageType >::FilterBase(), BIAS::ShowCamWxVideoSourceFactory::OpenDevice(), and BIAS::SceneOpenSceneGraph::SceneOpenSceneGraph().
|
inlineinherited |
void BIAS::PreemptiveRANSAC< SolutionType >::AddSolutionGuesses | ( | const std::vector< SolutionType > & | guesses | ) |
Definition at line 317 of file PreemptiveRANSAC.hh.
References BIAS::PreemptiveRANSAC< SolutionType >::SolStruct::eval_index, BIAS::PreemptiveRANSAC< SolutionType >::SolStruct::inliers, BIAS::PreemptiveRANSAC< SolutionType >::SolStruct::num_inliers, BIAS::PreemptiveRANSAC< SolutionType >::SolStruct::refined, BIAS::PreemptiveRANSAC< SolutionType >::SolStruct::score, and BIAS::PreemptiveRANSAC< SolutionType >::SolStruct::solution.
|
inlineprotectedinherited |
|
inlineprotected |
Definition at line 828 of file PreemptiveRANSAC.hh.
|
inlineinherited |
Definition at line 341 of file Debug.hh.
Referenced by BIAS::GenSynthMatches::_AddUniformDistributedOutliers(), BIAS::GenSynthMatches::_CreateCamMovement(), BIAS::GenSynthMatches::_CreateStatic2DPoints(), BIAS::UnscentedTransform::ComputeSigmaPoints_(), BIAS::Triangulation::CorrectCorrespondences(), BIAS::GenSynthMatches::GetGTNormalizedF(), BIAS::MonteCarloTransform::GetSamples_(), and BIAS::MonteCarloTransform::Transform().
|
inlineinherited |
|
protected |
Definition at line 713 of file PreemptiveRANSAC.hh.
|
protected |
Definition at line 526 of file PreemptiveRANSAC.hh.
|
protected |
returns the number of succesfully refined solutions
Definition at line 608 of file PreemptiveRANSAC.hh.
References BIAS::PreemptiveRANSAC< SolutionType >::SolStruct::eval_index, BIAS::PreemptiveRANSAC< SolutionType >::SolStruct::inliers, BIAS::PreemptiveRANSAC< SolutionType >::SolStruct::num_inliers, BIAS::PreemptiveRANSAC< SolutionType >::SolStruct::refined, BIAS::PreemptiveRANSAC< SolutionType >::SolStruct::score, and BIAS::PreemptiveRANSAC< SolutionType >::SolStruct::solution.
|
protected |
returns the number of generated solution
Definition at line 552 of file PreemptiveRANSAC.hh.
References BIAS::PreemptiveRANSAC< SolutionType >::SolStruct::eval_index, BIAS::PreemptiveRANSAC< SolutionType >::SolStruct::inliers, BIAS::PreemptiveRANSAC< SolutionType >::SolStruct::num_inliers, BIAS::PreemptiveRANSAC< SolutionType >::SolStruct::refined, BIAS::PreemptiveRANSAC< SolutionType >::SolStruct::score, and BIAS::PreemptiveRANSAC< SolutionType >::SolStruct::solution.
|
inlineinherited |
Definition at line 332 of file Debug.hh.
Referenced by BIAS::listenthread(), BIAS::Image< StorageType >::operator=(), and BIAS::ImageBase::operator=().
|
inlineinherited |
|
inlineinherited |
|
inlinestaticinherited |
|
protected |
Definition at line 772 of file PreemptiveRANSAC.hh.
References BIAS::PreemptiveRANSAC< SolutionType >::SolStruct::inliers, BIAS::PreemptiveRANSAC< SolutionType >::SolStruct::num_inliers, BIAS::PreemptiveRANSAC< SolutionType >::SolStruct::score, and BIAS::PreemptiveRANSAC< SolutionType >::SolStruct::solution.
|
inlineprotected |
Definition at line 219 of file PreemptiveRANSAC.hh.
References BIAS::PreemptiveRANSAC< SolutionType >::_Solutions.
|
inlineprotected |
Definition at line 250 of file PreemptiveRANSAC.hh.
References BIAS::PreemptiveRANSAC< SolutionType >::_Solutions.
void BIAS::PreemptiveRANSAC< SolutionType >::Init | ( | ) |
Definition at line 304 of file PreemptiveRANSAC.hh.
|
protected |
returns the number of rejected solutions
Definition at line 636 of file PreemptiveRANSAC.hh.
|
inlineprotected |
Definition at line 677 of file PreemptiveRANSAC.hh.
|
inlineinherited |
|
inlineinherited |
creates a new debuglevel
Definition at line 474 of file Debug.hh.
Referenced by BIAS::COSAC< SolutionType >::COSAC(), BIAS::ProjectionParametersPerspectiveDepth::Init(), BIAS::MonteCarloTransform::MonteCarloTransform(), BIAS::PMatrixEstimation::PMatrixEstimation(), BIAS::PreemptiveRANSAC< SolutionType >::PreemptiveRANSAC(), BIAS::RANSACPreKnowledge< SolutionType >::RANSACPreKnowledge(), BIAS::ROI::ROI(), BIAS::RotationAveraging::RotationAveraging(), BIAS::SceneOpenSceneGraph::SceneOpenSceneGraph(), BIAS::ThreeDOutOpenSceneGraph::ThreeDOutOpenSceneGraph(), BIAS::Triangulation::Triangulation(), and BIAS::UnscentedTransform::UnscentedTransform().
|
inlineinherited |
|
protected |
returns the number of rejected solutions
Definition at line 735 of file PreemptiveRANSAC.hh.
References BIAS::Median1D< DataType >::Compute(), and BIAS::Median1D< DataType >::GetMedian().
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Definition at line 318 of file Debug.hh.
Referenced by BIAS::ShowCamWxVideoSourceFactory::CreateBumbleBee(), BIAS::ShowCamWxVideoSourceFactory::CreateDCAM(), BIAS::VideoSource_MDcam::ScanBus(), BIAS::GLProjectionParametersBase::SetDebugLevel(), BIAS::VideoSource_Disk::VideoSource_Disk(), BIAS::VideoSource_DV2::VideoSource_DV2(), BIAS::VideoSource_DV::VideoSource_DV_Internal_Init_(), and BIAS::VideoSource_V4L::VideoSource_V4L().
|
inlineinherited |
|
inlineinherited |
|
inline |
after each EvaluationBlockSize-th measurement, the solutions are compared and only the better half is kept
Definition at line 138 of file PreemptiveRANSAC.hh.
References BIAS::PreemptiveRANSAC< SolutionType >::_uiEvaluationBlockSize.
|
inlinestaticinherited |
|
inline |
Definition at line 121 of file PreemptiveRANSAC.hh.
References BIAS::PreemptiveRANSAC< SolutionType >::_bGreedy.
|
inline |
Set max number of samples.
Ransacing will stop after max_samples samples, regardless of solution quality. Normally, more than a few thousand samples signifies a problem.
Definition at line 111 of file PreemptiveRANSAC.hh.
References BIAS::PreemptiveRANSAC< SolutionType >::_uiMaxSamples.
|
inline |
when less than MinNumInitialInliers are found, the solution is rejected straight away
Definition at line 130 of file PreemptiveRANSAC.hh.
References BIAS::PreemptiveRANSAC< SolutionType >::_uiMinNumInitialInliers.
|
inline |
Set min number of samples.
Ransacing will evaluate and compare solutions using sets of MinSamples solutions.
Definition at line 118 of file PreemptiveRANSAC.hh.
References BIAS::PreemptiveRANSAC< SolutionType >::_uiMinSamples.
|
inline |
the number of measurements that is initially evaluated
Definition at line 125 of file PreemptiveRANSAC.hh.
References BIAS::PreemptiveRANSAC< SolutionType >::_uiNumInitialChecked.
|
inline |
Definition at line 133 of file PreemptiveRANSAC.hh.
References BIAS::PreemptiveRANSAC< SolutionType >::_bRefineSolutions.
|
inlineinherited |
int BIAS::PreemptiveRANSAC< SolutionType >::SolveMaster | ( | const double | inlying_data_fraction, |
const double | max_score, | ||
SolutionType & | solution, | ||
std::vector< bool > & | inliers, | ||
unsigned & | num_inliers, | ||
double & | score, | ||
const bool | auto_compute_max_samples = false |
||
) |
for (int block=0; block<num_blocks; block++){
Definition at line 336 of file PreemptiveRANSAC.hh.
|
protected |
should termination be aborted when first good solution is found?
Definition at line 153 of file PreemptiveRANSAC.hh.
Referenced by BIAS::PreemptiveRANSAC< SolutionType >::SetGreedy().
|
protected |
just to check if the class is used correctly
Definition at line 163 of file PreemptiveRANSAC.hh.
|
protected |
should the solutions be refined?
Definition at line 159 of file PreemptiveRANSAC.hh.
Referenced by BIAS::PreemptiveRANSAC< SolutionType >::SetRefineSolutions().
|
protected |
the order in which data is used for solutions evaluation
Definition at line 186 of file PreemptiveRANSAC.hh.
|
protectedinherited |
Definition at line 510 of file Debug.hh.
Referenced by BIAS::Debug::operator=(), and BIAS::ImageBase::operator=().
|
protectedinherited |
new concept, debuglevel are managed here in the debug class
Definition at line 516 of file Debug.hh.
Referenced by BIAS::Debug::operator=().
|
protected |
the helper class for solution computation and sample evaluation
Definition at line 145 of file PreemptiveRANSAC.hh.
Referenced by BIAS::PreemptiveRANSAC< SolutionType >::PreemptiveRANSAC().
|
protected |
all (remaining) solutions
Definition at line 184 of file PreemptiveRANSAC.hh.
Referenced by BIAS::PreemptiveRANSAC< SolutionType >::GetSolutionMaxInliers_(), and BIAS::PreemptiveRANSAC< SolutionType >::GetSolutionMinScore_().
|
protectedinherited |
Definition at line 517 of file Debug.hh.
Referenced by BIAS::Debug::operator=().
|
protected |
the number of data for evaluation
Definition at line 151 of file PreemptiveRANSAC.hh.
|
protected |
after EvaluationBlockSize, bad solutions are removed
Definition at line 161 of file PreemptiveRANSAC.hh.
Referenced by BIAS::PreemptiveRANSAC< SolutionType >::SetEvaluationBlockSize().
|
protected |
Definition at line 149 of file PreemptiveRANSAC.hh.
Referenced by BIAS::PreemptiveRANSAC< SolutionType >::SetMaxSamples().
|
protected |
the minimum number of inlier from _uiNumInitialChecked
Definition at line 157 of file PreemptiveRANSAC.hh.
Referenced by BIAS::PreemptiveRANSAC< SolutionType >::SetMinNumInitialInliers().
|
protected |
the minimu and maximum number of samples investigated
Definition at line 149 of file PreemptiveRANSAC.hh.
Referenced by BIAS::PreemptiveRANSAC< SolutionType >::SetMinSamples().
|
protected |
the number of datat points that is initially checked
Definition at line 155 of file PreemptiveRANSAC.hh.
Referenced by BIAS::PreemptiveRANSAC< SolutionType >::SetNumInitialChecked().
|
protected |
the number of samples needed by GetSampleSolutions
Definition at line 147 of file PreemptiveRANSAC.hh.
Referenced by BIAS::PreemptiveRANSAC< SolutionType >::PreemptiveRANSAC().
|
staticprotectedinherited |
Definition at line 511 of file Debug.hh.
Referenced by BIAS::Debug::operator=().
|
staticprotectedinherited |
|
protected |
randomizer instance used for evaluation order computation
Definition at line 143 of file PreemptiveRANSAC.hh.
|
protected |
prevents that calls to GenerateSample_() generate the same random sample if sample solution creation fails!
Definition at line 166 of file PreemptiveRANSAC.hh.