34 #include <visp3/core/vpDebug.h>
35 #include <visp3/tt/vpTemplateTrackerWarp.h>
42 vpCTRACE <<
"Bad template tracker warp parameters dimension. Should "
56 out.
init(rS1, rS2, rS3);
71 unsigned int nb_corners = Z.getNbTriangle() * 3;
77 for (
unsigned int i = 0; i < Z.getNbTriangle(); i++) {
78 Z.getTriangle(i, triangle);
79 for (
unsigned int j = 0; j < 3; j++) {
84 res += sqrt((X2[0] - X1[0]) * (X2[0] - X1[0]) + (X2[1] - X1[1]) * (X2[1] - X1[1]));
88 return res / nb_corners;
96 for (
int i = 0; i < nb_pt; i++) {
107 #ifndef DOXYGEN_SHOULD_SKIP_THIS
108 void vpTemplateTrackerWarp::findWarp(
const double *ut0,
const double *vt0,
const double *u,
const double *v,
int nb_pt,
122 double lambda = 0.01;
124 erreur_prec = erreur;
129 for (
int i = 0; i < nb_pt; i++) {
134 dWarp(X1, fX1, p, dW_);
143 erreur += ((u[i] - fX1[0]) * (u[i] - fX1[0]) + (v[i] - fX1[1]) * (v[i] - fX1[1]));
155 }
while ((cpt < 150) && (sqrt((erreur_prec - erreur) * (erreur_prec - erreur)) > 1e-20));
unsigned int size() const
Return the number of elements of the 2D array.
Implementation of column vector and the associated operations.
error that can be emitted by ViSP classes.
@ dimensionError
Bad dimension.
Implementation of a matrix and operations on matrices.
static void computeHLM(const vpMatrix &H, const double &alpha, vpMatrix &HLM)
vpColVector getCorner(unsigned int i) const
void init(const vpColVector &c1, const vpColVector &c2, const vpColVector &c3)
void getCorners(vpColVector &c1, vpColVector &c2, vpColVector &c3) const
void warpTriangle(const vpTemplateTrackerTriangle &in, const vpColVector &p, vpTemplateTrackerTriangle &out)
unsigned int nbParam
Number of parameters used to model warp transformation.
virtual void dWarp(const vpColVector &X1, const vpColVector &X2, const vpColVector &p, vpMatrix &dM)=0
void warpZone(const vpTemplateTrackerZone &in, const vpColVector &p, vpTemplateTrackerZone &out)
double getDistanceBetweenZoneAndWarpedZone(const vpTemplateTrackerZone &Z, const vpColVector &p)
virtual void warpX(const int &v1, const int &u1, double &v2, double &u2, const vpColVector &p)=0
void warp(const double *ut0, const double *vt0, int nb_pt, const vpColVector &p, double *u, double *v)
void getTriangle(unsigned int i, vpTemplateTrackerTriangle &T) const
unsigned int getNbTriangle() const
void add(const vpTemplateTrackerTriangle &t)