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 | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
BIAS::RotationAveraging Class Reference

Computes mean of rotations due to different measures. More...

#include <Geometry/RotationAveraging.hh>

+ Inheritance diagram for BIAS::RotationAveraging:
+ Collaboration diagram for BIAS::RotationAveraging:

Public Member Functions

void AddDebugLevel (const long int lv)
 
void AddDebugLevel (const std::string &name)
 
int ChordalL2Mean (const std::vector< BIAS::RMatrix > &R, BIAS::RMatrix &meanR)
 Compute chordal L2-mean of rotations. More...
 
int ChordalL2Mean (const std::vector< BIAS::Quaternion< double > > &Q, BIAS::Quaternion< double > &meanQ)
 Compute chordal L2-mean of rotations using unit quaternions. More...
 
bool DebugLevelIsSet (const long int lv) const
 
bool DebugLevelIsSet (const std::string &name) const
 
int GeodesicL1Mean (const std::vector< BIAS::RMatrix > &R, BIAS::RMatrix &meanR)
 Compute geodesic L1-mean (geodesic median) of rotations. More...
 
int GeodesicL2Mean (const std::vector< BIAS::RMatrix > &R, BIAS::RMatrix &meanR)
 Compute geodesic L2-mean (Karcher/geometric mean) of rotations. More...
 
int GetDebugLevel () const
 
std::ostream & GetDebugStream () const
 
void GetDebugStream (std::ostream &os) const
 
int LogarithmicL2Mean (const std::vector< BIAS::RMatrix > &R, BIAS::RMatrix &meanR)
 Compute matrix logarithm L2-mean of rotations. 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...
 
void PrintDebugLevel (std::ostream &os=std::cout) const
 
int QuaternionL2Mean (const std::vector< BIAS::RMatrix > &R, BIAS::RMatrix &meanR)
 Compute quaternion L2-mean of rotations. More...
 
int QuaternionL2Mean (const std::vector< BIAS::Quaternion< double > > &Q, BIAS::Quaternion< double > &meanQ)
 Compute quaternion L2-mean of rotations. More...
 
void RemoveDebugLevel (const long int lv)
 
void RemoveDebugLevel (const std::string &name)
 
 RotationAveraging ()
 
void SetDebugLevel (const long int lv)
 
void SetDebugLevel (const std::string &name)
 
void SetDebugStream (const std::ostream &os)
 
void SetMaxIterations (unsigned int num)
 Set maximal number of iterations for geodesic L1-/L2-mean computation. More...
 
void SetTolerance (double epsilon)
 Set threshold for convergence of iterative geodesic L1-/L2-mean computation. More...
 
void ShowDebugLevel (std::ostream &os=std::cout) const
 prints all internally known debuglevels More...
 
 ~RotationAveraging ()
 

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...
 

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
 

Static Protected Attributes

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

Detailed Description

Computes mean of rotations due to different measures.

Author
esquivel
Date
09/2011

This tool computes the average rotation of given rotations R_1,...,R_n with respect to different distance measures d: SO(3) x SO(3) -> R on rotations as described in [1]. The L2-mean for a given d is defined by the rotation matrix R from mean(R_1,...,R_n) = {i=1}^N d(R,R_i)^2 while the L1-mean is given by {i=1}^N d(R,R_i).

Implemented so far are:

While closed form solutions exist for the L2-means (except geodesic mean), iterative algorithms are given for the geodesic L1-/L2-mean.

The solution is in general only optimal under the assumptions that the rotation angles of all R_i are less than 180 degree resp. all rotations cover less than a hemisphere of the space SO(3).

[1] Y. Dai, J. Trumpf, H. Li, N. Barnes & R. Hartley: "Rotation Averaging with Application to Camera-Rig Calibration", 2009. [2] R. Hartley, K. Aftab, J. Trumpf: "L1 Rotation Averaging Using the Weiszfeld Algorithm", 2011.

Definition at line 55 of file RotationAveraging.hh.

Constructor & Destructor Documentation

RotationAveraging::RotationAveraging ( )

Definition at line 14 of file RotationAveraging.cpp.

References BIAS::Debug::NewDebugLevel().

BIAS::RotationAveraging::~RotationAveraging ( )
inline

Definition at line 61 of file RotationAveraging.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.

int RotationAveraging::ChordalL2Mean ( const std::vector< BIAS::RMatrix > &  R,
BIAS::RMatrix meanR 
)

Compute chordal L2-mean of rotations.

Parameters
[in]RInput rotation matrices to compute the average for
[out]meanROutput average rotation matrix
Returns
Returns 0 on success, < 0 otherwise.

Definition at line 154 of file RotationAveraging.cpp.

References BIAS::RMatrix::EnforceConstraints(), and BIAS::MatrixZero.

int RotationAveraging::ChordalL2Mean ( const std::vector< BIAS::Quaternion< double > > &  Q,
BIAS::Quaternion< double > &  meanQ 
)

Compute chordal L2-mean of rotations using unit quaternions.

Parameters
[in]QInput unit quaternions to compute the average for
[out]meanQOutput average rotation as unit quaternion
Returns
Returns 0 on success, < 0 otherwise.

Definition at line 170 of file RotationAveraging.cpp.

References BIAS::Matrix< T >::GetCol(), BIAS::SVD::GetV(), BIAS::MatrixZero, BIAS::Quaternion< T >::Normalize(), and BIAS::Vector4< T >::SetZero().

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 RotationAveraging::GeodesicL1Mean ( const std::vector< BIAS::RMatrix > &  R,
BIAS::RMatrix meanR 
)

Compute geodesic L1-mean (geodesic median) of rotations.

Parameters
[in]RInput rotation matrices to compute the average for
[out]meanROutput average rotation matrix
Returns
Returns 0 on success, < 0 otherwise.

Definition at line 21 of file RotationAveraging.cpp.

References BIAS::Equal(), GeodesicL2Mean(), BIAS::RMatrixBase::GetRotationAxisAngle(), BIAS::Vector3< T >::MultiplyIP(), BIAS::Vector3< T >::Normalize(), BIAS::Vector3< T >::NormL2(), BIAS::RMatrixBase::Set(), BIAS::Vector3< T >::SetZero(), and BIAS::Matrix3x3< T >::Transpose().

int RotationAveraging::GeodesicL2Mean ( const std::vector< BIAS::RMatrix > &  R,
BIAS::RMatrix meanR 
)

Compute geodesic L2-mean (Karcher/geometric mean) of rotations.

Parameters
[in]RInput rotation matrices to compute the average for
[out]meanROutput average rotation matrix
Returns
Returns 0 on success, < 0 otherwise.

Definition at line 69 of file RotationAveraging.cpp.

References BIAS::RMatrixBase::GetRotationAxisAngle(), BIAS::Vector3< T >::Normalize(), BIAS::Vector3< T >::NormL2(), BIAS::RMatrixBase::Set(), BIAS::Vector3< T >::SetZero(), and BIAS::Matrix3x3< T >::Transpose().

Referenced by GeodesicL1Mean().

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.

int RotationAveraging::LogarithmicL2Mean ( const std::vector< BIAS::RMatrix > &  R,
BIAS::RMatrix meanR 
)

Compute matrix logarithm L2-mean of rotations.

The matrix logarithm of a rotation matrix is the angle/axis vector phi * r, also known as the modified Rodrigues vector.

Parameters
[in]RInput rotation matrices to compute the average for
[out]meanROutput average rotation matrix
Returns
Returns 0 on success, < 0 otherwise.

Definition at line 140 of file RotationAveraging.cpp.

References BIAS::Vector3< T >::MultiplyIP(), and BIAS::RMatrixBase::SetFromAxisAngle().

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.

int RotationAveraging::QuaternionL2Mean ( const std::vector< BIAS::RMatrix > &  R,
BIAS::RMatrix meanR 
)

Compute quaternion L2-mean of rotations.

Parameters
[in]RInput rotation matrices to compute the average for
[out]meanROutput average rotation matrix
Returns
Returns 0 on success, < 0 otherwise.

Definition at line 106 of file RotationAveraging.cpp.

References BIAS::RMatrixBase::SetFromQuaternion().

int RotationAveraging::QuaternionL2Mean ( const std::vector< BIAS::Quaternion< double > > &  Q,
BIAS::Quaternion< double > &  meanQ 
)

Compute quaternion L2-mean of rotations.

Parameters
[in]QInput unit quaternions to compute the average for
[out]meanQOutput average rotation as unit quaternion
Returns
Returns 0 on success, < 0 otherwise.

Definition at line 123 of file RotationAveraging.cpp.

References BIAS::Vector4< T >::MultiplyIP(), BIAS::Quaternion< T >::Normalize(), and BIAS::Vector4< T >::SetZero().

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.

void BIAS::RotationAveraging::SetMaxIterations ( unsigned int  num)
inline

Set maximal number of iterations for geodesic L1-/L2-mean computation.

Parameters
[in]numMaximal number of iterations

Definition at line 71 of file RotationAveraging.hh.

void BIAS::RotationAveraging::SetTolerance ( double  epsilon)
inline

Set threshold for convergence of iterative geodesic L1-/L2-mean computation.

The algorithm stops if the angular update is less.

Parameters
[in]epsilonThreshold for convergence in radians

Definition at line 66 of file RotationAveraging.hh.

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

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

Definition at line 513 of file Debug.hh.


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