Visual Servoing Platform  version 3.6.1 under development (2024-12-17)
vpTemplateTrackerWarpHomographySL3 Class Referenceabstract

#include <visp3/tt/vpTemplateTrackerWarpHomographySL3.h>

+ Inheritance diagram for vpTemplateTrackerWarpHomographySL3:

Public Member Functions

 vpTemplateTrackerWarpHomographySL3 ()
 
void computeCoeff (const vpColVector &p)
 
void computeDenom (vpColVector &X, const vpColVector &)
 
void dWarp (const vpColVector &X1, const vpColVector &X2, const vpColVector &, vpMatrix &dW)
 
void dWarpCompo (const vpColVector &, const vpColVector &X, const vpColVector &, const double *dwdp0, vpMatrix &dW)
 
void findWarp (const double *ut0, const double *vt0, const double *u, const double *v, int nb_pt, vpColVector &p)
 
void getdW0 (const int &v, const int &u, const double &dv, const double &du, double *dIdW)
 
void getdWdp0 (const int &v, const int &u, double *dIdW)
 
void getdWdp0 (const double &v, const double &u, double *dIdW)
 
vpHomography getHomography () const
 
void getParamInverse (const vpColVector &p, vpColVector &p_inv) const
 
void getParamPyramidDown (const vpColVector &p, vpColVector &p_down)
 
void getParamPyramidUp (const vpColVector &p, vpColVector &p_up)
 
bool isESMcompatible () const
 
void pRondp (const vpColVector &p1, const vpColVector &p2, vpColVector &p12) const
 
void warpX (const vpColVector &X1, vpColVector &X2, const vpColVector &)
 
void warpX (const int &v1, const int &u1, double &v2, double &u2, const vpColVector &)
 
virtual void warpXInv (const vpColVector &X1, vpColVector &X2, const vpColVector &p)=0
 
Inherited functionalities from vpTemplateTrackerWarp
double getDistanceBetweenZoneAndWarpedZone (const vpTemplateTrackerZone &Z, const vpColVector &p)
 
unsigned int getNbParam () const
 
void setNbParam (unsigned int nb)
 
void warp (const double *ut0, const double *vt0, int nb_pt, const vpColVector &p, double *u, double *v)
 
void warpTriangle (const vpTemplateTrackerTriangle &in, const vpColVector &p, vpTemplateTrackerTriangle &out)
 
void warpZone (const vpTemplateTrackerZone &in, const vpColVector &p, vpTemplateTrackerZone &out)
 

Protected Attributes

vpMatrix G
 
vpMatrix dGx
 
std::vector< vpMatrixA
 
double denom
 
unsigned int nbParam
 

Detailed Description

Examples
templateTracker.cpp.

Definition at line 54 of file vpTemplateTrackerWarpHomographySL3.h.

Constructor & Destructor Documentation

◆ vpTemplateTrackerWarpHomographySL3()

vpTemplateTrackerWarpHomographySL3::vpTemplateTrackerWarpHomographySL3 ( )

Construct an homography SL3 model with 8 parameters initialized to zero.

Definition at line 135 of file vpTemplateTrackerWarpHomographySL3.cpp.

References A, dGx, G, vpTemplateTrackerWarp::nbParam, and vpArray2D< Type >::resize().

Member Function Documentation

◆ computeCoeff()

void vpTemplateTrackerWarpHomographySL3::computeCoeff ( const vpColVector p)

Compute the exponential of the homography matrix defined by the given parameters.

Parameters
p: Parameters of the SL3 homography warping function.

Definition at line 271 of file vpTemplateTrackerWarpHomographySL3.cpp.

References vpMatrix::expm(), and G.

Referenced by findWarp().

◆ computeDenom()

void vpTemplateTrackerWarpHomographySL3::computeDenom ( vpColVector X,
const vpColVector  
)

Compute the projection denominator (Z) used in x = X/Z and y = Y/Z.

Parameters
X: Point with coordinates (u, v) to consider.
See also
warpX(const vpColVector &, vpColVector &, const vpColVector &)
warpX(const int &, const int &, double &, double &, const vpColVector &)
dWarp(), dWarpCompo()

Definition at line 261 of file vpTemplateTrackerWarpHomographySL3.cpp.

References vpTemplateTrackerWarp::denom, and G.

Referenced by findWarp().

◆ dWarp()

void vpTemplateTrackerWarpHomographySL3::dWarp ( const vpColVector X1,
const vpColVector X2,
const vpColVector ,
vpMatrix dM 
)
virtual

Compute the derivative matrix of the warping function at point $X=(u,v)$ according to the model parameters:

\[ \frac{\partial M}{\partial p}(X, p) \]

Parameters
X1: 2-dim vector corresponding to the coordinates $(u_1, v_1)$ of the point to consider in the derivative computation.
X2: 2-dim vector corresponding to the coordinates $(u_2, v_2)$ of the point to consider in the derivative computation.
dM: Resulting warping model derivative returned as a 2-by-8 matrix.
See also
computeDenom()

Implements vpTemplateTrackerWarp.

Definition at line 347 of file vpTemplateTrackerWarpHomographySL3.cpp.

References vpTemplateTrackerWarp::denom, dGx, and G.

◆ dWarpCompo()

void vpTemplateTrackerWarpHomographySL3::dWarpCompo ( const vpColVector ,
const vpColVector X,
const vpColVector ,
const double *  dwdp0,
vpMatrix dM 
)
virtual

Compute the compositionnal derivative matrix of the warping function according to the model parameters.

Parameters
X: 2-dim vector corresponding to the coordinates $(u_1, v_1)$ of the point to consider in the derivative computation.
dwdp0: 2-by-8 derivative matrix of the warping function according to the initial warping function parameters (p=0).
dM: Resulting warping model compositionnal derivative returned as a 2-by-8 matrix.
See also
computeDenom()

Implements vpTemplateTrackerWarp.

Definition at line 500 of file vpTemplateTrackerWarpHomographySL3.cpp.

References vpTemplateTrackerWarp::denom, G, and vpTemplateTrackerWarp::nbParam.

◆ findWarp()

BEGIN_VISP_NAMESPACE void vpTemplateTrackerWarpHomographySL3::findWarp ( const double *  ut0,
const double *  vt0,
const double *  u,
const double *  v,
int  nb_pt,
vpColVector p 
)

Find the displacement/warping function parameters from a list of points.

Parameters
ut0: Original u coordinates.
vt0: Original v coordinates.
u: Warped u coordinates.
v: Warped v coordinates.
nb_pt: Number of points.
p: Resulting warping function parameters.

Definition at line 55 of file vpTemplateTrackerWarpHomographySL3.cpp.

References vpMatrix::AtA(), computeCoeff(), computeDenom(), vpMatrix::computeHLM(), getdWdp0(), vpMatrix::inverseByLU(), vpTemplateTrackerWarp::nbParam, pRondp(), vpMatrix::t(), and warpX().

Referenced by getParamPyramidDown(), and getParamPyramidUp().

◆ getDistanceBetweenZoneAndWarpedZone()

double vpTemplateTrackerWarp::getDistanceBetweenZoneAndWarpedZone ( const vpTemplateTrackerZone Z,
const vpColVector p 
)
inherited

Compute the distance between a zone and its associated warped zone.

Parameters
Z: Zone to consider.
p: Parameters of the warping function.

Definition at line 69 of file vpTemplateTrackerWarp.cpp.

References vpTemplateTrackerTriangle::getCorner(), and vpTemplateTrackerWarp::warpX().

◆ getdW0()

void vpTemplateTrackerWarpHomographySL3::getdW0 ( const int &  v,
const int &  u,
const double &  dv,
const double &  du,
double *  dIdW 
)
virtual

Compute the derivative of the image with relation to the warping function parameters.

Parameters
v: Coordinate (along the image rows axis) of the point to consider in the image.
u: Coordinate (along the image columns axis) of the point to consider in the image.
dv: Derivative on the v-axis (along the rows) of the point (u,v).
du: Derivative on the u-axis (along the columns) of the point (u,v).
dIdW: Resulting derivative matrix (image according to the warping function).

Implements vpTemplateTrackerWarp.

Definition at line 378 of file vpTemplateTrackerWarpHomographySL3.cpp.

References dGx, vpMatrix::eye(), G, and vpTemplateTrackerWarp::nbParam.

◆ getdWdp0() [1/2]

void vpTemplateTrackerWarpHomographySL3::getdWdp0 ( const double &  v,
const double &  u,
double *  dIdW 
)

Compute the derivative of the warping model $M$ according to the initial parameters $p_0$ at point $X=(u,v)$:

\[ \frac{\partial M}{\partial p}(X, p_0) \]

Parameters
v: Coordinate (along the image rows axis) of the point X(u,v) to consider in the image.
u: Coordinate (along the image columns axis) of the point X(u,v) to consider in the image.
dIdW: Resulting 2-by-8 derivative matrix.

Definition at line 459 of file vpTemplateTrackerWarpHomographySL3.cpp.

References dGx, vpMatrix::eye(), G, and vpTemplateTrackerWarp::nbParam.

◆ getdWdp0() [2/2]

void vpTemplateTrackerWarpHomographySL3::getdWdp0 ( const int &  v,
const int &  u,
double *  dIdW 
)
virtual

Compute the derivative of the warping model $M$ according to the initial parameters $p_0$ at point $X=(u,v)$:

\[ \frac{\partial M}{\partial p}(X, p_0) \]

Parameters
v: Coordinate (along the image rows axis) of the point X(u,v) to consider in the image.
u: Coordinate (along the image columns axis) of the point X(u,v) to consider in the image.
dIdW: Resulting 2-by-8 derivative matrix.

Implements vpTemplateTrackerWarp.

Definition at line 418 of file vpTemplateTrackerWarpHomographySL3.cpp.

References dGx, vpMatrix::eye(), G, and vpTemplateTrackerWarp::nbParam.

Referenced by findWarp().

◆ getHomography()

vpHomography vpTemplateTrackerWarpHomographySL3::getHomography ( ) const

Return the homography corresponding to the parameters.

Returns
Corresponding homography.

Definition at line 325 of file vpTemplateTrackerWarpHomographySL3.cpp.

References G.

◆ getNbParam()

unsigned int vpTemplateTrackerWarp::getNbParam ( ) const
inlineinherited

Get the number of parameters of the warping function.

Returns
Number of parameters.

Definition at line 217 of file vpTemplateTrackerWarp.h.

Referenced by vpTemplateTracker::computeOptimalBrentGain(), vpTemplateTrackerWarpHomography::getParam(), vpTemplateTrackerMIInverseCompositional::trackNoPyr(), and vpTemplateTracker::vpTemplateTracker().

◆ getParamInverse()

void vpTemplateTrackerWarpHomographySL3::getParamInverse ( const vpColVector p,
vpColVector p_inv 
) const
virtual

Compute inverse of the warping transformation.

Parameters
p: 8-dim vector that contains the parameters corresponding to the transformation to inverse.
p_inv: 8-dim vector that contains the parameters of the inverse transformation $ {M(p)}^{-1}$.

Implements vpTemplateTrackerWarp.

Definition at line 515 of file vpTemplateTrackerWarpHomographySL3.cpp.

◆ getParamPyramidDown()

void vpTemplateTrackerWarpHomographySL3::getParamPyramidDown ( const vpColVector p,
vpColVector p_down 
)
virtual

Get the parameters of the warping function one level down where image size is divided by two along the lines and the columns.

Parameters
p: 8-dim vector that contains the current parameters of the warping function.
p_down: 8-dim vector that contains the resulting parameters one level down.

Implements vpTemplateTrackerWarp.

Definition at line 166 of file vpTemplateTrackerWarpHomographySL3.cpp.

References findWarp(), and vpTemplateTrackerWarp::warp().

◆ getParamPyramidUp()

void vpTemplateTrackerWarpHomographySL3::getParamPyramidUp ( const vpColVector p,
vpColVector p_up 
)
virtual

Get the parameters of the warping function one level up where image size is multiplied by two along the lines and the columns.

Parameters
p: 8-dim vector that contains the current parameters of the warping function.
p_up: 8-dim vector that contains the resulting parameters one level up.

Implements vpTemplateTrackerWarp.

Definition at line 206 of file vpTemplateTrackerWarpHomographySL3.cpp.

References findWarp(), and vpTemplateTrackerWarp::warp().

◆ isESMcompatible()

bool vpTemplateTrackerWarpHomographySL3::isESMcompatible ( ) const
inlinevirtual

Tells if the warping function is ESM compatible.

Returns
true. Homography SL3 model is compatible with ESM.

Implements vpTemplateTrackerWarp.

Definition at line 86 of file vpTemplateTrackerWarpHomographySL3.h.

◆ pRondp()

void vpTemplateTrackerWarpHomographySL3::pRondp ( const vpColVector p1,
const vpColVector p2,
vpColVector p12 
) const
virtual

Compute the transformation resulting from the composition of two other transformations.

Parameters
p1: 8-dim vector that contains the parameters corresponding to first transformation.
p2: 8-dim vector that contains the parameters corresponding to second transformation.
p12: 8-dim vector that contains the resulting transformation $ p_{12} = p_1 \circ p_2$.

Implements vpTemplateTrackerWarp.

Definition at line 525 of file vpTemplateTrackerWarpHomographySL3.cpp.

Referenced by findWarp().

◆ setNbParam()

void vpTemplateTrackerWarp::setNbParam ( unsigned int  nb)
inlineinherited

Set the number of parameters of the warping function.

Parameters
nb: New number of parameters.

Definition at line 224 of file vpTemplateTrackerWarp.h.

◆ warp()

void vpTemplateTrackerWarp::warp ( const double *  ut0,
const double *  vt0,
int  nb_pt,
const vpColVector p,
double *  u,
double *  v 
)
inherited

Warp a list of points.

Parameters
ut0: List of u coordinates of the points.
vt0: List of v coordinates of the points.
nb_pt: Number of points to consider.
p: Parameters of the warp.
u: Resulting u coordinates.
v: resulting v coordinates.

Definition at line 91 of file vpTemplateTrackerWarp.cpp.

References vpTemplateTrackerWarp::warpX().

Referenced by getParamPyramidDown(), and getParamPyramidUp().

◆ warpTriangle()

BEGIN_VISP_NAMESPACE void vpTemplateTrackerWarp::warpTriangle ( const vpTemplateTrackerTriangle in,
const vpColVector p,
vpTemplateTrackerTriangle out 
)
inherited

Warp a triangle and store the result in a new zone.

Parameters
in: Triangle to warp.
p: Parameters of the warping function. These parameters are estimated by the template tracker and returned using vpTemplateTracker::getp().
out: Resulting triangle.

Definition at line 38 of file vpTemplateTrackerWarp.cpp.

References vpException::dimensionError, vpTemplateTrackerTriangle::getCorners(), vpTemplateTrackerTriangle::init(), vpArray2D< Type >::size(), and vpTemplateTrackerWarp::warpX().

Referenced by vpTemplateTrackerWarp::warpZone().

◆ warpX() [1/2]

void vpTemplateTrackerWarpHomographySL3::warpX ( const int &  v1,
const int &  u1,
double &  v2,
double &  u2,
const vpColVector  
)
virtual

Warp point $X_1=(u_1,v_1)$ using the transformation model with parameters $p$.

\[X_2 = {^2}M_1(p) * X_1\]

Parameters
v1: Coordinate (along the image rows axis) of the point $X_1=(u_1,v_1)$ to warp.
u1: Coordinate (along the image columns axis) of the point $X_1=(u_1,v_1)$ to warp.
v2: Coordinate of the warped point $X_2=(u_2,v_2)$ along the image rows axis.
u2: Coordinate of the warped point $X_2=(u_2,v_2)$ along the image column axis.
See also
computeDenom()

Implements vpTemplateTrackerWarp.

Definition at line 314 of file vpTemplateTrackerWarpHomographySL3.cpp.

References vpTemplateTrackerWarp::denom, and G.

◆ warpX() [2/2]

void vpTemplateTrackerWarpHomographySL3::warpX ( const vpColVector X1,
vpColVector X2,
const vpColVector  
)
virtual

Warp point $X_1=(u_1,v_1)$ using the transformation model.

\[X_2 = {^2}M_1(p) * X_1\]

Parameters
X1: 2-dim vector corresponding to the coordinates $(u_1, v_1)$ of the point to warp.
X2: 2-dim vector corresponding to the coordinates $(u_2, v_2)$ of the warped point.
See also
computeDenom()

Implements vpTemplateTrackerWarp.

Definition at line 297 of file vpTemplateTrackerWarpHomographySL3.cpp.

References vpTemplateTrackerWarp::denom, and G.

Referenced by findWarp().

◆ warpXInv()

virtual void vpTemplateTrackerWarp::warpXInv ( const vpColVector X1,
vpColVector X2,
const vpColVector p 
)
pure virtualinherited

Warp a point X1 with the inverse transformation $M$.

\[ X_2 = {\left( {^1}M_2 \right) }^{-1} \; X_1\]

Parameters
X1: Vector corresponding to the coordinates (u,v) of the point to warp.
X2: Vector corresponding to the coordinates (u,v) of the warped point.
p: Parameters corresponding to the warping RT model ${^1}M_2$.

Implemented in vpTemplateTrackerWarpTranslation, vpTemplateTrackerWarpSRT, vpTemplateTrackerWarpRT, vpTemplateTrackerWarpHomography, and vpTemplateTrackerWarpAffine.

◆ warpZone()

void vpTemplateTrackerWarp::warpZone ( const vpTemplateTrackerZone in,
const vpColVector p,
vpTemplateTrackerZone out 
)
inherited

Warp a zone and store the result in a new zone.

Parameters
in: Zone to warp.
p: Parameters of the warping function. These parameters are estimated by the template tracker and returned using vpTemplateTracker::getp().
out: Resulting zone.
Examples
templateTracker.cpp.

Definition at line 58 of file vpTemplateTrackerWarp.cpp.

References vpTemplateTrackerZone::add(), vpTemplateTrackerZone::clear(), vpTemplateTrackerZone::getNbTriangle(), vpTemplateTrackerZone::getTriangle(), and vpTemplateTrackerWarp::warpTriangle().

Referenced by vpTemplateTracker::display().

Member Data Documentation

◆ A

std::vector<vpMatrix> vpTemplateTrackerWarpHomographySL3::A
protected

◆ denom

double vpTemplateTrackerWarp::denom
protectedinherited

◆ dGx

vpMatrix vpTemplateTrackerWarpHomographySL3::dGx
protected

◆ G

vpMatrix vpTemplateTrackerWarpHomographySL3::G
protected

◆ nbParam