latest version v1.9 - last update 10 Apr 2010 |
This class computes the parameters of the perspective transformation between two images using a non-homogenous approach and least squares. More...
#include <ltiHomography8DofEstimator.h>
Classes | |
class | parameters |
The parameters for the class homography8DofEstimator. More... | |
Public Member Functions | |
homography8DofEstimator () | |
homography8DofEstimator (const parameters &par) | |
homography8DofEstimator (const homography8DofEstimator &other) | |
virtual | ~homography8DofEstimator () |
virtual const char * | getTypeName () const |
virtual bool | apply (const matrix< ipoint > &src, fvector &dest) const |
virtual bool | apply (const matrix< ipoint > &src, fvector &dest, fvector &error) const |
virtual bool | apply (const matrix< ipoint > &src, fvector &dest, const ivector &indices, int numCorrespondences) const |
virtual bool | apply (const matrix< ipoint > &src, fvector &dest, fvector &error, const ivector &indices, int numCorrespondences) const |
virtual bool | apply (const matrix< fpoint > &src, fvector &dest) const |
virtual bool | apply (const matrix< fpoint > &src, fvector &dest, fvector &error) const |
virtual bool | apply (const matrix< fpoint > &src, fvector &dest, const ivector &indices, int numCorrespondences) const |
virtual bool | apply (const matrix< fpoint > &src, fvector &dest, fvector &error, const ivector &indices, int numCorrespondences) const |
virtual bool | apply (const matrix< dpoint > &src, dvector &dest) const |
virtual bool | apply (const matrix< dpoint > &src, dvector &dest, dvector &error) const |
virtual bool | apply (const matrix< dpoint > &src, dvector &dest, const ivector &indices, int numCorrespondences) const |
virtual bool | apply (const matrix< dpoint > &src, dvector &dest, dvector &error, const ivector &indices, int numCorrespondences) const |
virtual bool | computeResidual (const matrix< fpoint > &src, const fvector &transform, fvector &dest) const |
virtual bool | computeResidual (const matrix< dpoint > &src, const dvector &transform, dvector &dest) const |
virtual int | minNumberCorrespondences () const |
virtual int | minCorrespondenceDimension () const |
virtual int | maxCorrespondenceDimension () const |
bool | denormalize (fvector &srcdest, const vector< fpoint > &scale, const vector< fpoint > &shift) const |
bool | denormalize (dvector &srcdest, const vector< dpoint > &scale, const vector< dpoint > &shift) const |
bool | convert (const fvector &src, hMatrix3D< float > &dest) const |
bool | convert (const dvector &src, hMatrix3D< float > &dest) const |
bool | convert (const fvector &src, fmatrix &dest) const |
bool | convert (const dvector &src, dmatrix &dest) const |
fpoint | transform (const fpoint &pt, const fvector &transf) const |
dpoint | transform (const dpoint &pt, const dvector &transf) const |
homography8DofEstimator & | copy (const homography8DofEstimator &other) |
homography8DofEstimator & | operator= (const homography8DofEstimator &other) |
virtual functor * | clone () const |
const parameters & | getParameters () const |
This class computes the parameters of the perspective transformation between two images using a non-homogenous approach and least squares.
This works fine for translational and rotational camera movement, but in case of zooming it might result in a degenerate configuration. Please use the homography9DofEstimator (work in progress) instead.
The implementation is based on a block oriented cholesky decompostion. Details about the implemented least squares approach can be found in
Claudia Goenner, Approximation der Parameter fuer die zentralperspektivische Abbildung durch Minimierung des mittleren quadratischen Fehlers, Studienarbeit, Mathematisch-Naturwissenschaftliche Fakultaet, RWTH Aachen, 1996.
and
Thomas Lehmann, "Geometrische Ausrichtung medizinischer Bilder am Beispiel intraoraler Radiographien", pp. 71-73. Aachener Informatik Berichte 98-9, RWTH Aachen, 1998.
CAVEAT: This class is a port from old C-code and contains some potential for speed up.
lti::homography8DofEstimator::homography8DofEstimator | ( | ) |
Default constructor.
lti::homography8DofEstimator::homography8DofEstimator | ( | const parameters & | par | ) |
Construct a functor using the given parameters.
lti::homography8DofEstimator::homography8DofEstimator | ( | const homography8DofEstimator & | other | ) |
Copy constructor.
other | the object to be copied |
virtual lti::homography8DofEstimator::~homography8DofEstimator | ( | ) | [virtual] |
Destructor.
virtual bool lti::homography8DofEstimator::apply | ( | const matrix< dpoint > & | src, | |
dvector & | dest, | |||
dvector & | error, | |||
const ivector & | indices, | |||
int | numCorrespondences | |||
) | const [virtual] |
Estimates a transform from the supplied point sets, whereby only the points specified in the index vector are considered.
Usually this method calls the apply without the residual first, and then computes the residual.
All points of one point set give a matrix row, whereas all elements of a specifec correspondence stand in a matrix column.
src | matrix<dpoint> with the point sets. All points of the same image stand in a row. The correspondences in another image stand in the according columns. | |
dest | dvector the estimated transform. | |
error | dvector containing the deviation of each point from the estimated transform. Usually this is the residual or elementwise squared residual. | |
indices | ivector with the indices of the relevant points. | |
numCorrespondences | the first numCorrespondences indices are considered. |
Implements lti::homographyEstimatorBase.
virtual bool lti::homography8DofEstimator::apply | ( | const matrix< dpoint > & | src, | |
dvector & | dest, | |||
const ivector & | indices, | |||
int | numCorrespondences | |||
) | const [virtual] |
Estimates a transform from the supplied point sets, whereby only the points specified in the index vector are considered.
This method is used by robost estimators using a monte carlo approach.
All points of one point set give a matrix row, whereas all elements of a specifec correspondence stand in a matrix column.
src | matrix<dpoint> with the point sets. All points of the same image stand in a row. The correspondences in another image stand in the according columns. | |
dest | dvector the estimated transform. | |
indices | ivector with the indices of the relevant points. | |
numCorrespondences | the first numCorrespondences indices are considered. |
Implements lti::homographyEstimatorBase.
virtual bool lti::homography8DofEstimator::apply | ( | const matrix< dpoint > & | src, | |
dvector & | dest, | |||
dvector & | error | |||
) | const [virtual] |
Estimates a transform from the supplied point sets, where all points are considered.
Usually this method calls the apply without the residual first, and then computes the residual.
All points of one point set give a matrix row, whereas all elements of a specifec correspondence stand in a matrix column.
src | matrix<dpoint> with the point sets. All points of the same image stand in a row. The correspondences in another image stand in the according columns. | |
dest | dvector the estimated transform. | |
error | dvector containing the deviation of each point from the estimated transform. Usually this is the residual or elementwise squared residual. |
Implements lti::homographyEstimatorBase.
virtual bool lti::homography8DofEstimator::apply | ( | const matrix< dpoint > & | src, | |
dvector & | dest | |||
) | const [virtual] |
Estimates a transform from the supplied point sets, where all points are considered.
Please implement efficient code using iterators here. Not all robust estimators use a random sampling approach. Some estimators consider all input points and weight them according to their deviation from the transform computed at the prior iteration.
All points of one point set give a matrix row, whereas all elements of a specifec correspondence stand in a matrix column.
src | matrix<dpoint> with the point sets. All points of the same image stand in a row. The correspondences in another image stand in the according columns. | |
dest | dvector the estimated transform. |
Implements lti::homographyEstimatorBase.
virtual bool lti::homography8DofEstimator::apply | ( | const matrix< fpoint > & | src, | |
fvector & | dest, | |||
fvector & | error, | |||
const ivector & | indices, | |||
int | numCorrespondences | |||
) | const [virtual] |
Estimates a transform from the supplied point sets, whereby only the points specified in the index vector are considered.
Usually this method calls the apply without the residual first, and then computes the residual.
All points of one point set give a matrix row, whereas all elements of a specifec correspondence stand in a matrix column.
src | matrix<fpoint> with the point sets. All points of the same image stand in a row. The correspondences in another image stand in the according columns. | |
dest | fvector the estimated transform. | |
error | fvector containing the deviation of each point from the estimated transform. Usually this is the residual or elementwise squared residual. | |
indices | ivector with the indices of the relevant points. | |
numCorrespondences | the first numCorrespondences indices are considered. |
Implements lti::homographyEstimatorBase.
virtual bool lti::homography8DofEstimator::apply | ( | const matrix< fpoint > & | src, | |
fvector & | dest, | |||
const ivector & | indices, | |||
int | numCorrespondences | |||
) | const [virtual] |
Estimates a transform from the supplied point sets, whereby only the points specified in the index vector are considered.
This method is used by robost estimators using a monte carlo approach.
All points of one point set give a matrix row, whereas all elements of a specifec correspondence stand in a matrix column.
src | matrix<fpoint> with the point sets. All points of the same image stand in a row. The correspondences in another image stand in the according columns. | |
dest | fvector the estimated transform. | |
indices | ivector with the indices of the relevant points. | |
numCorrespondences | the first numCorrespondences indices are considered. |
Implements lti::homographyEstimatorBase.
virtual bool lti::homography8DofEstimator::apply | ( | const matrix< fpoint > & | src, | |
fvector & | dest, | |||
fvector & | error | |||
) | const [virtual] |
Estimates a transform from the supplied point sets, where all points are considered.
Usually this method calls the apply without the residual first, and then computes the residual.
All points of one point set give a matrix row, whereas all elements of a specifec correspondence stand in a matrix column.
src | matrix<fpoint> with the point sets. All points of the same image stand in a row. The correspondences in another image stand in the according columns. | |
dest | fvector the estimated transform. | |
error | fvector containing the deviation of each point from the estimated transform. Usually this is the residual or elementwise squared residual. |
Implements lti::homographyEstimatorBase.
virtual bool lti::homography8DofEstimator::apply | ( | const matrix< fpoint > & | src, | |
fvector & | dest | |||
) | const [virtual] |
Estimates a transform from the supplied point sets, where all points are considered.
Please implement efficient code using iterators here. Not all robust estimators use a random sampling approach. Some estimators consider all input points and weight them according to their deviation from the transform computed at the prior iteration.
All points of one point set give a matrix row, whereas all elements of a specifec correspondence stand in a matrix column.
src | matrix<fpoint> with the point sets. All points of the same image stand in a row. The correspondences in another image stand in the according columns. | |
dest | fvector the estimated transform. |
Implements lti::homographyEstimatorBase.
virtual bool lti::homography8DofEstimator::apply | ( | const matrix< ipoint > & | src, | |
fvector & | dest, | |||
fvector & | error, | |||
const ivector & | indices, | |||
int | numCorrespondences | |||
) | const [virtual] |
Estimates a transform from the supplied point sets, whereby only the points specified in the index vector are considered.
Usually this method calls the apply without the residual first, and then computes the residual.
All points of one point set give a matrix row, whereas all elements of a specifec correspondence stand in a matrix column.
src | matrix<ipoint> with the point sets. All points of the same image stand in a row. The correspondences in another image stand in the according columns. | |
dest | fvector the estimated transform. | |
error | fvector containing the deviation of each point from the estimated transform. Usually this is the residual or elementwise squared residual. | |
indices | ivector with the indices of the relevant points. | |
numCorrespondences | the first numCorrespondences indices are considered. |
Implements lti::homographyEstimatorBase.
virtual bool lti::homography8DofEstimator::apply | ( | const matrix< ipoint > & | src, | |
fvector & | dest, | |||
const ivector & | indices, | |||
int | numCorrespondences | |||
) | const [virtual] |
Estimates a transform from the supplied point sets, whereby only the points specified in the index vector are considered.
This method is used by robost estimators using a monte carlo approach.
All points of one point set give a matrix row, whereas all elements of a specifec correspondence stand in a matrix column.
src | matrix<ipoint> with the point sets. All points of the same image stand in a row. The correspondences in another image stand in the according columns. | |
dest | fvector the estimated transform. | |
indices | ivector with the indices of the relevant points. | |
numCorrespondences | the first numCorrespondences indices are considered. |
Implements lti::homographyEstimatorBase.
virtual bool lti::homography8DofEstimator::apply | ( | const matrix< ipoint > & | src, | |
fvector & | dest, | |||
fvector & | error | |||
) | const [virtual] |
Estimates a transform from the supplied point sets, where all points are considered.
Usually this method calls the apply without the residual first, and then computes the residual.
All points of one point set give a matrix row, whereas all elements of a specifec correspondence stand in a matrix column.
src | matrix<ipoint> with the point sets. All points of the same image stand in a row. The correspondences in another image stand in the according columns. | |
dest | fvector the estimated transform. | |
error | fvector containing the deviation of each point from the estimated transform. Usually this is the residual or elementwise squared residual. |
Implements lti::homographyEstimatorBase.
virtual bool lti::homography8DofEstimator::apply | ( | const matrix< ipoint > & | src, | |
fvector & | dest | |||
) | const [virtual] |
Estimates a transform from the supplied point sets, where all points are considered.
Please implement efficient code using iterators here. Not all robust estimators use a random sampling approach. Some estimators consider all input points and weight them according to their deviation from the transform computed at the prior iteration.
All points of one point set give a matrix row, whereas all elements of a specifec correspondence stand in a matrix column.
src | matrix<ipoint> with the point sets. All points of the same image stand in a row. The correspondences in another image stand in the according columns. | |
dest | fvector the estimated transform. |
Implements lti::homographyEstimatorBase.
virtual functor* lti::homography8DofEstimator::clone | ( | ) | const [virtual] |
Returns a pointer to a clone of this functor.
Implements lti::homographyEstimatorBase.
virtual bool lti::homography8DofEstimator::computeResidual | ( | const matrix< dpoint > & | src, | |
const dvector & | transform, | |||
dvector & | dest | |||
) | const [virtual] |
Compute the residual for the given correspondences and transformation vector.
src | matrix<dpoint> with the point sets. All points of the same image stand in a row. The correspondences in another image stand in the according columns. | |
transform | dvector with the transformation | |
dest | dvector with the residual |
Implements lti::homographyEstimatorBase.
virtual bool lti::homography8DofEstimator::computeResidual | ( | const matrix< fpoint > & | src, | |
const fvector & | transform, | |||
fvector & | dest | |||
) | const [virtual] |
Compute the residual for the given correspondences and transformation vector.
src | matrix<fpoint> with the point sets. All points of the same image stand in a row. The correspondences in another image stand in the according columns. | |
transform | fvector with the transformation | |
dest | fvector with the residual |
Implements lti::homographyEstimatorBase.
bool lti::homography8DofEstimator::convert | ( | const dvector & | src, | |
hMatrix3D< float > & | dest | |||
) | const [virtual] |
Converts the estimated vector into a hMatrix3D<float>, which is e.g.
used by geometricTransform.
src | dvector the estimated transform. | |
dest | hMatrix3D<float> the estimated transform as a hMatrix3D. |
Implements lti::homographyEstimatorBase.
bool lti::homography8DofEstimator::convert | ( | const fvector & | src, | |
hMatrix3D< float > & | dest | |||
) | const [virtual] |
Converts the estimated vector into a hMatrix3D<float>, which is e.g.
used by geometricTransform.
src | fvector the estimated transform. | |
dest | hMatrix3D<float> the estimated transform as a hMatrix3D. |
Implements lti::homographyEstimatorBase.
homography8DofEstimator& lti::homography8DofEstimator::copy | ( | const homography8DofEstimator & | other | ) |
Copy data of "other" functor.
other | the functor to be copied |
Reimplemented from lti::homographyEstimatorBase.
bool lti::homography8DofEstimator::denormalize | ( | dvector & | srcdest, | |
const vector< dpoint > & | scale, | |||
const vector< dpoint > & | shift | |||
) | const [virtual] |
A transform estimated on normalized data usually differs from the transform of the original data.
Considering the normalization performed this methods computes the transform which applies to the original data.
srcdest | the normalized transform. The result will be left here too. | |
scale | a vector containing the scale applied to each point set. | |
shift | a vector containing the shift of each scaled point set. |
Implements lti::homographyEstimatorBase.
bool lti::homography8DofEstimator::denormalize | ( | fvector & | srcdest, | |
const vector< fpoint > & | scale, | |||
const vector< fpoint > & | shift | |||
) | const [virtual] |
A transform estimated on normalized data usually differs from the transform of the original data.
Considering the normalization performed this methods computes the transform which applies to the original data.
srcdest | the normalized transform. The result will be left here too. | |
scale | a vector containing the scale applied to each point set. | |
shift | a vector containing the shift of each scaled point set. |
Implements lti::homographyEstimatorBase.
const parameters& lti::homography8DofEstimator::getParameters | ( | ) | const |
Returns used parameters.
Reimplemented from lti::homographyEstimatorBase.
virtual const char* lti::homography8DofEstimator::getTypeName | ( | ) | const [virtual] |
Returns the name of this type ("homography8DofEstimator").
Reimplemented from lti::homographyEstimatorBase.
virtual int lti::homography8DofEstimator::maxCorrespondenceDimension | ( | ) | const [virtual] |
Returns the maximum dimension of a correspondence, e.g.
the maximum dimension of a correspondence pair is 2, whereas transformEstimator running on n-tuples may allow an infinite number. Each derived transform estimator only works on correspondences of priori defined dimensions.
Implements lti::homographyEstimatorBase.
virtual int lti::homography8DofEstimator::minCorrespondenceDimension | ( | ) | const [virtual] |
Returns the mininum dimension of a correspondence, e.g.
the minimum dimension of a correspondence pair is 2. Each derived transform estimator only works on correspondences of priori defined dimensions.
Implements lti::homographyEstimatorBase.
virtual int lti::homography8DofEstimator::minNumberCorrespondences | ( | ) | const [virtual] |
Returns the minimum number of correspondences required to estimate the transform.
Implements lti::homographyEstimatorBase.
homography8DofEstimator& lti::homography8DofEstimator::operator= | ( | const homography8DofEstimator & | other | ) |
Alias for copy member.
other | the functor to be copied |
Reimplemented from lti::homographyEstimatorBase.
dpoint lti::homography8DofEstimator::transform | ( | const dpoint & | pt, | |
const dvector & | transf | |||
) | const [inline, virtual] |
This is a fast short cut used in the special robust estimator homographyVerification in the main loop.
pt | fpoint the point to be transformed | |
transf | fvector with the transformation, which e.g. was computed by an apply. |
Implements lti::homographyEstimatorBase.
References lti::genericVector< T >::at(), lti::tpoint< T >::x, and lti::tpoint< T >::y.
fpoint lti::homography8DofEstimator::transform | ( | const fpoint & | pt, | |
const fvector & | transf | |||
) | const [inline, virtual] |
This is a fast short cut used by the special robust estimator homographyVerification in the main loop.
pt | fpoint the point to be transformed | |
transf | fvector with the transformation, which e.g. was computed by an apply. |
Implements lti::homographyEstimatorBase.
References lti::genericVector< T >::at(), lti::tpoint< T >::x, and lti::tpoint< T >::y.