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 | Friends | List of all members
BIAS::SimilarityTransform Class Reference

Implements a 3D similarity transformation (rotation, translation, and isometric scaling). More...

#include <Geometry/SimilarityTransform.hh>

+ Inheritance diagram for BIAS::SimilarityTransform:
+ Collaboration diagram for BIAS::SimilarityTransform:

Public Member Functions

void AddDebugLevel (const long int lv)
 
void AddDebugLevel (const std::string &name)
 
bool DebugLevelIsSet (const long int lv) const
 
bool DebugLevelIsSet (const std::string &name) const
 
void Dump ()
 Print transformation together with more intuitive rotation representations for debugging purposed. More...
 
const Vector3< double > & GetC () const
 Return vector representing translation. More...
 
int GetDebugLevel () const
 
std::ostream & GetDebugStream () const
 
void GetDebugStream (std::ostream &os) const
 
const Quaternion< double > & GetQ () const
 Return unit quaternion representing rotation. More...
 
BIAS::RMatrixBase GetR () const
 Compute rotation matrix from the unit quaternion representing the rotational part of this. More...
 
double GetScale ()
 Return isometric scaling of this transformation. More...
 
Matrix4x4< double > GetTransformMatrix () const
 Returns 4x4 transformation matrix corresponding to this. More...
 
void InvertIP ()
 Invert the similarity transform (in place) More...
 
bool Load (const std::string &inputFile)
 Load similarity transform from text file inputFile. More...
 
void Mult (const SimilarityTransform &arg, SimilarityTransform &result)
 Concatenate this similarity transform and the given one so that result = this * arg holds for the corresponding 4x4 matrices. More...
 
void Mult (const HomgPoint3D &vec, HomgPoint3D &result) const
 Transform the given homogeneous 3D point with this similarity transform so that result = this * vec holds for the corresponding 4x4 matrix. More...
 
void MultVec (const Vector3< double > &vec, Vector3< double > &result) const
 Transform the given vector with this similarity transform so that result = this * vec holds for the corresponding 4x4 matrix. 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...
 
const SimilarityTransformoperator= (const SimilarityTransform &c)
 Copy all elements of another SimilarityTransform instance. More...
 
void PrintDebugLevel (std::ostream &os=std::cout) const
 
void RemoveDebugLevel (const long int lv)
 
void RemoveDebugLevel (const std::string &name)
 
bool Save (const std::string &outputFile)
 Save similarity transform to text file outputFile. More...
 
void Set (const Quaternion< double > &Q, const Vector3< double > &C, const double &scale=1.0)
 Set rotation, translation, and optional scaling. More...
 
void SetC (const Vector3< double > &C)
 Set translational part from vector C. More...
 
void SetDebugLevel (const long int lv)
 
void SetDebugLevel (const std::string &name)
 
void SetDebugStream (const std::ostream &os)
 
void SetQ (const Quaternion< double > &Q)
 Set rotational part from unit quaternion Q. More...
 
void SetR (const BIAS::RMatrixBase &R)
 Set rotational part from rotation matrix R. More...
 
void ShowDebugLevel (std::ostream &os=std::cout) const
 prints all internally known debuglevels More...
 
 SimilarityTransform ()
 Creates the identity transformation with zero covariance. More...
 
 SimilarityTransform (const SimilarityTransform &c)
 Copy constructor, calls operator=. 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...
 

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
 
Vector3< double > C_
 the translation More...
 
Quaternion< double > Q_
 this is the rotation More...
 
double scale_
 

Static Protected Attributes

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

Friends

std::ostream & operator<< (std::ostream &os, const SimilarityTransform &p)
 
std::istream & operator>> (std::istream &is, SimilarityTransform &p)
 

Detailed Description

Implements a 3D similarity transformation (rotation, translation, and isometric scaling).

Similarity transformations can be interpreted either as a coordinate transformation or motion and scaling of points. Euclidean transformations are special similiarty transformations with scale = 1.

This transformation is identical to the following matrix:

          [                C_[0] ]
          [   scale_*R     C_[1] ]
   T  =   [                C_[2] ]
          [  0    0    0     1   ]

The internal representation of the rotation is a unit quaternion Q_. This quaternion, a translation vector and a scale are used to parametrize the similarity with 8 parameters (and one constraint Q_.NormL2() == 1). Additional, a covariance matrix for all parameters can be stored.

Can be used to represent poses, rigid motions or coordinate transforms.

Author
grest 05/2006

Definition at line 65 of file SimilarityTransform.hh.

Constructor & Destructor Documentation

BIAS::SimilarityTransform::SimilarityTransform ( )
inline

Creates the identity transformation with zero covariance.

Definition at line 70 of file SimilarityTransform.hh.

BIAS::SimilarityTransform::SimilarityTransform ( const SimilarityTransform c)
inline

Copy constructor, calls operator=.

Definition at line 75 of file SimilarityTransform.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.

void SimilarityTransform::Dump ( )

Print transformation together with more intuitive rotation representations for debugging purposed.

Definition at line 67 of file SimilarityTransform.cpp.

References BIAS::RMatrixBase::GetRotationAxisAngle(), and BIAS::RMatrixBase::SetFromQuaternion().

const Vector3<double>& BIAS::SimilarityTransform::GetC ( ) const
inline

Return vector representing translation.

Definition at line 107 of file SimilarityTransform.hh.

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.

const Quaternion<double>& BIAS::SimilarityTransform::GetQ ( ) const
inline

Return unit quaternion representing rotation.

Definition at line 104 of file SimilarityTransform.hh.

BIAS::RMatrixBase BIAS::SimilarityTransform::GetR ( ) const
inline

Compute rotation matrix from the unit quaternion representing the rotational part of this.

Definition at line 114 of file SimilarityTransform.hh.

References BIAS::RMatrixBase::SetFromQuaternion().

double BIAS::SimilarityTransform::GetScale ( )
inline

Return isometric scaling of this transformation.

Definition at line 121 of file SimilarityTransform.hh.

Matrix4x4< double > SimilarityTransform::GetTransformMatrix ( ) const

Returns 4x4 transformation matrix corresponding to this.

Definition at line 84 of file SimilarityTransform.cpp.

References BIAS::RMatrixBase::SetFromQuaternion().

void BIAS::SimilarityTransform::InvertIP ( )
inline

Invert the similarity transform (in place)

Definition at line 137 of file SimilarityTransform.hh.

Referenced by BIAS::CamPoseCalib::GuessInitialCam_().

bool SimilarityTransform::Load ( const std::string &  inputFile)

Load similarity transform from text file inputFile.

Returns
Return true when loading was successful, false otherwise

Definition at line 37 of file SimilarityTransform.cpp.

void BIAS::SimilarityTransform::Mult ( const SimilarityTransform arg,
SimilarityTransform result 
)
inline

Concatenate this similarity transform and the given one so that result = this * arg holds for the corresponding 4x4 matrices.

Definition at line 145 of file SimilarityTransform.hh.

References C_, Q_, and scale_.

Referenced by BIAS::operator*().

void BIAS::SimilarityTransform::Mult ( const HomgPoint3D vec,
HomgPoint3D result 
) const
inline

Transform the given homogeneous 3D point with this similarity transform so that result = this * vec holds for the corresponding 4x4 matrix.

Computes the 4x4 transformation matrix internally.

Definition at line 165 of file SimilarityTransform.hh.

void BIAS::SimilarityTransform::MultVec ( const Vector3< double > &  vec,
Vector3< double > &  result 
) const
inline

Transform the given vector with this similarity transform so that result = this * vec holds for the corresponding 4x4 matrix.

Definition at line 157 of file SimilarityTransform.hh.

Referenced by BIAS::operator*().

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
const SimilarityTransform& BIAS::SimilarityTransform::operator= ( const SimilarityTransform c)
inline

Copy all elements of another SimilarityTransform instance.

Definition at line 81 of file SimilarityTransform.hh.

References C_, Q_, and scale_.

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.

bool SimilarityTransform::Save ( const std::string &  outputFile)

Save similarity transform to text file outputFile.

Returns
Return true when saving was successful, false otherwise

Definition at line 52 of file SimilarityTransform.cpp.

void BIAS::SimilarityTransform::Set ( const Quaternion< double > &  Q,
const Vector3< double > &  C,
const double &  scale = 1.0 
)
inline

Set rotation, translation, and optional scaling.

Definition at line 99 of file SimilarityTransform.hh.

void BIAS::SimilarityTransform::SetC ( const Vector3< double > &  C)
inline

Set translational part from vector C.

Definition at line 96 of file SimilarityTransform.hh.

Referenced by BIAS::CamPoseCalib::GuessInitialCam_().

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::SimilarityTransform::SetQ ( const Quaternion< double > &  Q)
inline

Set rotational part from unit quaternion Q.

Definition at line 89 of file SimilarityTransform.hh.

void BIAS::SimilarityTransform::SetR ( const BIAS::RMatrixBase R)
inline

Set rotational part from rotation matrix R.

Definition at line 92 of file SimilarityTransform.hh.

References BIAS::RMatrixBase::GetQuaternion().

Referenced by BIAS::CamPoseCalib::GuessInitialCam_().

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.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const SimilarityTransform p 
)
friend

Definition at line 184 of file SimilarityTransform.hh.

std::istream& operator>> ( std::istream &  is,
SimilarityTransform p 
)
friend

Definition at line 190 of file SimilarityTransform.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=().

Vector3<double> BIAS::SimilarityTransform::C_
protected

the translation

Definition at line 179 of file SimilarityTransform.hh.

Referenced by Mult(), BIAS::operator<<(), operator=(), and BIAS::operator>>().

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

Definition at line 513 of file Debug.hh.

Quaternion<double> BIAS::SimilarityTransform::Q_
protected

this is the rotation

Definition at line 176 of file SimilarityTransform.hh.

Referenced by Mult(), BIAS::operator<<(), operator=(), and BIAS::operator>>().

double BIAS::SimilarityTransform::scale_
protected

Definition at line 181 of file SimilarityTransform.hh.

Referenced by Mult(), BIAS::operator<<(), operator=(), and BIAS::operator>>().


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