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

BIAS::PMatrixEstimation Class Reference

compute standard P1/P2 from F. More...

#include <Geometry/PMatrixEstimation.hh>

Inheritance diagram for BIAS::PMatrixEstimation:
Collaboration diagram for BIAS::PMatrixEstimation:

List of all members.

Public Member Functions

void AddDebugLevel (const long int lv)
void AddDebugLevel (const std::string &name)
int AutoCalib (const BIAS::FMatrix &F, const int width, const int height, const std::vector< BIAS::HomgPoint2D > &p1, const std::vector< BIAS::HomgPoint2D > &p2, BIAS::PMatrix &P1, BIAS::PMatrix &P2)
 given an FMatrix, width and height of the images, and the 2D-correspondences of two images, the Levenberg-Marquardt algorithm is used to determine focal length, and the two projection matrices.
int ComputeFromFDirect (BIAS::FMatrix &F, const double &BaselineMagnitude, BIAS::PMatrix &P1, BIAS::PMatrix &P2)
 given an FMatrix set P1 as identity and compute P2 to be consistent with F and P1 such that P2 is euclidean with direct solution of the problem
void ComputeFromFQuasiEuklid (BIAS::FMatrix &F, double BaselineMagnitude, BIAS::PMatrix &P1, BIAS::PMatrix &P2)
 given an FMatrix set P1 as identity and compute P2 to be consistent with F and P1 such that P2 is euclidean with nonlinear estimation.
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
long int NewDebugLevel (const std::string &name)
 creates a new debuglevel
 PMatrixEstimation ()
 Standard constructor does nothing.
void PrintDebugLevel (std::ostream &os=std::cout) const
void RemoveDebugLevel (const std::string &name)
void RemoveDebugLevel (const long int lv)
void SetDebugLevel (const std::string &name)
void SetDebugLevel (const long int lv)
void SetDebugStream (const std::ostream &os)
void ShowDebugLevel (std::ostream &os=std::cout) const
 prints all internally known debuglevels
 ~PMatrixEstimation ()
 Standard Destructor does nothing.

Static Public Member Functions

static void ComputeRotation (BIAS::FMatrix &F, BIAS::HomgPoint2D &Epipole1, BIAS::HomgPoint2D &Epipole2, BIAS::RMatrix &R)
static void ComputeRotationCenter (BIAS::PMatrix P1, BIAS::PMatrix P2, BIAS::RMatrix &R, BIAS::Vector3< double > &C)
static long int GetGlobalDebugLevel ()
static void SetGlobalDebugLevel (long int lev)

Public Attributes

std::vector< std::vector
< double > > 
errorAll_
std::vector< double > errorSum_
BIAS::HomgPoint2D globalEpipole2_
BIAS::Matrix< double > globalM2_
int height_
 image height (hack for Levenberg Marquardt)
double lastError_
 remember error of PErrorFunc
std::vector< BIAS::HomgPoint2D >
const * 
p1_
 pointer to vector of points in image1 (hack for Levenberg Marquardt)
std::vector< BIAS::HomgPoint2D >
const * 
p2_
 pointer to vector of points in image2 (hack for Levenberg Marquardt)
int width_
 image width (hack for Levenberg Marquardt)

Protected Member Functions

int AutoCalib_ (const BIAS::FMatrix &F, const long int numCorrs, BIAS::KMatrix &K, BIAS::PMatrix &P1, BIAS::PMatrix &P2)
 private function, that can determine focal length using different initial guesses for AutoCalib
long ConsumeNextFreeDebuglevel_ ()
 returns the next available debuglevel
void FindClosestP2 (BIAS::FMatrix &F, BIAS::PMatrix &P2, Matrix3x3< double > &M2Matrix, Vector< double > &C, HomgPoint2D &Epipole2)
 given approximate P2, compute the nearest value of P2 which is exactly compatible with P1 and F
void InitP1P2Trans (BIAS::PMatrix &P1, BIAS::PMatrix &P2, BIAS::HomgPoint2D &Epipole2)
 set P1 to identity, set P2 to identity with last column epipole2

Protected Attributes

long int _liDebugLevel
long int _liNextDebugLevel
 new concept, debuglevel are managed here in the debug class
std::map< std::string, long int > _String2Debuglevel

Static Protected Attributes

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

Detailed Description

compute standard P1/P2 from F.

P1 is set to [ I | 0 ]. The epipole (determined by from F) tells us only the direction of C2, so choose a C2 with |C2| = 1

Author:
frahm, koeser
Examples:

ExampleAutoCalib.cpp, ExampleFMatrix.cpp, and PMatrixTest.cpp.

Definition at line 48 of file PMatrixEstimation.hh.


Constructor & Destructor Documentation

PMatrixEstimation::PMatrixEstimation ( )

Standard constructor does nothing.

Definition at line 63 of file PMatrixEstimation.cpp.

References BIAS::Debug::NewDebugLevel().

BIAS::PMatrixEstimation::~PMatrixEstimation ( ) [inline]

Standard Destructor does nothing.

Definition at line 55 of file PMatrixEstimation.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.

int PMatrixEstimation::AutoCalib ( const BIAS::FMatrix F,
const int  width,
const int  height,
const std::vector< BIAS::HomgPoint2D > &  p1,
const std::vector< BIAS::HomgPoint2D > &  p2,
BIAS::PMatrix P1,
BIAS::PMatrix P2 
)

given an FMatrix, width and height of the images, and the 2D-correspondences of two images, the Levenberg-Marquardt algorithm is used to determine focal length, and the two projection matrices.

Author:
sedlazeck 04/2008
Returns:
0: ok
Examples:
ExampleAutoCalib.cpp.

Definition at line 301 of file PMatrixEstimation.cpp.

References AutoCalib_(), BIAS::PMatrix::Compose(), BIAS::PMatrix::GetC(), BIAS::KMatrix::GetFx(), BIAS::PMatrix::GetK(), BIAS::PMatrix::GetR(), BIAS::EMatrix::GetRotationTranslation(), height_, BIAS::EMatrix::InitFromF(), BIAS::PMatrix::InvalidateDecomposition(), lastError_, p1_, p2_, BIAS::KMatrix::SetFx(), BIAS::KMatrix::SetFy(), BIAS::KMatrix::SetHx(), BIAS::KMatrix::SetHy(), BIAS::Matrix3x4< T >::SetIdentity(), BIAS::KMatrix::SetSkew(), and width_.

int PMatrixEstimation::AutoCalib_ ( const BIAS::FMatrix F,
const long int  numCorrs,
BIAS::KMatrix K,
BIAS::PMatrix P1,
BIAS::PMatrix P2 
) [protected]
int PMatrixEstimation::ComputeFromFDirect ( BIAS::FMatrix F,
const double &  BaselineMagnitude,
BIAS::PMatrix P1,
BIAS::PMatrix P2 
)

given an FMatrix set P1 as identity and compute P2 to be consistent with F and P1 such that P2 is euclidean with direct solution of the problem

Returns:
0: ok <0: if epipoles could not be extracted and P computation failed
Examples:
ExampleFMatrix.cpp, and PMatrixTest.cpp.

Definition at line 70 of file PMatrixEstimation.cpp.

References ComputeRotation(), BIAS::PMatrix::GetC(), BIAS::FMatrix::GetEpipoles(), BIAS::SVD::GetS(), InitP1P2Trans(), BIAS::PMatrix::InvalidateDecomposition(), BIAS::Vector3< T >::Normalize(), and BIAS::Matrix3x3< T >::Transpose().

Referenced by AutoCalib_().

void PMatrixEstimation::ComputeFromFQuasiEuklid ( BIAS::FMatrix F,
double  BaselineMagnitude,
BIAS::PMatrix P1,
BIAS::PMatrix P2 
)

given an FMatrix set P1 as identity and compute P2 to be consistent with F and P1 such that P2 is euclidean with nonlinear estimation.

Examples:
PMatrixTest.cpp.

Definition at line 182 of file PMatrixEstimation.cpp.

References FindClosestP2(), BIAS::FMatrix::GetEpipoles(), globalEpipole2_, globalM2_, InitP1P2Trans(), BIAS::Vector3< T >::Normalize(), and BIAS::Powell().

void PMatrixEstimation::ComputeRotation ( BIAS::FMatrix F,
BIAS::HomgPoint2D Epipole1,
BIAS::HomgPoint2D Epipole2,
BIAS::RMatrix R 
) [static]
void PMatrixEstimation::ComputeRotationCenter ( BIAS::PMatrix  P1,
BIAS::PMatrix  P2,
BIAS::RMatrix R,
BIAS::Vector3< double > &  C 
) [static]
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.

void PMatrixEstimation::FindClosestP2 ( BIAS::FMatrix F,
BIAS::PMatrix P2,
Matrix3x3< double > &  M2Matrix,
Vector< double > &  C,
HomgPoint2D Epipole2 
) [protected]

given approximate P2, compute the nearest value of P2 which is exactly compatible with P1 and F

Definition at line 575 of file PMatrixEstimation.cpp.

References BIAS::FMatrix::DecomposetoSR(), Lapack_LU_linear_solve(), and BIAS::Matrix< T >::Transpose().

Referenced by ComputeFromFQuasiEuklid().

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

Definition at line 415 of file Debug.hh.

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

Definition at line 406 of file Debug.hh.

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

Definition at line 432 of file Debug.hh.

void PMatrixEstimation::InitP1P2Trans ( BIAS::PMatrix P1,
BIAS::PMatrix P2,
BIAS::HomgPoint2D Epipole2 
) [protected]

set P1 to identity, set P2 to identity with last column epipole2

Definition at line 560 of file PMatrixEstimation.cpp.

References BIAS::PMatrixBase::set_identity().

Referenced by ComputeFromFDirect(), and ComputeFromFQuasiEuklid().

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.

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.


Member Data Documentation

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

std::map<std::string, long int> BIAS::Debug::_String2Debuglevel [protected, inherited]

Definition at line 518 of file Debug.hh.

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

std::ostream BIAS::Debug::_zDebugStream [static, protected, inherited]

Definition at line 512 of file Debug.hh.

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

std::vector<std::vector<double> > BIAS::PMatrixEstimation::errorAll_

Definition at line 102 of file PMatrixEstimation.hh.

Referenced by AutoCalib_().

Definition at line 101 of file PMatrixEstimation.hh.

Referenced by AutoCalib_().

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

Definition at line 514 of file Debug.hh.

Definition at line 105 of file PMatrixEstimation.hh.

Referenced by ComputeFromFQuasiEuklid().

Definition at line 104 of file PMatrixEstimation.hh.

Referenced by ComputeFromFQuasiEuklid().

image height (hack for Levenberg Marquardt)

Definition at line 97 of file PMatrixEstimation.hh.

Referenced by AutoCalib().

remember error of PErrorFunc

Definition at line 99 of file PMatrixEstimation.hh.

Referenced by AutoCalib().

pointer to vector of points in image1 (hack for Levenberg Marquardt)

Definition at line 91 of file PMatrixEstimation.hh.

Referenced by AutoCalib().

pointer to vector of points in image2 (hack for Levenberg Marquardt)

Definition at line 93 of file PMatrixEstimation.hh.

Referenced by AutoCalib().

image width (hack for Levenberg Marquardt)

Definition at line 95 of file PMatrixEstimation.hh.

Referenced by AutoCalib().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends