Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
BIAS::COSAC< SolutionType > Class Template Reference

Complete Sampling Consesus. More...

#include <MathAlgo/COSAC.hh>

+ Inheritance diagram for BIAS::COSAC< SolutionType >:

Classes

struct  SolStruct
 

Public Member Functions

void AddDebugLevel (const long int lv)
 
void AddDebugLevel (const std::string &name)
 
 COSAC (RANSACEvaluatorInterface< SolutionType > *shi)
 c'tor More...
 
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
 
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...
 
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 SetRefineSolutions (const unsigned 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)
 
virtual ~COSAC ()
 d'tor More...
 

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 EvaluateSolutions_ (const unsigned data_size)
 evaluates the solutions More...
 
int GenerateRefinedSolutions_ (const unsigned data_size)
 returns the number of succesfully refined solutions More...
 
int GenerateSolutions_ (const unsigned sample_size, const unsigned data_size)
 returns the number of generated solution More...
 
bool GetNextCombination_ (const unsigned sample_size, const unsigned data_size, std::vector< unsigned > &which_samples)
 Returns the next combination of samples from which a solution can be computed. More...
 
int GetSolution_ (const unsigned min_num_inliers, const double max_score, SolutionType &solution, std::vector< bool > &inliers, unsigned &num_inliers, double &score) const
 
const struct SolStructGetSolutionMaxInliers_ (const unsigned min_num_inliers, const double max_score) const
 
const struct SolStructGetSolutionMinScore_ (const unsigned min_num_inliers, const double max_score) const
 
bool IsInlier_ (typename std::list< SolStruct >::iterator solution, const unsigned eval_index, double &score)
 

Protected Attributes

bool _bRefineSolutions
 should the solutions be refined? More...
 
long int _liDebugLevel
 
long int _liNextDebugLevel
 new concept, debuglevel are managed here in the debug class More...
 
std::list< SolStruct_Solutions
 all solutions More...
 
std::map< std::string, long int > _String2Debuglevel
 
unsigned _uiDataSize
 the number of data for evaluation More...
 
unsigned _uiSampleSize
 the number of samples needed by GetSampleSolutions More...
 
RANSACEvaluatorInterface
< SolutionType > * 
RANSACEvaluator_
 the helper class for solution computation and sample evaluation More...
 

Static Protected Attributes

static std::ostream _zDebugStream
 
static long int GlobalDebugLevel = 0
 

Detailed Description

template<class SolutionType>
class BIAS::COSAC< SolutionType >

Complete Sampling Consesus.

Samples the space of possible solutions completely. The algorithm (complete sampling and evaluation) 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;

Afterwards instantiate COSAC with a pointer to the sibling of RANSACEvaluatorInterface as argment to the constructor and call

SolveMaster()

Author
woelk 01/2010 (c) www.vision-n.de

Definition at line 79 of file COSAC.hh.

Constructor & Destructor Documentation

template<class SolutionType >
BIAS::COSAC< SolutionType >::COSAC ( RANSACEvaluatorInterface< SolutionType > *  shi)
template<class SolutionType>
virtual BIAS::COSAC< SolutionType >::~COSAC ( )
inlinevirtual

d'tor

Definition at line 86 of file COSAC.hh.

Member Function Documentation

void BIAS::Debug::AddDebugLevel ( const long int  lv)
inlineinherited
void BIAS::Debug::AddDebugLevel ( const std::string &  name)
inlineinherited

Definition at line 362 of file Debug.hh.

long BIAS::Debug::ConsumeNextFreeDebuglevel_ ( )
inlineprotectedinherited

returns the next available debuglevel

Author
woelk 09/2006

Definition at line 521 of file Debug.hh.

bool BIAS::Debug::DebugLevelIsSet ( const long int  lv) const
inlineinherited
bool BIAS::Debug::DebugLevelIsSet ( const std::string &  name) const
inlineinherited

Definition at line 350 of file Debug.hh.

template<class SolutionType >
void BIAS::COSAC< SolutionType >::EvaluateSolutions_ ( const unsigned  data_size)
protected

evaluates the solutions

Definition at line 348 of file COSAC.hh.

template<class SolutionType >
int BIAS::COSAC< SolutionType >::GenerateRefinedSolutions_ ( const unsigned  data_size)
protected
template<class SolutionType >
int BIAS::COSAC< SolutionType >::GenerateSolutions_ ( const unsigned  sample_size,
const unsigned  data_size 
)
protected
int BIAS::Debug::GetDebugLevel ( ) const
inlineinherited
std::ostream& BIAS::Debug::GetDebugStream ( ) const
inlineinherited

Definition at line 405 of file Debug.hh.

void BIAS::Debug::GetDebugStream ( std::ostream &  os) const
inlineinherited

Definition at line 414 of file Debug.hh.

static long int BIAS::Debug::GetGlobalDebugLevel ( )
inlinestaticinherited

Definition at line 431 of file Debug.hh.

template<class SolutionType >
bool BIAS::COSAC< SolutionType >::GetNextCombination_ ( const unsigned  sample_size,
const unsigned  data_size,
std::vector< unsigned > &  which_samples 
)
protected

Returns the next combination of samples from which a solution can be computed.

Returns false when all combinations have been returned. The argument vector which_samples must be empty on initial call

Definition at line 493 of file COSAC.hh.

template<class SolutionType >
int BIAS::COSAC< SolutionType >::GetSolution_ ( const unsigned  min_num_inliers,
const double  max_score,
SolutionType &  solution,
std::vector< bool > &  inliers,
unsigned &  num_inliers,
double &  score 
) const
protected
template<class SolutionType>
const struct SolStruct* BIAS::COSAC< SolutionType >::GetSolutionMaxInliers_ ( const unsigned  min_num_inliers,
const double  max_score 
) const
inlineprotected

Definition at line 152 of file COSAC.hh.

References BIAS::COSAC< SolutionType >::_Solutions.

template<class SolutionType>
const struct SolStruct* BIAS::COSAC< SolutionType >::GetSolutionMinScore_ ( const unsigned  min_num_inliers,
const double  max_score 
) const
inlineprotected

Definition at line 183 of file COSAC.hh.

References BIAS::COSAC< SolutionType >::_Solutions.

template<class SolutionType >
bool BIAS::COSAC< SolutionType >::IsInlier_ ( typename std::list< SolStruct >::iterator  solution,
const unsigned  eval_index,
double &  score 
)
protected

Definition at line 404 of file COSAC.hh.

long int BIAS::Debug::Name2DebugLevel ( const std::string &  name) const
inlineinherited

looks up a debuglevel in the internal map, returns 0 if not found

Author
woelk 09/2006

Definition at line 454 of file Debug.hh.

long int BIAS::Debug::NewDebugLevel ( const std::string &  name)
inlineinherited
void BIAS::Debug::PrintDebugLevel ( std::ostream &  os = std::cout) const
inlineinherited

Definition at line 383 of file Debug.hh.

void BIAS::Debug::RemoveDebugLevel ( const long int  lv)
inlineinherited

Definition at line 369 of file Debug.hh.

void BIAS::Debug::RemoveDebugLevel ( const std::string &  name)
inlineinherited

Definition at line 376 of file Debug.hh.

void BIAS::Debug::SetDebugLevel ( const long int  lv)
inlineinherited
void BIAS::Debug::SetDebugLevel ( const std::string &  name)
inlineinherited

Definition at line 325 of file Debug.hh.

void BIAS::Debug::SetDebugStream ( const std::ostream &  os)
inlineinherited

Definition at line 398 of file Debug.hh.

static void BIAS::Debug::SetGlobalDebugLevel ( long int  lev)
inlinestaticinherited

Definition at line 424 of file Debug.hh.

template<class SolutionType>
void BIAS::COSAC< SolutionType >::SetRefineSolutions ( const unsigned  refine_solutions)
inline

Definition at line 96 of file COSAC.hh.

References BIAS::COSAC< SolutionType >::_bRefineSolutions.

void BIAS::Debug::ShowDebugLevel ( std::ostream &  os = std::cout) const
inlineinherited

prints all internally known debuglevels

Author
woelk 09/2006

Definition at line 496 of file Debug.hh.

template<class SolutionType >
int BIAS::COSAC< SolutionType >::SolveMaster ( const double  inlying_data_fraction,
const double  max_score,
SolutionType &  solution,
std::vector< bool > &  inliers,
unsigned &  num_inliers,
double &  score 
)
Returns
COSAC_OK when a solution could be found, a positive number when a solution could be found which did not met the minimum qulaity criteria (i.e. min_num_inliers and maximum score) and a negative number when absolutly no solution could be found

Definition at line 231 of file COSAC.hh.

References BIAS::BinomialCoefficient::Compute(), and BIAS::BaseException::What().

Member Data Documentation

template<class SolutionType>
bool BIAS::COSAC< SolutionType >::_bRefineSolutions
protected

should the solutions be refined?

Definition at line 107 of file COSAC.hh.

Referenced by BIAS::COSAC< SolutionType >::SetRefineSolutions().

long int BIAS::Debug::_liDebugLevel
protectedinherited

Definition at line 510 of file Debug.hh.

Referenced by BIAS::Debug::operator=(), and BIAS::ImageBase::operator=().

long int BIAS::Debug::_liNextDebugLevel
protectedinherited

new concept, debuglevel are managed here in the debug class

Definition at line 516 of file Debug.hh.

Referenced by BIAS::Debug::operator=().

template<class SolutionType>
std::list<SolStruct> BIAS::COSAC< SolutionType >::_Solutions
protected
std::map<std::string, long int> BIAS::Debug::_String2Debuglevel
protectedinherited

Definition at line 517 of file Debug.hh.

Referenced by BIAS::Debug::operator=().

template<class SolutionType>
unsigned BIAS::COSAC< SolutionType >::_uiDataSize
protected

the number of data for evaluation

Definition at line 105 of file COSAC.hh.

template<class SolutionType>
unsigned BIAS::COSAC< SolutionType >::_uiSampleSize
protected

the number of samples needed by GetSampleSolutions

Definition at line 103 of file COSAC.hh.

Referenced by BIAS::COSAC< SolutionType >::COSAC().

std::ostream BIAS::Debug::_zDebugStream
staticprotectedinherited

Definition at line 511 of file Debug.hh.

Referenced by BIAS::Debug::operator=().

long int BIAS::Debug::GlobalDebugLevel = 0
staticprotectedinherited

Definition at line 513 of file Debug.hh.

template<class SolutionType>
RANSACEvaluatorInterface<SolutionType>* BIAS::COSAC< SolutionType >::RANSACEvaluator_
protected

the helper class for solution computation and sample evaluation

Definition at line 101 of file COSAC.hh.

Referenced by BIAS::COSAC< SolutionType >::COSAC().


The documentation for this class was generated from the following file: