last update 20 Sep 2009 |
#include <cvrAffineTransformation2D.h>
Classes | |
class | parameters |
The parameters for the class affineTransformation2D. More... | |
Public Member Functions | |
affineTransformation2D () | |
affineTransformation2D (const parameters &par) | |
affineTransformation2D (const affineTransformation2D &other) | |
virtual | ~affineTransformation2D () |
template<class P > | |
bool | apply (P &srcdest) const |
template<class P > | |
bool | apply (const P &src, P &dest) const |
template<class P > | |
bool | estimate (const std::vector< P > &setA, const std::vector< P > &setB) |
template<class P > | |
bool | estimateLLS (const std::vector< P > &setA, const std::vector< P > &setB) |
template<class P > | |
bool | estimateLLS (const ivector &selection, const std::vector< P > &setA, const std::vector< P > &setB) |
int | dof () const |
void | generateMatrix (fmatrix &mat) const |
void | decompose (float &theta, float &phi, float &lambda1, float &lambda2, float &tx, float &ty) const |
fmatrix | generateMatrix () const |
affineTransformation2D & | copy (const affineTransformation2D &other) |
affineTransformation2D & | operator= (const affineTransformation2D &other) |
virtual const std::string & | name () const |
virtual affineTransformation2D * | clone () const |
virtual affineTransformation2D * | newInstance () const |
const parameters & | getParameters () const |
bool | updateParameters () |
Protected Member Functions | |
parameters & | getRWParameters () |
Protected Attributes | |
fpoint | trans_ |
float | a00_ |
float | a01_ |
float | a10_ |
float | a11_ |
linearLeastSquares | lls_ |
The affine transformation for 2D spaces performs a planar modification of points in which only rotation, translation, (anisotropic) scaling and sheer are applied.
With homogeneous coordinates, the affine transformation can be stated as
This class transforms points only, and therefore is not intended for images, in which case you should use cvr::matrixTransform. You can however obtain from this class the matrix used by cvr::matrixTransform::parameters to generate the same results.
Most apply methods are templates of a point type P, i.e. the type P is usually a container that can be accessed with the operator[], like the types cvr::point<T>, cvr::vector<T>.
euclideanTransformation3D
projectiveTransformation2D
cvr::affineTransformation2D::affineTransformation2D | ( | ) |
Default constructor.
cvr::affineTransformation2D::affineTransformation2D | ( | const parameters & | par | ) |
Construct a functor using the given parameters.
cvr::affineTransformation2D::affineTransformation2D | ( | const affineTransformation2D & | other | ) |
virtual cvr::affineTransformation2D::~affineTransformation2D | ( | ) | [virtual] |
Destructor.
bool cvr::affineTransformation2D::apply | ( | const P & | src, | |
P & | dest | |||
) | const [inline] |
bool cvr::affineTransformation2D::apply | ( | P & | srcdest | ) | const [inline] |
Transform the given point.
srcdest | point<T> with the source data. The result will be left here too. |
virtual affineTransformation2D* cvr::affineTransformation2D::clone | ( | ) | const [virtual] |
affineTransformation2D& cvr::affineTransformation2D::copy | ( | const affineTransformation2D & | other | ) |
void cvr::affineTransformation2D::decompose | ( | float & | theta, | |
float & | phi, | |||
float & | lambda1, | |||
float & | lambda2, | |||
float & | tx, | |||
float & | ty | |||
) | const |
int cvr::affineTransformation2D::dof | ( | ) | const |
Degrees of freedom of the transformation.
Usually this means the minimal number of parameters with which the transforamtion matrix can be generated.
bool cvr::affineTransformation2D::estimate | ( | const std::vector< P > & | setA, | |
const std::vector< P > & | setB | |||
) | [inline] |
Estimate a transformation that maps the first set of points into the second set of points.
The resulting estimation is left in the parameters.
This method assumes that the corresponding point to setA[idx] is stored in setB[idx].
Only the first dof()/2
correspondences will be used for the estimation, and you need at least dof()/2
elements for the transformation to be computed.
bool cvr::affineTransformation2D::estimateLLS | ( | const ivector & | selection, | |
const std::vector< P > & | setA, | |||
const std::vector< P > & | setB | |||
) | [inline] |
Do a linear least squares error minimization for a transformation that maps the first set of points into the second set of points.
The resulting estimation is left in the parameters.
This method assumes that the corresponding point to setA[idx] is stored in setB[idx].
For the LLS to be computed, more than dof()/2
correspondences are necessary for the estimation.
For the estimation, just the points with the indices specified in selection
are given.
bool cvr::affineTransformation2D::estimateLLS | ( | const std::vector< P > & | setA, | |
const std::vector< P > & | setB | |||
) | [inline] |
Do a linear least squares error minimization for a transformation that maps the first set of points into the second set of points.
The resulting estimation is left in the parameters.
This method assumes that the corresponding point to setA[idx] is stored in setB[idx].
For the LLS to be computed, more than dof()/2
correspondences are necessary for the estimation.
fmatrix cvr::affineTransformation2D::generateMatrix | ( | ) | const |
Generate the transformation matrix that would be required by cvr::matrixTransform to generate the same coordinate transformation.
The result is, so to speak, the matrix representation of the parameters.
void cvr::affineTransformation2D::generateMatrix | ( | fmatrix & | mat | ) | const |
Generate the transformation matrix that would be required by cvr::matrixTransform to generate the same coordinate transformation.
The result is, so to speak, the matrix representation of the parameters.
This method is provided to keep consistency with other matrix transformation functors, since in this case, the conversion between the parameters and the matrix is completely straightforward.
const parameters& cvr::affineTransformation2D::getParameters | ( | ) | const |
parameters& cvr::affineTransformation2D::getRWParameters | ( | ) | [protected] |
Returns used parameters.
virtual const std::string& cvr::affineTransformation2D::name | ( | ) | const [virtual] |
virtual affineTransformation2D* cvr::affineTransformation2D::newInstance | ( | ) | const [virtual] |
affineTransformation2D& cvr::affineTransformation2D::operator= | ( | const affineTransformation2D & | other | ) |
bool cvr::affineTransformation2D::updateParameters | ( | ) | [virtual] |
float cvr::affineTransformation2D::a00_ [protected] |
Shadow of matrix element.
float cvr::affineTransformation2D::a01_ [protected] |
Shadow of matrix element.
float cvr::affineTransformation2D::a10_ [protected] |
Shadow of matrix element.
float cvr::affineTransformation2D::a11_ [protected] |
Shadow of matrix element.
linearLeastSquares cvr::affineTransformation2D::lls_ [protected] |
Singular value decomposition.
Convenience method to avoid the SVD to be present in the template implementation
fpoint cvr::affineTransformation2D::trans_ [protected] |
Shadow of the translation point.