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

functions for estimating a fundamental matrix (FMatrix) given a set of 2d-2d correspondences (no outlier checks, not robust !) in two views More...

#include <Geometry/FMatrixEstimation.hh>

+ Inheritance diagram for BIAS::FMatrixEstimation:
+ Collaboration diagram for BIAS::FMatrixEstimation:

Public Member Functions

void AddDebugLevel (const long int lv)
 
void AddDebugLevel (const std::string &name)
 
void ComputeNormFParam (const BIAS::FMatrix &initialF, BIAS::FMatrix &normF)
 rank 2 F matrix parametrization as implemented in Parametrization does not work in some cases, eg. More...
 
bool DebugLevelIsSet (const long int lv) const
 
bool DebugLevelIsSet (const std::string &name) const
 
int EightPoint (BIAS::FMatrix &F, const std::vector< BIAS::HomgPoint2D > &p1, const std::vector< BIAS::HomgPoint2D > &p2)
 compute an FMatrix from eight point correspondences More...
 
void EnforceMaxRank2 (BIAS::FMatrix &F)
 enforces a maximum rank of two by setting the smallest singular value to zero More...
 
 FMatrixEstimation (bool NormalizeHartley=true)
 constructor with general parameters More...
 
int GetDebugLevel () const
 
std::ostream & GetDebugStream () const
 
void GetDebugStream (std::ostream &os) const
 
void GetDetPolynomial (const BIAS::Vector< double > &f1, const BIAS::Vector< double > &f2, std::vector< POLYNOMIALSOLVE_TYPE > &v)
 set up a polynomial in alpha given Det(alpha*F1+(1-alpha)*F2)=0, where the f vectors are interpreted as the rows of a 3x3 matrix More...
 
int GoldStandard (BIAS::FMatrix &F, const std::vector< BIAS::HomgPoint2D > &p1, const std::vector< BIAS::HomgPoint2D > &p2)
 Compute FMatrix using the Gold Standard algorithm as in Hartley and Zisserman p. More...
 
int Linear (BIAS::FMatrix &F, const std::vector< BIAS::HomgPoint2D > &p1, const std::vector< BIAS::HomgPoint2D > &p2)
 compute an FMatrix from more than seven point correspondences More...
 
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...
 
int Optimize (BIAS::FMatrix &F, const std::vector< BIAS::HomgPoint2D > &p1, const std::vector< BIAS::HomgPoint2D > &p2)
 optimize a given FMatrix regarding n 2d point correspondences 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)
 
int SevenPoint (std::vector< BIAS::FMatrix > &Fvec, const std::vector< BIAS::HomgPoint2D > &p1, const std::vector< BIAS::HomgPoint2D > &p2)
 compute a vector of FMatrices from seven point correspondences More...
 
void ShowDebugLevel (std::ostream &os=std::cout) const
 prints all internally known debuglevels More...
 

Static Public Member Functions

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

Public Attributes

BIAS::ParametrizationcurrentPara_
 
int itersLM_
 count Levenberg-Marquardt iterations More...
 
Matrix3x3< double > NormF1_
 matrix for saving normalization of 2D points - important for f parametrization More...
 
Matrix3x3< double > NormF2_
 matrix for saving normalization of 2D points - important for f parametrization More...
 
std::vector< BIAS::HomgPoint2D >
const * 
p1_
 pointer to vector of points in image1 (hack for Optimize) More...
 
std::vector< BIAS::HomgPoint2D >
const * 
p2_
 pointer to vector of points in image2 (hack for Optimize) More...
 

Protected Member Functions

long ConsumeNextFreeDebuglevel_ ()
 returns the next available debuglevel More...
 

Protected Attributes

long int _liDebugLevel
 
long int _liNextDebugLevel
 new concept, debuglevel are managed here in the debug class More...
 
std::map< std::string, long int > _String2Debuglevel
 
Normalization N_
 the normalization object More...
 
bool NormalizeHartley_
 flag indicating whether we should normalize the given points before and denormalize the fmatrix after computation, so that it refers to the original points More...
 

Static Protected Attributes

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

Detailed Description

functions for estimating a fundamental matrix (FMatrix) given a set of 2d-2d correspondences (no outlier checks, not robust !) in two views

Author
koeser 11/2003
Examples:
Example7Point.cpp, ExampleAutoCalib.cpp, ExampleFMatrix.cpp, and FMatrixTest.cpp.

Definition at line 46 of file FMatrixEstimation.hh.

Constructor & Destructor Documentation

BIAS::FMatrixEstimation::FMatrixEstimation ( bool  NormalizeHartley = true)
inlineexplicit

constructor with general parameters

Parameters
NormalizeHartleydo hartley normalization on 7/8 points

Definition at line 51 of file FMatrixEstimation.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.

void FMatrixEstimation::ComputeNormFParam ( const BIAS::FMatrix initialF,
BIAS::FMatrix normF 
)

rank 2 F matrix parametrization as implemented in Parametrization does not work in some cases, eg.

when epipoles are at infinity. This normalizatin as described in Estimating the fundamental matrix by transforming image points in projective space by Zhang and Loop Application of this function can be seen in Optimize

Definition at line 533 of file FMatrixEstimation.cpp.

References BIAS::FMatrix, BIAS::FMatrix::GetEpipoles(), and BIAS::Matrix3x3< T >::Transpose().

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.

int BIAS::FMatrixEstimation::EightPoint ( BIAS::FMatrix F,
const std::vector< BIAS::HomgPoint2D > &  p1,
const std::vector< BIAS::HomgPoint2D > &  p2 
)
inline

compute an FMatrix from eight point correspondences

This algorithm computes a least squares F on all point correspondences using SVD of a model matrix. Rank 2 is enforced afterwards, therefore

Attention
For robust computation it is strongly recommended that you normalize your correspondences (e.g. "Hartley")
Parameters
Fmatrix which is computed
p1(homogenized!) points in image 1
p2corresponding (homogenized!) points in image 2
Returns
0=success, !=0: error
Author
koeser 11/2003
Examples:
ExampleAutoCalib.cpp, and ExampleFMatrix.cpp.

Definition at line 102 of file FMatrixEstimation.hh.

void FMatrixEstimation::EnforceMaxRank2 ( BIAS::FMatrix F)

enforces a maximum rank of two by setting the smallest singular value to zero

Parameters
Fmatrix which has rank MIN{2, previous_rank} afterwards
Author
koeser 11/2003

Definition at line 502 of file FMatrixEstimation.cpp.

References BIAS::SVD::GetS(), BIAS::SVD::GetU(), and BIAS::SVD::GetVT().

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.

void FMatrixEstimation::GetDetPolynomial ( const BIAS::Vector< double > &  f1,
const BIAS::Vector< double > &  f2,
std::vector< POLYNOMIALSOLVE_TYPE > &  v 
)

set up a polynomial in alpha given Det(alpha*F1+(1-alpha)*F2)=0, where the f vectors are interpreted as the rows of a 3x3 matrix

Parameters
f1vector to be interpreted as a 3x3 matrix F1
f2vector to be interpreted as a 3x3 matrix F2
vvector of polynomial coefficients in PolynomialSolve style
Author
koeser 11/2003

Definition at line 444 of file FMatrixEstimation.cpp.

References TNT::Vector< T >::size().

Referenced by BIAS::Conic2D::IntersectConicProper().

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

Definition at line 431 of file Debug.hh.

int FMatrixEstimation::GoldStandard ( BIAS::FMatrix F,
const std::vector< BIAS::HomgPoint2D > &  p1,
const std::vector< BIAS::HomgPoint2D > &  p2 
)

Compute FMatrix using the Gold Standard algorithm as in Hartley and Zisserman p.

285

Parameters
Fmatrix which is calculated
p1(homogenized points in image1
p2corresponding (homogenized!) points in image 2
Returns
0=success, !=0: error
Author
sedlazeck 04/2008

Definition at line 319 of file FMatrixEstimation.cpp.

References BIAS::FMatrix::GetEpipoles(), BIAS::Vector3< T >::GetSkewSymmetricMatrix(), BIAS::HomgPoint3D::Homogenize(), BIAS::LevenbergMarquardt(), BIAS::MatrixIdentity, BIAS::Vector3< T >::Normalize(), BIAS::Triangulation::Optimal(), BIAS::Matrix< T >::SetCol(), and BIAS::Matrix3x4< T >::SetIdentity().

int FMatrixEstimation::Linear ( BIAS::FMatrix F,
const std::vector< BIAS::HomgPoint2D > &  p1,
const std::vector< BIAS::HomgPoint2D > &  p2 
)

compute an FMatrix from more than seven point correspondences

This algorithm computes a least squares F on all point correspondences using SVD of a model matrix. Rank 2 is enforced afterwards.

Attention
For robust computation it is strongly recommended that you normalize your correspondences (e.g. "Hartley")
Parameters
Fmatrix which is computed
p1(homogenized!) points in image 1
p2corresponding (homogenized!) points in image 2
Returns
0=success, !=0: error
Author
koeser 11/2003

Definition at line 205 of file FMatrixEstimation.cpp.

References BIAS::SVD::GetVT(), and BIAS::Matrix3x3< T >::Transpose().

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
int FMatrixEstimation::Optimize ( BIAS::FMatrix F,
const std::vector< BIAS::HomgPoint2D > &  p1,
const std::vector< BIAS::HomgPoint2D > &  p2 
)

optimize a given FMatrix regarding n 2d point correspondences

minimize an error function on F matrix using iterative nonlinear optimization techniques such as Levenberg/Marquardt

Attention
susceptable to local minima, provide good starting point F
Parameters
Fmatrix which is optimized
p1(homogenized!) points in image 1
p2corresponding (homogenized!) points in image 2
Returns
0=success, !=0: error
Author
koeser 11/2003
Examples:
ExampleFMatrix.cpp.

Definition at line 261 of file FMatrixEstimation.cpp.

References BIAS::FMatrix, BIAS::Parametrization::FMatrixToParams(), BIAS::FMatrix::GetEpipolesHomogenized(), BIAS::LevenbergMarquardt(), and BIAS::Matrix3x3< T >::Normalize().

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.

int FMatrixEstimation::SevenPoint ( std::vector< BIAS::FMatrix > &  Fvec,
const std::vector< BIAS::HomgPoint2D > &  p1,
const std::vector< BIAS::HomgPoint2D > &  p2 
)

compute a vector of FMatrices from seven point correspondences

Depending on the setting of the 3d points and the cameras of the originating epipolar geometry a vector of no, one or three solutions is computed:

  • degenrate case: no solution
  • 3d points and cam centers all lie on a ruled quadric: 3 solutions
  • 3d points and cam centers all lie on an unruled quadric: 1 solution
Attention
For robust computation it is strongly recommended that you normalize your correspondences (e.g. "Hartley")
Parameters
Fvec(output) vector of F matrices which are computed
p1(homogenized!) points in image 1
p2corresponding (homogenized!) points in image 2
Returns
0=success, !=0: error tested, not-optimized
Author
koeser 11/2003
Examples:
Example7Point.cpp, and FMatrixTest.cpp.

Definition at line 130 of file FMatrixEstimation.cpp.

References BIAS::PolynomialSolve::Analytic(), BIAS::PolynomialSolve::CheckCoefficients(), BIAS::SVD::GetNullvector(), and BIAS::Matrix3x3< T >::Transpose().

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.

Member Data Documentation

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=().

std::map<std::string, long int> BIAS::Debug::_String2Debuglevel
protectedinherited

Definition at line 517 of file Debug.hh.

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

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

Definition at line 511 of file Debug.hh.

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

BIAS::Parametrization* BIAS::FMatrixEstimation::currentPara_

Definition at line 167 of file FMatrixEstimation.hh.

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

Definition at line 513 of file Debug.hh.

int BIAS::FMatrixEstimation::itersLM_

count Levenberg-Marquardt iterations

Definition at line 145 of file FMatrixEstimation.hh.

Normalization BIAS::FMatrixEstimation::N_
protected

the normalization object

Definition at line 176 of file FMatrixEstimation.hh.

bool BIAS::FMatrixEstimation::NormalizeHartley_
protected

flag indicating whether we should normalize the given points before and denormalize the fmatrix after computation, so that it refers to the original points

Definition at line 173 of file FMatrixEstimation.hh.

Matrix3x3<double> BIAS::FMatrixEstimation::NormF1_

matrix for saving normalization of 2D points - important for f parametrization

Definition at line 163 of file FMatrixEstimation.hh.

Matrix3x3<double> BIAS::FMatrixEstimation::NormF2_

matrix for saving normalization of 2D points - important for f parametrization

Definition at line 165 of file FMatrixEstimation.hh.

std::vector<BIAS::HomgPoint2D> const* BIAS::FMatrixEstimation::p1_

pointer to vector of points in image1 (hack for Optimize)

Definition at line 141 of file FMatrixEstimation.hh.

std::vector<BIAS::HomgPoint2D> const* BIAS::FMatrixEstimation::p2_

pointer to vector of points in image2 (hack for Optimize)

Definition at line 143 of file FMatrixEstimation.hh.


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