A simple struct to store 2D affine transforms as used in the SIFT code. More...
#include <SIFT/SIFTaffine.H>
Public Member Functions | |
SIFTaffine () | |
Constructor; initializes to identity. | |
SIFTaffine (const float mm1, const float mm2, const float mm3, const float mm4, const float ttx, const float tty) | |
Constructor. | |
void | transform (const float x, const float y, float &u, float &v) const |
Transform (x,y) into (u,v) using aff forward. | |
bool | isInversible () const |
Returns true if the affine can be inverted. | |
SIFTaffine | inverse () const |
Get the backward affine given a forward one. | |
void | decompose (float &theta, float &sx, float &sy, float &str) const |
Decompose into rotation, scaling, and stretching components. | |
float | getResidualDistSq (const KeypointMatch &km) const |
Get residual distance squared for a given KeypointMatch. | |
SIFTaffine | compose (const SIFTaffine &other) const |
Compose two affine transforms. | |
Public Attributes | |
float | m1 |
float | m2 |
float | m3 |
float | m4 |
float | tx |
float | ty |
our contents |
A simple struct to store 2D affine transforms as used in the SIFT code.
Definition at line 47 of file SIFTaffine.H.
SIFTaffine::SIFTaffine | ( | ) | [inline] |
Constructor; initializes to identity.
Definition at line 131 of file SIFTaffine.H.
SIFTaffine::SIFTaffine | ( | const float | mm1, | |
const float | mm2, | |||
const float | mm3, | |||
const float | mm4, | |||
const float | ttx, | |||
const float | tty | |||
) | [inline] |
Constructor.
Definition at line 136 of file SIFTaffine.H.
SIFTaffine SIFTaffine::compose | ( | const SIFTaffine & | other | ) | const [inline] |
Compose two affine transforms.
We are the one that is applied first, other is applied second (i.e., to our results). Transforming by the resulting affine is like transforming first by us then by other.
Definition at line 239 of file SIFTaffine.H.
References ty.
Referenced by main(), and BeoMap::makePanorama().
void SIFTaffine::decompose | ( | float & | theta, | |
float & | sx, | |||
float & | sy, | |||
float & | str | |||
) | const [inline] |
Decompose into rotation, scaling, and stretching components.
This decomposition requires that the affine be inversible. It is based on a polar decomposition as proposed in this excellent paper: 'Matrix animation and polar decomposition', Ken Shoemake and Tom Duff, Proceedings of the conference on Graphics interface '92, Vancouver, British Columbia, Canada, pp. 258-264. The resulting decomposition is such that:
[ m1 m2 ] [ cos(theta) -sin(theta) ] [ sx str ] [ m3 m4 ] = [ sin(theta) cos(theta) ] * [ str sy ]
which you can also interpret as:
[ m1 m2 ] [ cos(theta) -sin(theta) ] [ sx 0 ] [ 1 str/sx ] [ m3 m4 ] = [ sin(theta) cos(theta) ] * [ 0 sy ] * [ str/sy 1 ]
(if sx and sy are non-null), i.e.,
M = ROT(theta) * SCALE(sx, sy) * SHEAR(str/sx, str/sy)
Definition at line 173 of file SIFTaffine.H.
References ASSERT.
Referenced by VisualObjectMatch::checkSIFTaffine(), and BeoSub::recognizeSIFT().
float SIFTaffine::getResidualDistSq | ( | const KeypointMatch & | km | ) | const [inline] |
Get residual distance squared for a given KeypointMatch.
The return value is the squared distance between the coordinates of the ref Keypoint in the Keypointmatch, transformed by our affine transform, and the coordinates of the test Keypoint. Thus it is in squared units of the pixel size in the test image.
Definition at line 222 of file SIFTaffine.H.
References KeypointMatch::refkp, transform(), and KeypointMatch::tstkp.
Referenced by VisualObjectMatch::getAffineAvgDist(), and VisualObjectMatch::pruneByAff().
SIFTaffine SIFTaffine::inverse | ( | ) | const [inline] |
Get the backward affine given a forward one.
Definition at line 155 of file SIFTaffine.H.
Referenced by VisualObjectMatch::getTransfTestOutline(), main(), and BeoMap::makePanorama().
bool SIFTaffine::isInversible | ( | ) | const [inline] |
Returns true if the affine can be inverted.
Definition at line 151 of file SIFTaffine.H.
Referenced by VisualObjectMatch::checkSIFTaffine(), main(), and BeoMap::makePanorama().
void SIFTaffine::transform | ( | const float | x, | |
const float | y, | |||
float & | u, | |||
float & | v | |||
) | const [inline] |
Transform (x,y) into (u,v) using aff forward.
Definition at line 143 of file SIFTaffine.H.
References ty.
Referenced by LandmarkDB::build(), VisualObjectMatch::getFusedImage(), VisualObjectMatch::getOverlapRect(), getResidualDistSq(), VisualObjectMatch::getSalDist(), VisualObjectMatch::getTransfTestImage(), VisualObjectMatch::getTransfTestOutline(), main(), and BeoMap::makePanorama().
float SIFTaffine::ty |
our contents
Definition at line 114 of file SIFTaffine.H.
Referenced by LandmarkDB::build(), compose(), VisualObjectMatch::getSpatialDist(), inverse(), operator<<(), and transform().