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

affine transformation of 2D image plane which relates image coordinate system and local affine feature coordinate system More...

#include <Geometry/LocalAffineFrame.hh>

+ Inheritance diagram for BIAS::LocalAffineFrame:
+ Collaboration diagram for BIAS::LocalAffineFrame:

Public Member Functions

void Draw (BIAS::Image< unsigned char > &targetImage, const double &positionCovScale=1.0, const unsigned int linethickness=1) const
 draw a square at the feature's ori position More...
 
double FractionInImage (unsigned int width, unsigned int height, unsigned int x0=0, unsigned int y0=0) const
 returns fraction of square area [-1;1][-1;1], which is in the image (slow numeric sampling) More...
 
const BIAS::Matrix2x2< double > & GetA () const
 return affine matrix More...
 
BIAS::Matrix< double > GetAsInverseMatrix () const
 returns matrix which transforms a point in image coordinates into a point in feature coordinates (GlobalToLocal) More...
 
BIAS::Matrix< double > GetAsMatrix () const
 returns matrix which transforms a point in feature coordinates into a point in image coordinates (LocalToGlobal) More...
 
BIAS::Vector< double > GetAsVector () const
 return a 6-vector (a11,a12,a21,a22,tx,ty) More...
 
const BIAS::Matrix< double > & GetCov () const
 return 6x6 covariance More...
 
LocalAffineFrame GetHomographyTransformed (const BIAS::HMatrix &H) const
 use linear propagation to transform the local affine frame e.g. More...
 
BIAS::LocalAffineFrame GetLocalSimilarityFrame () const
 find closest scaled rotation matrix to linear A (under Frobenius norm) and return More...
 
LocalAffineFrame GetRelativeTransform (const LocalAffineFrame &F2, bool setDefaultCov=false) const
 get global transform to transfer an image point of 1 into the image system of 2, e.g. More...
 
const BIAS::Vector2< double > & GetT () const
 return offset More...
 
BIAS::HomgPoint2D GlobalToLocal (const BIAS::HomgPoint2D &x) const
 tranform a point in the image coordinate system into the feature coordinate system More...
 
 LocalAffineFrame ()
 
 LocalAffineFrame (const LocalAffineFrame &FP)
 
BIAS::HomgPoint2D LocalToGlobal (const BIAS::HomgPoint2D &x) const
 tranform a point in the feature coordinate system into the iamge coordinate system More...
 
const LocalAffineFrameoperator= (const LocalAffineFrame &FP)
 
void SetA (const BIAS::Matrix2x2< double > &A, const BIAS::Matrix< double > &cov=BIAS::Matrix< double >(4, 4, BIAS::MatrixZero))
 return affine matrix More...
 
void SetDefaultCov ()
 sets default nonzero cov More...
 
void SetFromMatrix (const BIAS::Matrix< double > &affineTransform)
 construct from homography-style affine matrix (last row 0,0,1) More...
 
void SetFromVector (const BIAS::Vector< double > &affineparams)
 set from a 6-vector (a11,a12,a21,a22,tx,ty), default cov More...
 
void SetFromVector (const BIAS::Vector< double > &affineparams, const BIAS::Matrix< double > &cov)
 set from 6-vector (a11,a12,a21,a22,tx,ty) with cov More...
 
void SetT (const BIAS::Vector2< double > &T, const BIAS::Matrix< double > &cov=BIAS::Matrix< double >(2, 2, BIAS::MatrixZero))
 return offset More...
 
xmlNodePtr XMLAdd (const xmlNodePtr Node, XMLIO &XMLObject) const
 call this to add the class to a node of a given xml tree More...
 
virtual int XMLGetClassName (std::string &TopLevelTag, double &Version) const
 specialization of XML block name function More...
 
virtual int XMLIn (const xmlNodePtr Node, BIAS::XMLIO &XMLObject)
 specialization of XML read function More...
 
virtual int XMLOut (const xmlNodePtr Node, BIAS::XMLIO &XMLObject) const
 specialization of XML write function More...
 
int XMLRead (const std::string &Filename)
 derived classes must implement the function XMLIn which is called by this function XMLRead to read everything with name Filename into (*this). More...
 
int XMLReadFromString (const std::string &str)
 reconstruct xml tree from string More...
 
int XMLWrite (const std::string &Filename, int CompressionLevel=0, bool AutoAddCompressionSuffix=true, std::string encoding="UTF-8") const
 call this to add the class to a new xml tree and write it to the file Filename. More...
 
int XMLWriteToString (std::string &str, std::string encoding="UTF-8") const
 serialize xml tree to string More...
 

Protected Attributes

BIAS::Matrix2x2< double > A_
 "orientation + area(detA) of feature" affine matrix which transforms all pixels of the unit feature (or imagine the local feature coordinate system) of one-pixel square into the shape of the current feature(into the image coordinate system) e.g. More...
 
BIAS::Matrix< double > Cov_
 6x6 covariance matrix of the 6 region parameters(a11,a12,a21,a22,tx,ty) More...
 
BIAS::Vector2< double > t_
 original image position More...
 

Friends

BIASGeometry_EXPORT std::ostream & operator<< (std::ostream &os, const LocalAffineFrame &fp)
 
BIASGeometry_EXPORT std::istream & operator>> (std::istream &is, LocalAffineFrame &fp)
 

Related Functions

(Note that these are not member functions.)

BIASGeometry_EXPORT std::ostream & operator<< (std::ostream &os, const LocalAffineFrame &fp)
 
BIASGeometry_EXPORT std::istream & operator>> (std::istream &is, LocalAffineFrame &fp)
 

Detailed Description

affine transformation of 2D image plane which relates image coordinate system and local affine feature coordinate system

Author
koeser 11/2007
Examples:
EvaluateAlignment.cpp, and ExampleAlignment.cpp.

Definition at line 33 of file LocalAffineFrame.hh.

Constructor & Destructor Documentation

BIAS::LocalAffineFrame::LocalAffineFrame ( )
inline

Definition at line 40 of file LocalAffineFrame.hh.

BIAS::LocalAffineFrame::LocalAffineFrame ( const LocalAffineFrame FP)
inline

Definition at line 45 of file LocalAffineFrame.hh.

Member Function Documentation

void LocalAffineFrame::Draw ( BIAS::Image< unsigned char > &  targetImage,
const double &  positionCovScale = 1.0,
const unsigned int  linethickness = 1 
) const
double BIAS::LocalAffineFrame::FractionInImage ( unsigned int  width,
unsigned int  height,
unsigned int  x0 = 0,
unsigned int  y0 = 0 
) const
inline

returns fraction of square area [-1;1][-1;1], which is in the image (slow numeric sampling)

Definition at line 231 of file LocalAffineFrame.hh.

References BIAS::HomgPoint2D::Homogenize().

const BIAS::Matrix2x2<double>& BIAS::LocalAffineFrame::GetA ( ) const
inline

return affine matrix

Definition at line 165 of file LocalAffineFrame.hh.

Referenced by BIAS::ImageAlignment::SetAlignmentPixelsRectangular().

BIAS::Matrix<double> BIAS::LocalAffineFrame::GetAsInverseMatrix ( ) const
inline

returns matrix which transforms a point in image coordinates into a point in feature coordinates (GlobalToLocal)

Definition at line 128 of file LocalAffineFrame.hh.

References BIAS::Matrix2x2< T >::Invert(), and BIAS::MatrixZero.

Referenced by GetRelativeTransform().

BIAS::Matrix<double> BIAS::LocalAffineFrame::GetAsMatrix ( ) const
inline

returns matrix which transforms a point in feature coordinates into a point in image coordinates (LocalToGlobal)

Definition at line 114 of file LocalAffineFrame.hh.

References BIAS::MatrixZero.

BIAS::Vector<double> BIAS::LocalAffineFrame::GetAsVector ( ) const
inline

return a 6-vector (a11,a12,a21,a22,tx,ty)

Definition at line 75 of file LocalAffineFrame.hh.

const BIAS::Matrix<double>& BIAS::LocalAffineFrame::GetCov ( ) const
inline

return 6x6 covariance

Definition at line 108 of file LocalAffineFrame.hh.

LocalAffineFrame LocalAffineFrame::GetHomographyTransformed ( const BIAS::HMatrix H) const

use linear propagation to transform the local affine frame e.g.

into another image

Definition of homography direction: (*this) has "position" t_. The result will have position H*t_

Definition at line 220 of file LocalAffineFrame.cpp.

References BIAS::HMatrix::GetJacobian(), BIAS::HomgPoint2D::Homogenize(), BIAS::MatrixZero, SetFromVector(), and BIAS::Matrix< T >::Transpose().

BIAS::LocalAffineFrame LocalAffineFrame::GetLocalSimilarityFrame ( ) const

find closest scaled rotation matrix to linear A (under Frobenius norm) and return

Definition at line 252 of file LocalAffineFrame.cpp.

References BIAS::Matrix< T >::GetSystemMatrix(), BIAS::Matrix2x2< T >::Invert(), BIAS::MatrixZero, SetA(), SetT(), and BIAS::Matrix< T >::Transpose().

LocalAffineFrame LocalAffineFrame::GetRelativeTransform ( const LocalAffineFrame F2,
bool  setDefaultCov = false 
) const

get global transform to transfer an image point of 1 into the image system of 2, e.g.

given two affine features, get affine transform between images for KLT tracker setDefaultCov set digonal small cov or use error propagation from uncertainties of base transformations

Definition at line 116 of file LocalAffineFrame.cpp.

References A_, Cov_, GetAsInverseMatrix(), BIAS::MatrixZero, SetDefaultCov(), SetFromMatrix(), t_, and BIAS::Matrix< T >::Transpose().

const BIAS::Vector2<double>& BIAS::LocalAffineFrame::GetT ( ) const
inline

return offset

Definition at line 168 of file LocalAffineFrame.hh.

BIAS::HomgPoint2D BIAS::LocalAffineFrame::GlobalToLocal ( const BIAS::HomgPoint2D x) const
inline

tranform a point in the image coordinate system into the feature coordinate system

Definition at line 58 of file LocalAffineFrame.hh.

References BIAS::HomgPoint2D.

BIAS::HomgPoint2D BIAS::LocalAffineFrame::LocalToGlobal ( const BIAS::HomgPoint2D x) const
inline

tranform a point in the feature coordinate system into the iamge coordinate system

Definition at line 65 of file LocalAffineFrame.hh.

References BIAS::HomgPoint2D.

Referenced by BIAS::ImageAlignment::SetAlignmentPixelsRectangular().

const LocalAffineFrame& BIAS::LocalAffineFrame::operator= ( const LocalAffineFrame FP)
inline

Definition at line 49 of file LocalAffineFrame.hh.

References A_, Cov_, and t_.

void BIAS::LocalAffineFrame::SetA ( const BIAS::Matrix2x2< double > &  A,
const BIAS::Matrix< double > &  cov = BIAS::Matrix<double>(4,4,BIAS::MatrixZero) 
)
inline

return affine matrix

Examples:
EvaluateAlignment.cpp, and ExampleAlignment.cpp.

Definition at line 171 of file LocalAffineFrame.hh.

Referenced by GetLocalSimilarityFrame().

void BIAS::LocalAffineFrame::SetDefaultCov ( )
inline

sets default nonzero cov

Definition at line 159 of file LocalAffineFrame.hh.

Referenced by GetRelativeTransform().

void BIAS::LocalAffineFrame::SetFromMatrix ( const BIAS::Matrix< double > &  affineTransform)
inline

construct from homography-style affine matrix (last row 0,0,1)

Definition at line 143 of file LocalAffineFrame.hh.

References BIAS::Equal(), TNT::Matrix< T >::num_cols(), and TNT::Matrix< T >::num_rows().

Referenced by GetRelativeTransform().

void BIAS::LocalAffineFrame::SetFromVector ( const BIAS::Vector< double > &  affineparams)
inline

set from a 6-vector (a11,a12,a21,a22,tx,ty), default cov

Definition at line 88 of file LocalAffineFrame.hh.

References BIAS::MatrixZero.

Referenced by GetHomographyTransformed().

void BIAS::LocalAffineFrame::SetFromVector ( const BIAS::Vector< double > &  affineparams,
const BIAS::Matrix< double > &  cov 
)
inline

set from 6-vector (a11,a12,a21,a22,tx,ty) with cov

Definition at line 95 of file LocalAffineFrame.hh.

References BIAS::Matrix< T >::GetData().

void BIAS::LocalAffineFrame::SetT ( const BIAS::Vector2< double > &  T,
const BIAS::Matrix< double > &  cov = BIAS::Matrix<double>(2,2,BIAS::MatrixZero) 
)
inline

return offset

Examples:
EvaluateAlignment.cpp, and ExampleAlignment.cpp.

Definition at line 189 of file LocalAffineFrame.hh.

Referenced by GetLocalSimilarityFrame().

xmlNodePtr XMLBase::XMLAdd ( const xmlNodePtr  Node,
XMLIO XMLObject 
) const
inherited

call this to add the class to a node of a given xml tree

Attention
interface changed 3/2008: return value now nodeptr of added node!

Definition at line 26 of file XMLBase.cpp.

References BIAS::XMLIO::addAttribute(), and BIAS::XMLIO::addChildNode().

int LocalAffineFrame::XMLGetClassName ( std::string &  TopLevelTag,
double &  Version 
) const
virtual

specialization of XML block name function

Implements BIAS::XMLBase.

Definition at line 24 of file LocalAffineFrame.cpp.

int LocalAffineFrame::XMLIn ( const xmlNodePtr  Node,
BIAS::XMLIO XMLObject 
)
virtual

specialization of XML read function

Implements BIAS::XMLBase.

Definition at line 39 of file LocalAffineFrame.cpp.

int LocalAffineFrame::XMLOut ( const xmlNodePtr  Node,
BIAS::XMLIO XMLObject 
) const
virtual

specialization of XML write function

Implements BIAS::XMLBase.

Definition at line 31 of file LocalAffineFrame.cpp.

int XMLBase::XMLRead ( const std::string &  Filename)
inherited
int XMLBase::XMLReadFromString ( const std::string &  str)
inherited

reconstruct xml tree from string

Author
evers
Examples:
ExampleProjection.cpp.

Definition at line 111 of file XMLBase.cpp.

References BIAS::XMLIO::clear(), BIAS::XMLIO::getAttributeValueDouble(), BIAS::XMLIO::getNodeName(), and BIAS::XMLIO::ReadFromString().

Referenced by BIAS::IOUtils::GetProjection().

int XMLBase::XMLWrite ( const std::string &  Filename,
int  CompressionLevel = 0,
bool  AutoAddCompressionSuffix = true,
std::string  encoding = "UTF-8" 
) const
inherited
int XMLBase::XMLWriteToString ( std::string &  str,
std::string  encoding = "UTF-8" 
) const
inherited

serialize xml tree to string

Author
evers
Examples:
ExampleProjection.cpp.

Definition at line 61 of file XMLBase.cpp.

References BIAS::XMLIO::addAttribute(), BIAS::XMLIO::clear(), BIAS::XMLIO::create(), BIAS::XMLIO::SetEncoding(), and BIAS::XMLIO::WriteToString().

Friends And Related Function Documentation

BIASGeometry_EXPORT std::ostream& operator<< ( std::ostream &  os,
const LocalAffineFrame fp 
)
friend
BIASGeometry_EXPORT std::ostream & operator<< ( std::ostream &  os,
const LocalAffineFrame fp 
)
related
BIASGeometry_EXPORT std::istream& operator>> ( std::istream &  is,
LocalAffineFrame fp 
)
friend
BIASGeometry_EXPORT std::istream & operator>> ( std::istream &  is,
LocalAffineFrame fp 
)
related

Member Data Documentation

BIAS::Matrix2x2<double> BIAS::LocalAffineFrame::A_
protected

"orientation + area(detA) of feature" affine matrix which transforms all pixels of the unit feature (or imagine the local feature coordinate system) of one-pixel square into the shape of the current feature(into the image coordinate system) e.g.

y = (1;0) is the 3 o'clock ray to the feature border x_i = A_ * x_f + t_;

Definition at line 269 of file LocalAffineFrame.hh.

Referenced by GetRelativeTransform(), and operator=().

BIAS::Matrix<double> BIAS::LocalAffineFrame::Cov_
protected

6x6 covariance matrix of the 6 region parameters(a11,a12,a21,a22,tx,ty)

Definition at line 272 of file LocalAffineFrame.hh.

Referenced by GetRelativeTransform(), and operator=().

BIAS::Vector2<double> BIAS::LocalAffineFrame::t_
protected

original image position

Definition at line 261 of file LocalAffineFrame.hh.

Referenced by GetRelativeTransform(), and operator=().


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