39 #include <visp3/tt_mi/vpTemplateTrackerMIForwardCompositional.h>
48 ptTemplateSupp =
new vpTemplateTrackerPointSuppMIInv[
templateSize];
49 for (
unsigned int point = 0; point <
templateSize; point++) {
59 int ct = (int)((Tij * (
Nc - 1)) / 255.);
60 double et = (Tij * (
Nc - 1)) / 255. - ct;
61 ptTemplateSupp[point].et = et;
62 ptTemplateSupp[point].ct = ct;
63 ptTemplateSupp[point].Bt =
new double[4];
64 ptTemplateSupp[point].dBt =
new double[4];
65 for (
char it = -1; it <= 2; it++) {
66 ptTemplateSupp[point].Bt[it + 1] = vpTemplateTrackerBSpline::Bspline4(-it + et);
67 ptTemplateSupp[point].dBt[it + 1] = vpTemplateTrackerMIBSpline::dBspline4(-it + et);
93 Warp->computeCoeff(
p);
94 for (
unsigned int point = 0; point <
templateSize; point++) {
106 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.
getHeight() - 1) && (j2 < I.
getWidth() - 1)) {
116 cr = ptTemplateSupp[point].ct;
117 er = ptTemplateSupp[point].et;
118 ct = (int)((IW * (
Nc - 1)) / 255.);
119 et = ((double)IW * (
Nc - 1)) / 255. - ct;
123 double *tptemp =
new double[
nbParam];
124 for (
unsigned int it = 0; it <
nbParam; it++)
125 tptemp[it] =
dW[0][it] * dx +
dW[1][it] * dy;
146 std::cout <<
"Compositionnal tracking not initialised.\nUse initCompo() function." << std::endl;
157 double MI = 0, MIprec = -1000;
173 unsigned int iteration = 0;
175 double evolRMS_init = 0;
176 double evolRMS_prec = 0;
177 double evolRMS_delta;
186 Warp->computeCoeff(
p);
188 for (
unsigned int point = 0; point <
templateSize; point++) {
198 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.
getHeight() - 1) && (j2 < I.
getWidth() - 1)) {
208 ct = (int)((IW * (
Nc - 1)) / 255.);
209 et = ((double)IW * (
Nc - 1)) / 255. - ct;
210 cr = ptTemplateSupp[point].ct;
211 er = ptTemplateSupp[point].et;
215 double *tptemp =
new double[
nbParam];
216 for (
unsigned int it = 0; it <
nbParam; it++)
217 tptemp[it] =
dW[0][it] * dx +
dW[1][it] * dy;
275 if (iteration == 0) {
281 evolRMS_delta = std::fabs(
evolRMS - evolRMS_prec);
284 }
while ((std::fabs(MI - MIprec) > std::fabs(MI) * std::numeric_limits<double>::epsilon()) &&
Implementation of column vector and the associated operations.
error that can be emitted by ViSP classes.
static void getGradXGauss2D(const vpImage< ImageType > &I, vpImage< FilterType > &dIx, const FilterType *gaussianKernel, const FilterType *gaussianDerivativeKernel, unsigned int size, const vpImage< bool > *p_mask=nullptr)
static void filter(const vpImage< ImageType > &I, vpImage< FilterType > &If, const vpArray2D< FilterType > &M, bool convolve=false, const vpImage< bool > *p_mask=nullptr)
static void getGradYGauss2D(const vpImage< ImageType > &I, vpImage< FilterType > &dIy, const FilterType *gaussianKernel, const FilterType *gaussianDerivativeKernel, unsigned int size, const vpImage< bool > *p_mask=nullptr)
unsigned int getWidth() const
Type getValue(unsigned int i, unsigned int j) const
unsigned int getHeight() const
double cond(double svThreshold=1e-6) const
vpMatrix inverseByLU() const
static void computeHLM(const vpMatrix &H, const double &alpha, vpMatrix &HLM)
void trackNoPyr(const vpImage< unsigned char > &I)
void initHessienDesired(const vpImage< unsigned char > &I)
VP_EXPLICIT vpTemplateTrackerMIForwardCompositional(vpTemplateTrackerWarp *_warp)
vpHessienApproximationType ApproxHessian
vpHessienType hessianComputation
double getCost(const vpImage< unsigned char > &I, const vpColVector &tp) VP_OVERRIDE
void computeMI(double &MI)
void computeProba(int &nbpoint)
void computeHessien(vpMatrix &H)
virtual void dWarpCompo(const vpColVector &X1, const vpColVector &X2, const vpColVector &p, const double *dwdp0, vpMatrix &dM)=0
virtual void getdWdp0(const int &v, const int &u, double *dIdW)=0
virtual void warpX(const int &v1, const int &u1, double &v2, double &u2, const vpColVector &p)=0
virtual void pRondp(const vpColVector &p1, const vpColVector &p2, vpColVector &p12) const =0
vpMatrix HLMdesireInverse
void computeEvalRMS(const vpColVector &p)
void computeOptimalBrentGain(const vpImage< unsigned char > &I, vpColVector &tp, double tMI, vpColVector &direction, double &alpha)
unsigned int iterationMax
void initPosEvalRMS(const vpColVector &p)
vpTemplateTrackerPoint * ptTemplate
vpTemplateTrackerWarp * Warp
unsigned int templateSize
Error that can be emitted by the vpTracker class and its derivatives.
@ notEnoughPointError
Not enough point to track.