44 #include <visp/vpTemplateTrackerZNCCInverseCompositional.h>
45 #include <visp/vpImageFilter.h>
49 evolRMS(0), x_pos(), y_pos(), threshold_RMS(1e-8), moydIrefdp()
99 Warp->computeCoeff(
p);
100 double Ic,dIcx=0.,dIcy=0.;
136 for(
unsigned int it=0;it<
nbParam;it++)
141 double *tempt=
new double[
nbParam];
142 for(
unsigned int it=0;it<
nbParam;it++)
143 tempt[it]=
dW[0][it]*dIcx+
dW[1][it]*dIcy;
148 for(
unsigned int it=0;it<
nbParam;it++)
149 for(
unsigned int jt=0;jt<
nbParam;jt++)
151 moyd2Iref[it][jt] +=(
dW[0][it]*(
dW[0][jt]*d_Ixx+
dW[1][jt]*d_Ixy)
152 +
dW[1][it]*(
dW[0][jt]*d_Ixy+
dW[1][jt]*d_Iyy));
161 moyIref=moyIref/Nbpoint;
163 moyd2Iref=moyd2Iref/Nbpoint;
166 double covarIref=0,covarIc=0;
196 double *tempt=
new double[
nbParam];
197 for(
unsigned int it=0;it<
nbParam;it++)
198 tempt[it]=
dW[0][it]*dIcx+
dW[1][it]*dIcy;
200 double prodIc=(Ic-moyIc);
206 for(
unsigned int it=0;it<
nbParam;it++)
207 for(
unsigned int jt=0;jt<
nbParam;jt++)
209 sIcd2Iref[it][jt] +=prodIc*(
dW[0][it]*(
dW[0][jt]*d_Ixx+
dW[1][jt]*d_Ixy)
210 +
dW[1][it]*(
dW[0][jt]*d_Ixy+
dW[1][jt]*d_Iyy)-moyd2Iref[it][jt]);
217 for(
unsigned int it=0;it<
nbParam;it++)
220 covarIref+=(Iref-moyIref)*(Iref-moyIref);
221 covarIc+=(Ic-moyIc)*(Ic-moyIc);
222 sIcIref+=(Iref-moyIref)*(Ic-moyIc);
227 covarIref=sqrt(covarIref);
228 covarIc=sqrt(covarIc);
230 denom=covarIref*covarIc;
232 double NCC=sIcIref/denom;
238 d2covarIref=-(sIcd2Iref-sdIrefdIref+dcovarIref*dcovarIref.
t())/covarIref;
242 Hdesire=(sIcd2Iref-sdIrefdIref+dcovarIref*dcovarIref.
t())/denom;
259 unsigned int iteration=0;
268 Warp->computeCoeff(
p);
300 moyIref=moyIref/Nbpoint;
303 double covarIref=0,covarIc=0;
328 double prod=(Ic-moyIc);
329 for(
unsigned int it=0;it<
nbParam;it++)
331 for(
unsigned int it=0;it<
nbParam;it++)
337 covarIref+=(Iref-moyIref)*(Iref-moyIref);
338 covarIc+=(Ic-moyIc)*(Ic-moyIc);
339 sIcIref+=(Iref-moyIref)*(Ic-moyIc);
344 covarIref=sqrt(covarIref);
345 covarIc=sqrt(covarIc);
346 denom=covarIref*covarIc;
349 if (std::fabs(denom) <= std::numeric_limits<double>::epsilon())
355 double NCC=sIcIref/denom;
357 G=1.*(sIcdIref/denom-NCC*dcovarIref/covarIref);
366 std::cout<<
"probleme inversion"<<std::endl;
392 x_pos.resize(nb_corners);
393 y_pos.resize(nb_corners);
395 Warp->computeCoeff(
p);
401 for (
unsigned int j=0; j<3; j++) {
404 Warp->computeDenom(
X1,p_);
416 Warp->computeCoeff(p_);
423 for (
unsigned int j=0; j<3; j++) {
426 Warp->computeDenom(
X1,p_);
Definition of the vpMatrix class.
void getTriangle(unsigned int i, vpTemplateTrackerTriangle &T) const
void initCompInverse(const vpImage< unsigned char > &I)
unsigned int getWidth() const
static void getGradX(const vpImage< unsigned char > &I, vpImage< double > &dIx)
vpTemplateTrackerPoint * ptTemplate
static void getGradY(const vpImage< unsigned char > &I, vpImage< double > &dIy)
virtual void warpX(const int &i, const int &j, double &i2, double &j2, const vpColVector &ParamM)=0
void initHessienDesired(const vpImage< unsigned char > &I)
std::vector< double > x_pos
Type getValue(double i, double j) const
vpColVector getCorner(unsigned int i) const
static void getGradYGauss2D(const vpImage< unsigned char > &I, vpImage< double > &dIy, const double *gaussianKernel, const double *gaussianDerivativeKernel, unsigned int size)
static void getGradXGauss2D(const vpImage< unsigned char > &I, vpImage< double > &dIx, const double *gaussianKernel, const double *gaussianDerivativeKernel, unsigned int size)
virtual void getParamInverse(const vpColVector &ParamM, vpColVector &ParamMinv) const =0
unsigned int templateSize
unsigned int iterationMax
void trackNoPyr(const vpImage< unsigned char > &I)
virtual void pRondp(const vpColVector &p1, const vpColVector &p2, vpColVector &pres) const =0
vpTemplateTrackerZNCCInverseCompositional(vpTemplateTrackerWarp *warp)
unsigned int getNbTriangle() const
static void filter(const vpImage< double > &I, vpImage< double > &Iu, vpImage< double > &Iv, const vpMatrix &M)
vpRowVector t() const
transpose of Vector
virtual void getdW0(const int &i, const int &j, const double &dy, const double &dx, double *dIdW)=0
void initPosEvalRMS(vpColVector &p)
vpMatrix HLMdesireInverse
std::vector< double > y_pos
Class that provides a data structure for the column vectors as well as a set of operations on these v...
vpMatrix inverseByLU() const
vpTemplateTrackerZone * zoneTracked
unsigned int getHeight() const
void computeEvalRMS(const vpColVector &p)
vpTemplateTrackerWarp * Warp
static void computeHLM(const vpMatrix &H, const double &alpha, vpMatrix &HLM)
virtual void dWarp(const vpColVector &X1, const vpColVector &X2, const vpColVector &ParamM, vpMatrix &dW)=0
void resize(const unsigned int i, const bool flagNullify=true)