40 #include <visp3/tt_mi/vpTemplateTrackerMIForwardAdditional.h>
42 #ifdef VISP_HAVE_OPENMP
47 :
vpTemplateTrackerMI(_warp), minimizationMethod(USE_NEWTON), evolRMS(0), x_pos(NULL), y_pos(NULL),
48 threshold_RMS(0), p_prec(), G_prec(), KQuasiNewton()
78 Warp->computeCoeff(
p);
104 ct=(int)((IW*(
Nc-1))/255.);
105 cr=(int)((Tij*(
Nc-1))/255.);
106 et=(IW*(
Nc-1))/255.-ct;
107 er=((double)Tij*(
Nc-1))/255.-cr;
111 double *tptemp=
new double[
nbParam];
112 for(
unsigned int it=0;it<
nbParam;it++)
113 tptemp[it] =
dW[0][it]*dx+
dW[1][it]*dy;
116 vpTemplateTrackerMIBSpline::PutTotPVBsplineNoSecond(
PrtTout, cr, er, ct, et,
Nc, tptemp, nbParam,
bspline);
118 vpTemplateTrackerMIBSpline::PutTotPVBspline(
PrtTout, cr, er, ct, et,
Nc, tptemp, nbParam,
bspline);
161 double MI=0,MIprec=-1000;
167 unsigned int iteration=0;
181 Warp->computeCoeff(
p);
182 #ifdef VISP_HAVE_OPENMP
183 int nthreads = omp_get_num_procs() ;
185 omp_set_num_threads(nthreads);
186 #pragma omp parallel for default(shared)
213 int ct=(int)((IW*(
Nc-1))/255.);
214 int cr=(int)((Tij*(
Nc-1))/255.);
215 double et=(IW*(
Nc-1))/255.-ct;
216 double er=((double)Tij*(
Nc-1))/255.-cr;
225 double *tptemp=
new double[
nbParam];;
226 for(
unsigned int it=0;it<
nbParam;it++)
227 tptemp[it] =(
dW[0][it]*dx+
dW[1][it]*dy);
231 vpTemplateTrackerMIBSpline::PutTotPVBsplineNoSecond(
PrtTout, cr, er, ct, et,
Nc, tptemp, nbParam,
bspline);
233 vpTemplateTrackerMIBSpline::PutTotPVBspline(
PrtTout, cr, er, ct, et,
Nc, tptemp, nbParam,
bspline);
282 switch(minimizationMethod)
288 p_test_LMA=
p-100000.1*
dp;
292 double MI_LMA=-
getCost(I,p_test_LMA);
323 double s_scal_y=s_quasi.
t()*y_quasi;
327 if(std::fabs(s_scal_y) > std::numeric_limits<double>::epsilon())
328 KQuasiNewton=KQuasiNewton+0.001*(s_quasi*s_quasi.
t()/s_scal_y-KQuasiNewton*y_quasi*y_quasi.
t()*KQuasiNewton/(y_quasi.
t()*KQuasiNewton*y_quasi));
359 while( (std::fabs(MI-MIprec) > std::fabs(MI)*std::numeric_limits<double>::epsilon()) &&(iteration<
iterationMax)&&(evolRMS>threshold_RMS) );
379 x_pos=
new double[nb_corners];
380 y_pos=
new double[nb_corners];
382 Warp->computeCoeff(pw);
388 for (
unsigned int j=0; j<3; j++) {
391 Warp->computeDenom(
X1,pw);
403 Warp->computeCoeff(pw);
410 for (
unsigned int j=0; j<3; j++) {
413 Warp->computeDenom(
X1,pw);
415 evolRMS+=(x_pos[i*3+j]-
X2[0])*(x_pos[i*3+j]-
X2[0])+(y_pos[i*3+j]-
X2[1])*(y_pos[i*3+j]-
X2[1]);
420 evolRMS=evolRMS/nb_corners;
void initPosEvalRMS(const vpColVector &p)
void computeHessien(vpMatrix &H)
void getTriangle(unsigned int i, vpTemplateTrackerTriangle &T) const
unsigned int getWidth() const
void trackNoPyr(const vpImage< unsigned char > &I)
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
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)
vpHessienApproximationType ApproxHessian
unsigned int templateSize
unsigned int iterationMax
void computeEvalRMS(const vpColVector &p)
Error that can be emited by the vpTracker class and its derivates.
double getCost(const vpImage< unsigned char > &I, const vpColVector &tp)
unsigned int getNbTriangle() const
void computeMI(double &MI)
unsigned int iterationGlobale
vpMatrix HLMdesireInverse
Implementation of column vector and the associated operations.
vpMatrix inverseByLU() const
vpTemplateTrackerZone * zoneTracked
vpTemplateTrackerMIForwardAdditional()
Default constructor.
unsigned int getHeight() const
static void filter(const vpImage< double > &I, vpImage< double > &Iu, vpImage< double > &Iv, const vpMatrix &M, const bool convolve=false)
void initHessienDesired(const vpImage< unsigned char > &I)
vpTemplateTrackerWarp * Warp
static void computeHLM(const vpMatrix &H, const double &alpha, vpMatrix &HLM)
void computeProba(int &nbpoint)
virtual void dWarp(const vpColVector &X1, const vpColVector &X2, const vpColVector &ParamM, vpMatrix &dW)=0
vpHessienType hessianComputation