Basic Image AlgorithmS Library 2.8.0
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes

BIAS::COSAC< SolutionType > Class Template Reference

Complete Sampling Consesus. More...

#include <MathAlgo/COSAC.hh>

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

List of all members.

Classes

struct  SolStruct

Public Member Functions

void AddDebugLevel (const long int lv)
void AddDebugLevel (const std::string &name)
 COSAC (RANSACEvaluatorInterface< SolutionType > *shi)
 c'tor
bool DebugLevelIsSet (const std::string &name) const
bool DebugLevelIsSet (const long int lv) 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
long int NewDebugLevel (const std::string &name)
 creates a new debuglevel
void PrintDebugLevel (std::ostream &os=std::cout) const
void RemoveDebugLevel (const std::string &name)
void RemoveDebugLevel (const long int lv)
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
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

Static Public Member Functions

static long int GetGlobalDebugLevel ()
static void SetGlobalDebugLevel (long int lev)

Protected Member Functions

long ConsumeNextFreeDebuglevel_ ()
 returns the next available debuglevel
void EvaluateSolutions_ (const unsigned data_size)
 evaluates the solutions
int GenerateRefinedSolutions_ (const unsigned data_size)
 returns the number of succesfully refined solutions
int GenerateSolutions_ (const unsigned sample_size, const unsigned data_size)
 returns the number of generated solution
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.
int GetSolution_ (const unsigned min_num_inliers, const double max_score, SolutionType &solution, std::vector< bool > &inliers, unsigned &num_inliers, double &score) const
struct SolStructGetSolutionMaxInliers_ (const unsigned min_num_inliers, const double max_score) 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?
long int _liDebugLevel
long int _liNextDebugLevel
 new concept, debuglevel are managed here in the debug class
std::list< SolStruct_Solutions
 all solutions
std::map< std::string, long int > _String2Debuglevel
unsigned _uiDataSize
 the number of data for evaluation
unsigned _uiSampleSize
 the number of samples needed by GetSampleSolutions
RANSACEvaluatorInterface
< SolutionType > * 
RANSACEvaluator_
 the helper class for solution computation and sample evaluation

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 ( ) [inline, virtual]

d'tor

Definition at line 86 of file COSAC.hh.


Member Function Documentation

void BIAS::Debug::AddDebugLevel ( const long int  lv) [inline, inherited]
void BIAS::Debug::AddDebugLevel ( const std::string &  name) [inline, inherited]

Definition at line 363 of file Debug.hh.

long BIAS::Debug::ConsumeNextFreeDebuglevel_ ( ) [inline, protected, inherited]

returns the next available debuglevel

Author:
woelk 09/2006

Definition at line 522 of file Debug.hh.

bool BIAS::Debug::DebugLevelIsSet ( const long int  lv) const [inline, inherited]
bool BIAS::Debug::DebugLevelIsSet ( const std::string &  name) const [inline, inherited]

Definition at line 351 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 [inline, inherited]
std::ostream& BIAS::Debug::GetDebugStream ( ) const [inline, inherited]

Definition at line 406 of file Debug.hh.

void BIAS::Debug::GetDebugStream ( std::ostream &  os) const [inline, inherited]

Definition at line 415 of file Debug.hh.

static long int BIAS::Debug::GetGlobalDebugLevel ( ) [inline, static, inherited]

Definition at line 432 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>
struct SolStruct* BIAS::COSAC< SolutionType >::GetSolutionMaxInliers_ ( const unsigned  min_num_inliers,
const double  max_score 
) const [inline, read, protected]

Definition at line 152 of file COSAC.hh.

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

template<class SolutionType>
struct SolStruct* BIAS::COSAC< SolutionType >::GetSolutionMinScore_ ( const unsigned  min_num_inliers,
const double  max_score 
) const [inline, read, protected]

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 [inline, inherited]

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

Author:
woelk 09/2006

Definition at line 455 of file Debug.hh.

long int BIAS::Debug::NewDebugLevel ( const std::string &  name) [inline, inherited]
void BIAS::Debug::PrintDebugLevel ( std::ostream &  os = std::cout) const [inline, inherited]

Definition at line 384 of file Debug.hh.

void BIAS::Debug::RemoveDebugLevel ( const std::string &  name) [inline, inherited]

Definition at line 377 of file Debug.hh.

void BIAS::Debug::RemoveDebugLevel ( const long int  lv) [inline, inherited]

Definition at line 370 of file Debug.hh.

void BIAS::Debug::SetDebugLevel ( const long int  lv) [inline, inherited]
void BIAS::Debug::SetDebugLevel ( const std::string &  name) [inline, inherited]

Definition at line 326 of file Debug.hh.

void BIAS::Debug::SetDebugStream ( const std::ostream &  os) [inline, inherited]

Definition at line 399 of file Debug.hh.

static void BIAS::Debug::SetGlobalDebugLevel ( long int  lev) [inline, static, inherited]

Definition at line 425 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 [inline, inherited]

prints all internally known debuglevels

Author:
woelk 09/2006

Definition at line 497 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 [protected, inherited]

Definition at line 511 of file Debug.hh.

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

long int BIAS::Debug::_liNextDebugLevel [protected, inherited]

new concept, debuglevel are managed here in the debug class

Definition at line 517 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 [protected, inherited]

Definition at line 518 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 [static, protected, inherited]

Definition at line 512 of file Debug.hh.

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

long int BIAS::Debug::GlobalDebugLevel = 0 [static, protected, inherited]

Definition at line 514 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:
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends