39 #include <visp3/tt_mi/vpTemplateTrackerMIForwardCompositional.h>
48 std::cout<<
"Initialise precomputed value of Compositionnal Direct"<<std::endl;
49 ptTemplateSupp=
new vpTemplateTrackerPointSuppMIInv[
templateSize];
60 int ct=(int)((Tij*(
Nc-1))/255.);
61 double et=(Tij*(
Nc-1))/255.-ct;
62 ptTemplateSupp[point].et=et;
63 ptTemplateSupp[point].ct=ct;
64 ptTemplateSupp[point].Bt=
new double[4];
65 ptTemplateSupp[point].dBt=
new double[4];
66 for(
char it=-1;it<=2;it++)
68 ptTemplateSupp[point].Bt[it+1] =vpTemplateTrackerBSpline::Bspline4(-it+et);
69 ptTemplateSupp[point].dBt[it+1] =vpTemplateTrackerMIBSpline::dBspline4(-it+et);
101 Warp->computeCoeff(
p);
127 cr=ptTemplateSupp[point].ct;
128 er=ptTemplateSupp[point].et;
129 ct=(int)((IW*(
Nc-1))/255.);
130 et=((double)IW*(
Nc-1))/255.-ct;
134 double *tptemp=
new double[
nbParam];
135 for(
unsigned int it=0;it<
nbParam;it++)
136 tptemp[it] =dW[0][it]*dx+dW[1][it]*dy;
141 vpTemplateTrackerMIBSpline::PutTotPVBspline(
PrtTout, cr, er, ct, et,
Nc,tptemp, nbParam,
bspline);
163 std::cout<<
"Compositionnal tracking no initialised\nUse initCompo(vpImage<unsigned char> &I) function"<<std::endl;
174 double MI=0,MIprec=-1000;
190 unsigned int iteration=0;
200 Warp->computeCoeff(
p);
223 ct=(int)((IW*(
Nc-1))/255.);
224 et=((double)IW*(
Nc-1))/255.-ct;
225 cr=ptTemplateSupp[point].ct;
226 er=ptTemplateSupp[point].et;
230 double *tptemp=
new double[
nbParam];
231 for(
unsigned int it=0;it<
nbParam;it++)
232 tptemp[it] =dW[0][it]*dx+dW[1][it]*dy;
239 vpTemplateTrackerMIBSpline::PutTotPVBsplineNoSecond(
PrtTout, cr, er, ct, et,
Nc, tptemp, nbParam,
bspline);
241 vpTemplateTrackerMIBSpline::PutTotPVBspline(
PrtTout, cr, er, ct, et,
Nc, tptemp, nbParam,
bspline);
306 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)
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
static void filter(const vpImage< double > &I, vpImage< double > &Iu, vpImage< double > &Iv, const vpMatrix &M, const bool convolve=false)
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