41 #include <visp3/tt_mi/vpTemplateTrackerMIESM.h> 43 #ifdef VISP_HAVE_OPENMP 48 :
vpTemplateTrackerMI(_warp), minimizationMethod(USE_NEWTON), CompoInitialised(false), HDirect(), HInverse(),
49 HdesireDirect(), HdesireInverse(), GDirect(), GInverse()
54 std::cerr <<
"The selected warp function is not appropriate for the ESM " 62 std::cout <<
"Initialise Hessian at Desired position..." << std::endl;
84 Warp->computeCoeff(
p);
85 for (
unsigned int point = 0; point <
templateSize; point++) {
97 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.
getHeight() - 1) && (j2 < I.
getWidth() - 1)) {
147 Warp->computeCoeff(
p);
148 for (
unsigned int point = 0; point <
templateSize; point++) {
178 double *tptemp =
new double[
nbParam];
179 for (
unsigned int it = 0; it <
nbParam; it++)
180 tptemp[it] = dW[0][it] * dx + dW[1][it] * dy;
235 ptTemplateSupp =
new vpTemplateTrackerPointSuppMIInv[
templateSize];
237 for (
unsigned int point = 0; point <
templateSize; point++) {
253 int ct = (int)((Tij * (
Nc - 1)) / 255.);
254 double et = (Tij * (
Nc - 1)) / 255. - ct;
255 ptTemplateSupp[point].et = et;
256 ptTemplateSupp[point].ct = ct;
257 ptTemplateSupp[point].Bt =
new double[4];
258 ptTemplateSupp[point].dBt =
new double[4];
259 for (
char it = -1; it <= 2; it++) {
260 ptTemplateSupp[point].Bt[it + 1] = vpTemplateTrackerBSpline::Bspline4(-it + et);
261 ptTemplateSupp[point].dBt[it + 1] = vpTemplateTrackerMIBSpline::dBspline4(-it + et);
270 std::cout <<
"Compositionnal tracking no initialised\nUse " 271 "initCompInverse(vpImage<unsigned char> &I) function" 306 unsigned int iteration = 0;
317 Warp->computeCoeff(
p);
330 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.
getHeight() - 1) && (j2 < I.
getWidth() - 1)) {
378 Warp->computeCoeff(
p);
379 #ifdef VISP_HAVE_OPENMP 380 int nthreads = omp_get_num_procs();
383 omp_set_num_threads(nthreads);
384 #pragma omp parallel for private(point, i, j, i2, j2) default(shared) 397 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.
getHeight() - 1) && (j2 < I.
getWidth() - 1)) {
416 double *tptemp =
new double[
nbParam];
417 for (
unsigned int it = 0; it <
nbParam; it++)
418 tptemp[it] = dW[0][it] * dx + dW[1][it] * dy;
virtual void dWarpCompo(const vpColVector &X1, const vpColVector &X2, const vpColVector &ParamM, const double *dwdp0, vpMatrix &dW)=0
void computeHessien(vpMatrix &H)
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 resize(const unsigned int nrows, const unsigned int ncols, const bool flagNullify=true, const bool recopy_=true)
vpTemplateTrackerMIESM()
Default constructor.
vpMatrix inverseByLU() const
void computeOptimalBrentGain(const vpImage< unsigned char > &I, vpColVector &tp, double tMI, vpColVector &direction, double &alpha)
error that can be emited by ViSP classes.
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)
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
Type getValue(double i, double j) const
void trackNoPyr(const vpImage< unsigned char > &I)
vpMinimizationTypeMIESM minimizationMethod
vpMatrix HLMdesireInverse
unsigned int getHeight() const
vpTemplateTrackerPointCompo * ptTemplateCompo
Implementation of column vector and the associated operations.
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)
unsigned int getWidth() const
void computeProba(int &nbpoint)
vpHessienType hessianComputation
void resize(const unsigned int i, const bool flagNullify=true)