40 #include <visp3/tt_mi/vpTemplateTrackerMIForwardCompositional.h> 49 ptTemplateSupp =
new vpTemplateTrackerPointSuppMIInv[
templateSize];
50 for (
unsigned int point = 0; point <
templateSize; point++) {
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++) {
67 ptTemplateSupp[point].Bt[it + 1] = vpTemplateTrackerBSpline::Bspline4(-it + et);
68 ptTemplateSupp[point].dBt[it + 1] = vpTemplateTrackerMIBSpline::dBspline4(-it + et);
94 Warp->computeCoeff(
p);
95 for (
unsigned int point = 0; point <
templateSize; point++) {
107 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.
getHeight() - 1) && (j2 < I.
getWidth() - 1)) {
117 cr = ptTemplateSupp[point].ct;
118 er = ptTemplateSupp[point].et;
119 ct = (int)((IW * (
Nc - 1)) / 255.);
120 et = ((double)IW * (
Nc - 1)) / 255. - ct;
124 double *tptemp =
new double[
nbParam];
125 for (
unsigned int it = 0; it <
nbParam; it++)
126 tptemp[it] = dW[0][it] * dx + dW[1][it] * dy;
128 vpTemplateTrackerMIBSpline::PutTotPVBspline(
PrtTout, cr, er, ct, et,
Nc, tptemp, nbParam,
bspline);
147 std::cout <<
"Compositionnal tracking not initialised.\nUse initCompo() function." << std::endl;
158 double MI = 0, MIprec = -1000;
174 unsigned int iteration = 0;
176 double evolRMS_init = 0;
177 double evolRMS_prec = 0;
178 double evolRMS_delta;
187 Warp->computeCoeff(
p);
189 for (
unsigned int point = 0; point <
templateSize; point++) {
199 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.
getHeight() - 1) && (j2 < I.
getWidth() - 1)) {
209 ct = (int)((IW * (
Nc - 1)) / 255.);
210 et = ((double)IW * (
Nc - 1)) / 255. - ct;
211 cr = ptTemplateSupp[point].ct;
212 er = ptTemplateSupp[point].et;
216 double *tptemp =
new double[
nbParam];
217 for (
unsigned int it = 0; it <
nbParam; it++)
218 tptemp[it] = dW[0][it] * dx + dW[1][it] * dy;
221 vpTemplateTrackerMIBSpline::PutTotPVBsplineNoSecond(
PrtTout, cr, er, ct, et,
Nc, tptemp, nbParam,
bspline);
223 vpTemplateTrackerMIBSpline::PutTotPVBspline(
PrtTout, cr, er, ct, et,
Nc, tptemp, nbParam,
bspline);
274 if (iteration == 0) {
280 evolRMS_delta = std::fabs(
evolRMS - evolRMS_prec);
283 }
while ((std::fabs(MI - MIprec) > std::fabs(MI) * std::numeric_limits<double>::epsilon()) &&
virtual void warpX(const int &v1, const int &u1, double &v2, double &u2, const vpColVector &p)=0
void computeHessien(vpMatrix &H)
void initHessienDesired(const vpImage< unsigned char > &I)
Type getValue(unsigned int i, unsigned int j) const
vpTemplateTrackerPoint * ptTemplate
vpMatrix inverseByLU() const
void computeOptimalBrentGain(const vpImage< unsigned char > &I, vpColVector &tp, double tMI, vpColVector &direction, double &alpha)
virtual void dWarpCompo(const vpColVector &X1, const vpColVector &X2, const vpColVector &p, const double *dwdp0, vpMatrix &dM)=0
error that can be emited by ViSP classes.
void initPosEvalRMS(const vpColVector &p)
static void getGradYGauss2D(const vpImage< unsigned char > &I, vpImage< double > &dIy, const double *gaussianKernel, const double *gaussianDerivativeKernel, unsigned int size)
void computeEvalRMS(const vpColVector &p)
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
double cond(double svThreshold=1e-6) const
virtual void getdWdp0(const int &v, const int &u, double *dIdW)=0
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 computeMI(double &MI)
virtual void pRondp(const vpColVector &p1, const vpColVector &p2, vpColVector &p12) const =0
static void filter(const vpImage< double > &I, vpImage< double > &Iu, vpImage< double > &Iv, const vpMatrix &M, bool convolve=false)
vpMatrix HLMdesireInverse
unsigned int getHeight() const
Implementation of column vector and the associated operations.
void trackNoPyr(const vpImage< unsigned char > &I)
vpTemplateTrackerMIForwardCompositional(vpTemplateTrackerWarp *_warp)
vpTemplateTrackerWarp * Warp
static void computeHLM(const vpMatrix &H, const double &alpha, vpMatrix &HLM)
unsigned int getWidth() const
void computeProba(int &nbpoint)
vpHessienType hessianComputation