39 #include <visp3/tt_mi/vpTemplateTrackerMIForwardCompositional.h>
48 std::cout<<
"Initialise precomputed value of Compositionnal Direct"<<std::endl;
49 ptTemplateSupp=
new vpTemplateTrackerPointSuppMIInv[
templateSize];
64 ct=(int)((Tij*(
Nc-1))/255.);
65 et=(Tij*(
Nc-1))/255.-ct;
66 ptTemplateSupp[point].et=et;
67 ptTemplateSupp[point].ct=ct;
68 ptTemplateSupp[point].Bt=
new double[4];
69 ptTemplateSupp[point].dBt=
new double[4];
70 for(
char it=-1;it<=2;it++)
72 ptTemplateSupp[point].Bt[it+1] =vpTemplateTrackerBSpline::Bspline4(-it+et);
73 ptTemplateSupp[point].dBt[it+1] =vpTemplateTrackerMIBSpline::dBspline4(-it+et);
108 Warp->computeCoeff(
p);
132 cr=ptTemplateSupp[point].ct;
133 er=ptTemplateSupp[point].et;
134 ct=(int)((IW*(
Nc-1))/255.);
135 et=((double)IW*(
Nc-1))/255.-ct;
139 double *tptemp=
new double[
nbParam];
140 for(
unsigned int it=0;it<
nbParam;it++)
141 tptemp[it] =dW[0][it]*dx+dW[1][it]*dy;
144 erreur+=(Tij-IW)*(Tij-IW);
146 vpTemplateTrackerMIBSpline::PutTotPVBspline(
PrtTout, cr, er, ct, et,
Nc,tptemp, nbParam,
bspline);
168 std::cout<<
"Compositionnal tracking no initialised\nUse initCompo(vpImage<unsigned char> &I) function"<<std::endl;
181 double MI=0,MIprec=-1000;
197 unsigned int iteration=0;
207 Warp->computeCoeff(
p);
230 ct=(int)((IW*(
Nc-1))/255.);
231 et=((double)IW*(
Nc-1))/255.-ct;
232 cr=ptTemplateSupp[point].ct;
233 er=ptTemplateSupp[point].et;
237 double *tptemp=
new double[
nbParam];
238 for(
unsigned int it=0;it<
nbParam;it++)
239 tptemp[it] =dW[0][it]*dx+dW[1][it]*dy;
243 erreur+=(Tij-IW)*(Tij-IW);
246 vpTemplateTrackerMIBSpline::PutTotPVBsplineNoSecond(
PrtTout, cr, er, ct, et,
Nc, tptemp, nbParam,
bspline);
248 vpTemplateTrackerMIBSpline::PutTotPVBspline(
PrtTout, cr, er, ct, et,
Nc, tptemp, nbParam,
bspline);
313 while( (std::fabs(MI-MIprec) > std::fabs(MI)*std::numeric_limits<double>::epsilon()) && (iteration<
iterationMax) );
virtual void dWarpCompo(const vpColVector &X1, const vpColVector &X2, const vpColVector &ParamM, const double *dwdp0, vpMatrix &dW)=0
void computeHessien(vpMatrix &H)
void initHessienDesired(const vpImage< unsigned char > &I)
unsigned int getWidth() const
vpTemplateTrackerPoint * ptTemplate
virtual void warpX(const int &i, const int &j, double &i2, double &j2, const vpColVector &ParamM)=0
void computeOptimalBrentGain(const vpImage< unsigned char > &I, vpColVector &tp, double tMI, vpColVector &direction, double &alpha)
error that can be emited by ViSP classes.
Type getValue(double i, double j) 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)
vpHessienApproximationType ApproxHessian
unsigned int templateSize
unsigned int iterationMax
virtual void pRondp(const vpColVector &p1, const vpColVector &p2, vpColVector &pres) const =0
Error that can be emited by the vpTracker class and its derivates.
double getCost(const vpImage< unsigned char > &I, const vpColVector &tp)
static void filter(const vpImage< double > &I, vpImage< double > &Iu, vpImage< double > &Iv, const vpMatrix &M)
void computeMI(double &MI)
vpMatrix HLMdesireInverse
Implementation of column vector and the associated operations.
void trackNoPyr(const vpImage< unsigned char > &I)
vpMatrix inverseByLU() const
vpTemplateTrackerMIForwardCompositional(vpTemplateTrackerWarp *_warp)
unsigned int getHeight() const
virtual void getdWdp0(const int &i, const int &j, double *dIdW)=0
vpTemplateTrackerWarp * Warp
static void computeHLM(const vpMatrix &H, const double &alpha, vpMatrix &HLM)
void computeProba(int &nbpoint)
vpHessienType hessianComputation