eLynx SDK v3.3.0
C++ image processing API reference
Public Member Functions

eLynx::Math::LinearTransformation Class Reference

Class implementing 2D linear transformation. More...

#include <LinearTransformation.h>

Inheritance diagram for eLynx::Math::LinearTransformation:
eLynx::Math::AbstractTransformation

List of all members.

Public Member Functions

 LinearTransformation ()
 Constructor, creates identity transformation.
 LinearTransformation (const LinearTransformation &c)
 Copy constructor.
LinearTransformationoperator= (const LinearTransformation &c)
 An assignement operator.
virtual boost::shared_ptr
< AbstractTransformation
Clone () const
 Creates and returns copy of this object.
double GetValue (uint32 iRow, uint32 iCol) const
 Returns specified value of the transformation matrix.
void SetValue (uint32 iRow, uint32 iCol, double iValue)
 Sets specified value of the transformation matrix.
LinearTransformationNullTransformation ()
 Sets transformation to null transformation and returns this object.
LinearTransformationIdentity ()
 Sets transformation to identity and returns this object.
virtual bool IsIdentity () const
 Returns true, if actual transformation is identity.
LinearTransformationTranslation (double iDX, double iDY)
 Sets transformation to translation and returns this object.
LinearTransformationRotation (double iAngle)
 Sets transformation to rotation and returns this object.
LinearTransformationScale (double iSX, double iSY)
 Sets transformation to scaling and returns this object.
LinearTransformationGeneralTransformation (double iA, double iB, double iC, double iD, double iE, double iF)
 Sets transformation to general linear transformation: x' = A*x+B*y+C y' = D*x+E*y+F and returns this object.
LinearTransformationMultiply (const LinearTransformation &iTrf)
 Multiplies current matrix with given matrix, storing the result in current object and returning it (behaves like *= operator).
LinearTransformationInverse (const LinearTransformation &iTrf)
 Sets transformation to inverse of specified transformation.
virtual void Transform (double iX, double iY, double &oX, double &oY) const
 Abstract method, which transforms position of the pixel in the coordinate space of the first image, into position in the coordinate space of the second image.
virtual void GetTransformedBBox (uint32 iWidth, uint32 iHeight, double &oLeft, double &oTop, double &oWidth, double &oHeight) const
 Abstract method, which computes bounding box of the transformed (second) image in the coordinate space of the first image.
virtual void InverseTransform (double iX, double iY, double &oX, double &oY) const
 Abstract method, which transforms position of the pixel in the coordinate space of the second image, into position in the coordinate space of the first image.
virtual void GetInverseBBox (uint32 iWidth, uint32 iHeight, double &oLeft, double &oTop, double &oWidth, double &oHeight) const
 Abstract method, which computes bounding box of the original (first) image in the coordinate space of the second image.

Detailed Description

Class implementing 2D linear transformation.

Transformation is (as usual) represented by 3x3 matrix. Class provides methods to set typical transformations like translation, rotation or scaling. Also, it provides a method to combine transformations by matrix multiplication.


Constructor & Destructor Documentation

eLynx::Math::LinearTransformation::LinearTransformation ( const LinearTransformation c )

Copy constructor.

Parameters:
cthe object to be copied

Member Function Documentation

virtual boost::shared_ptr<AbstractTransformation> eLynx::Math::LinearTransformation::Clone (  ) const [virtual]

Creates and returns copy of this object.

Returns:
the copy of this object

Implements eLynx::Math::AbstractTransformation.

LinearTransformation& eLynx::Math::LinearTransformation::GeneralTransformation ( double  iA,
double  iB,
double  iC,
double  iD,
double  iE,
double  iF 
)

Sets transformation to general linear transformation: x' = A*x+B*y+C y' = D*x+E*y+F and returns this object.

Parameters:
iAthe (0,0) matrix coefficient
iBthe (1,0) matrix coefficient
iCthe (2,0) matrix coefficient
iDthe (0,1) matrix coefficient
iEthe (1,1) matrix coefficient
iFthe (2,1) matrix coefficient
Returns:
reference to this object
virtual void eLynx::Math::LinearTransformation::GetInverseBBox ( uint32  iWidth,
uint32  iHeight,
double &  oLeft,
double &  oTop,
double &  oWidth,
double &  oHeight 
) const [virtual]

Abstract method, which computes bounding box of the original (first) image in the coordinate space of the second image.

Second image has a bounding box (0, 0)-(iWidth, iHeight). First image has a bounding box (oLeft, oTop)-(oLeft+oWidth, oTop+oHeight).

Parameters:
iWidththe width of the second image
iHeightthe height of the second image
oLeftthe left coordinate of the first image bounding box
oTopthe top coordinate of the first image bounding box
oWidththe width of the first image bounding box
oHeightthe height of the first image bounding box

Implements eLynx::Math::AbstractTransformation.

virtual void eLynx::Math::LinearTransformation::GetTransformedBBox ( uint32  iWidth,
uint32  iHeight,
double &  oLeft,
double &  oTop,
double &  oWidth,
double &  oHeight 
) const [virtual]

Abstract method, which computes bounding box of the transformed (second) image in the coordinate space of the first image.

First image has a bounding box (0, 0)-(iWidth, iHeight). Second image has a bounding box (oLeft, oTop)-(oLeft+oWidth, oTop+oHeight).

Parameters:
iWidththe width of the first image
iHeightthe height of the first image
oLeftthe left coordinate of the second image bounding box
oTopthe top coordinate of the second image bounding box
oWidththe width of the second image bounding box
oHeightthe height of the second image bounding box

Implements eLynx::Math::AbstractTransformation.

double eLynx::Math::LinearTransformation::GetValue ( uint32  iRow,
uint32  iCol 
) const

Returns specified value of the transformation matrix.

Parameters:
iRowthe number of row (0..2)
iColthe number of column (0..2)
Returns:
the matrix value
LinearTransformation& eLynx::Math::LinearTransformation::Identity (  )

Sets transformation to identity and returns this object.

Identity transforms all vectors to themselves.

Returns:
reference to this object.
LinearTransformation& eLynx::Math::LinearTransformation::Inverse ( const LinearTransformation iTrf )

Sets transformation to inverse of specified transformation.

The transformation must be invertible - this means determinant of transformation matrix must be non-zero. If it is not, the exception is raised.

Parameters:
iTrfthe matrix to be inverted
Returns:
reference to this object (inverted matrix)
virtual void eLynx::Math::LinearTransformation::InverseTransform ( double  iX,
double  iY,
double &  oX,
double &  oY 
) const [virtual]

Abstract method, which transforms position of the pixel in the coordinate space of the second image, into position in the coordinate space of the first image.

Parameters:
iXthe x coordinate of the pixel on the second image
iYthe y coordinate of the pixel on the second image
oXthe x position on the first image
oYthe y position on the first image

Implements eLynx::Math::AbstractTransformation.

virtual bool eLynx::Math::LinearTransformation::IsIdentity (  ) const [virtual]

Returns true, if actual transformation is identity.

Can be used to speed up the process (by not transforming at all).

Returns:
true for identity transformation, false otherwise.

Implements eLynx::Math::AbstractTransformation.

LinearTransformation& eLynx::Math::LinearTransformation::Multiply ( const LinearTransformation iTrf )

Multiplies current matrix with given matrix, storing the result in current object and returning it (behaves like *= operator).

The matrix multiplication is equivalent to adding transformations.

Parameters:
iTrfthe matrix current matrix should be multiplied with
Returns:
reference to this object (result of multiplication this*iTrf)
LinearTransformation& eLynx::Math::LinearTransformation::NullTransformation (  )

Sets transformation to null transformation and returns this object.

Null transformation transforms all vectors to null vector.

Returns:
reference to this object
LinearTransformation& eLynx::Math::LinearTransformation::operator= ( const LinearTransformation c )

An assignement operator.

Parameters:
cthe object to be copied
Returns:
the reference to this object
LinearTransformation& eLynx::Math::LinearTransformation::Rotation ( double  iAngle )

Sets transformation to rotation and returns this object.

The rotation is performed around origin [0,0], counter-clockwise for positive angle.

Parameters:
iAnglethe angle in radians.
Returns:
reference to this object
LinearTransformation& eLynx::Math::LinearTransformation::Scale ( double  iSX,
double  iSY 
)

Sets transformation to scaling and returns this object.

The scaling is performed with respect to origin [0, 0].

Parameters:
iSXthe scale factor in x direction
iSYthe scale factor in y direction
Returns:
reference to this object
void eLynx::Math::LinearTransformation::SetValue ( uint32  iRow,
uint32  iCol,
double  iValue 
)

Sets specified value of the transformation matrix.

Parameters:
iRowthe number of row (0..2)
iColthe number of column (0..2)
iValuethe value to be set
virtual void eLynx::Math::LinearTransformation::Transform ( double  iX,
double  iY,
double &  oX,
double &  oY 
) const [virtual]

Abstract method, which transforms position of the pixel in the coordinate space of the first image, into position in the coordinate space of the second image.

Parameters:
iXthe x coordinate of the pixel on the first image
iYthe y coordinate of the pixel on the first image
oXthe x position on the second image
oYthe y position on the second image

Implements eLynx::Math::AbstractTransformation.

LinearTransformation& eLynx::Math::LinearTransformation::Translation ( double  iDX,
double  iDY 
)

Sets transformation to translation and returns this object.

Parameters:
iDXthe delta value in x direction
iDYthe delta value in y direction
Returns:
reference to this object

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

Generated on Thu Dec 9 2010 by doxygen 1.7.2