eLynx SDK
v3.3.0 C++ image processing API reference |
Class implementing 2D linear transformation. More...
#include <LinearTransformation.h>
Public Member Functions | |
LinearTransformation () | |
Constructor, creates identity transformation. | |
LinearTransformation (const LinearTransformation &c) | |
Copy constructor. | |
LinearTransformation & | operator= (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. | |
LinearTransformation & | NullTransformation () |
Sets transformation to null transformation and returns this object. | |
LinearTransformation & | Identity () |
Sets transformation to identity and returns this object. | |
virtual bool | IsIdentity () const |
Returns true, if actual transformation is identity. | |
LinearTransformation & | Translation (double iDX, double iDY) |
Sets transformation to translation and returns this object. | |
LinearTransformation & | Rotation (double iAngle) |
Sets transformation to rotation and returns this object. | |
LinearTransformation & | Scale (double iSX, double iSY) |
Sets transformation to scaling and returns this object. | |
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. | |
LinearTransformation & | Multiply (const LinearTransformation &iTrf) |
Multiplies current matrix with given matrix, storing the result in current object and returning it (behaves like *= operator). | |
LinearTransformation & | Inverse (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. |
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.
eLynx::Math::LinearTransformation::LinearTransformation | ( | const LinearTransformation & | c ) |
Copy constructor.
c | the object to be copied |
virtual boost::shared_ptr<AbstractTransformation> eLynx::Math::LinearTransformation::Clone | ( | ) | const [virtual] |
Creates and returns 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.
iA | the (0,0) matrix coefficient |
iB | the (1,0) matrix coefficient |
iC | the (2,0) matrix coefficient |
iD | the (0,1) matrix coefficient |
iE | the (1,1) matrix coefficient |
iF | the (2,1) matrix coefficient |
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).
iWidth | the width of the second image |
iHeight | the height of the second image |
oLeft | the left coordinate of the first image bounding box |
oTop | the top coordinate of the first image bounding box |
oWidth | the width of the first image bounding box |
oHeight | the 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).
iWidth | the width of the first image |
iHeight | the height of the first image |
oLeft | the left coordinate of the second image bounding box |
oTop | the top coordinate of the second image bounding box |
oWidth | the width of the second image bounding box |
oHeight | the 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.
iRow | the number of row (0..2) |
iCol | the number of column (0..2) |
LinearTransformation& eLynx::Math::LinearTransformation::Identity | ( | ) |
Sets transformation to identity and returns this object.
Identity transforms all vectors to themselves.
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.
iTrf | the matrix to be inverted |
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.
iX | the x coordinate of the pixel on the second image |
iY | the y coordinate of the pixel on the second image |
oX | the x position on the first image |
oY | the 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).
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.
iTrf | the matrix current matrix should be multiplied with |
LinearTransformation& eLynx::Math::LinearTransformation::NullTransformation | ( | ) |
Sets transformation to null transformation and returns this object.
Null transformation transforms all vectors to null vector.
LinearTransformation& eLynx::Math::LinearTransformation::operator= | ( | const LinearTransformation & | c ) |
An assignement operator.
c | the object to be copied |
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.
iAngle | the angle in radians. |
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].
iSX | the scale factor in x direction |
iSY | the scale factor in y direction |
void eLynx::Math::LinearTransformation::SetValue | ( | uint32 | iRow, |
uint32 | iCol, | ||
double | iValue | ||
) |
Sets specified value of the transformation matrix.
iRow | the number of row (0..2) |
iCol | the number of column (0..2) |
iValue | the 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.
iX | the x coordinate of the pixel on the first image |
iY | the y coordinate of the pixel on the first image |
oX | the x position on the second image |
oY | the 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.
iDX | the delta value in x direction |
iDY | the delta value in y direction |