40 #include <visp3/tt_mi/vpTemplateTrackerMIESM.h>
42 #ifdef VISP_HAVE_OPENMP
48 HDirect(), HInverse(), HdesireDirect(), HdesireInverse(), GDirect(), GInverse()
53 std::cerr<<
"The selected warp function is not appropriate for the ESM algorithm..."<<std::endl;
59 std::cout<<
"Initialise Hessian at Desired position..."<<std::endl;
81 Warp->computeCoeff(
p);
138 Warp->computeCoeff(
p);
169 double *tptemp=
new double[
nbParam];
170 for(
unsigned int it=0;it<
nbParam;it++)
171 tptemp[it] =dW[0][it]*dx+dW[1][it]*dy;
177 erreur+=(Tij-IW)*(Tij-IW);
221 ptTemplateSupp=
new vpTemplateTrackerPointSuppMIInv[
templateSize];
243 ct=(int)((Tij*(
Nc-1))/255.);
244 et=(Tij*(
Nc-1))/255.-ct;
245 ptTemplateSupp[point].et=et;
246 ptTemplateSupp[point].ct=ct;
247 ptTemplateSupp[point].Bt=
new double[4];
248 ptTemplateSupp[point].dBt=
new double[4];
249 for(
char it=-1;it<=2;it++)
251 ptTemplateSupp[point].Bt[it+1] =vpTemplateTrackerBSpline::Bspline4(-it+et);
252 ptTemplateSupp[point].dBt[it+1] =vpTemplateTrackerMIBSpline::dBspline4(-it+et);
261 std::cout<<
"Compositionnal tracking no initialised\nUse initCompInverse(vpImage<unsigned char> &I) function"<<std::endl;
297 unsigned int iteration=0;
309 Warp->computeCoeff(
p);
368 Warp->computeCoeff(
p);
369 #ifdef VISP_HAVE_OPENMP
370 int nthreads = omp_get_num_procs() ;
372 omp_set_num_threads(nthreads);
373 #pragma omp parallel for private(point, Tij,IW,i,j,i2,j2,dx,dy) default(shared)
405 double *tptemp=
new double[
nbParam];
406 for(
unsigned int it=0;it<
nbParam;it++)
407 tptemp[it] =dW[0][it]*dx+dW[1][it]*dy;
411 erreur+=(Tij-IW)*(Tij-IW);
virtual void dWarpCompo(const vpColVector &X1, const vpColVector &X2, const vpColVector &ParamM, const double *dwdp0, vpMatrix &dW)=0
void computeHessien(vpMatrix &H)
unsigned int getWidth() const
void resize(const unsigned int nrows, const unsigned int ncols, const bool flagNullify=true)
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
vpTemplateTrackerMIESM()
Default constructor.
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
Error that can be emited by the vpTracker class and its derivates.
double getCost(const vpImage< unsigned char > &I, const vpColVector &tp)
void initHessienDesired(const vpImage< unsigned char > &I)
static void filter(const vpImage< double > &I, vpImage< double > &Iu, vpImage< double > &Iv, const vpMatrix &M)
void computeMI(double &MI)
virtual bool isESMcompatible() const =0
virtual void getdW0(const int &i, const int &j, const double &dy, const double &dx, double *dIdW)=0
void trackNoPyr(const vpImage< unsigned char > &I)
vpMinimizationTypeMIESM minimizationMethod
vpMatrix HLMdesireInverse
vpTemplateTrackerPointCompo * ptTemplateCompo
Implementation of column vector and the associated operations.
vpMatrix inverseByLU() const
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
void resize(const unsigned int i, const bool flagNullify=true)