40 #include <visp3/tt_mi/vpTemplateTrackerMIForwardCompositional.h> 49 std::cout <<
"Initialise precomputed value of Compositionnal Direct" << std::endl;
50 ptTemplateSupp =
new vpTemplateTrackerPointSuppMIInv[
templateSize];
51 for (
unsigned int point = 0; point <
templateSize; point++) {
61 int ct = (int)((Tij * (
Nc - 1)) / 255.);
62 double et = (Tij * (
Nc - 1)) / 255. - ct;
63 ptTemplateSupp[point].et = et;
64 ptTemplateSupp[point].ct = ct;
65 ptTemplateSupp[point].Bt =
new double[4];
66 ptTemplateSupp[point].dBt =
new double[4];
67 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);
100 Warp->computeCoeff(
p);
101 for (
unsigned int point = 0; point <
templateSize; point++) {
113 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.
getHeight() - 1) && (j2 < I.
getWidth() - 1)) {
124 cr = ptTemplateSupp[point].ct;
125 er = ptTemplateSupp[point].et;
126 ct = (int)((IW * (
Nc - 1)) / 255.);
127 et = ((double)IW * (
Nc - 1)) / 255. - ct;
131 double *tptemp =
new double[
nbParam];
132 for (
unsigned int it = 0; it <
nbParam; it++)
133 tptemp[it] = dW[0][it] * dx + dW[1][it] * dy;
138 vpTemplateTrackerMIBSpline::PutTotPVBspline(
PrtTout, cr, er, ct, et,
Nc, tptemp, nbParam,
bspline);
159 std::cout <<
"Compositionnal tracking no initialised\nUse " 160 "initCompo(vpImage<unsigned char> &I) function" 172 double MI = 0, MIprec = -1000;
188 unsigned int iteration = 0;
197 Warp->computeCoeff(
p);
199 for (
unsigned int point = 0; point <
templateSize; point++) {
209 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.
getHeight() - 1) && (j2 < I.
getWidth() - 1)) {
220 ct = (int)((IW * (
Nc - 1)) / 255.);
221 et = ((double)IW * (
Nc - 1)) / 255. - ct;
222 cr = ptTemplateSupp[point].ct;
223 er = ptTemplateSupp[point].et;
227 double *tptemp =
new double[
nbParam];
228 for (
unsigned int it = 0; it <
nbParam; it++)
229 tptemp[it] = dW[0][it] * dx + dW[1][it] * dy;
235 vpTemplateTrackerMIBSpline::PutTotPVBsplineNoSecond(
PrtTout, cr, er, ct, et,
Nc, tptemp, nbParam,
bspline);
237 vpTemplateTrackerMIBSpline::PutTotPVBspline(
PrtTout, cr, er, ct, et,
Nc, tptemp, nbParam,
bspline);
291 }
while ((std::fabs(MI - MIprec) > std::fabs(MI) * std::numeric_limits<double>::epsilon()) &&
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)
vpTemplateTrackerPoint * ptTemplate
virtual void warpX(const int &i, const int &j, double &i2, double &j2, const vpColVector &ParamM)=0
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
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)
Type getValue(double i, double j) const
vpMatrix HLMdesireInverse
unsigned int getHeight() const
Implementation of column vector and the associated operations.
void trackNoPyr(const vpImage< unsigned char > &I)
vpTemplateTrackerMIForwardCompositional(vpTemplateTrackerWarp *_warp)
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