38#include <visp3/tt_mi/vpTemplateTrackerMIForwardAdditional.h>
40#ifdef VISP_HAVE_OPENMP
70 Warp->computeCoeff(
p);
71 for (
unsigned int point = 0; point <
templateSize; point++) {
85 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.getHeight() - 1) && (j2 < I.getWidth() - 1)) {
89 IW = I.getValue(i2, j2);
91 IW =
BI.getValue(i2, j2);
93 dx =
dIx.getValue(i2, j2) * (
Nc - 1) / 255.;
94 dy =
dIy.getValue(i2, j2) * (
Nc - 1) / 255.;
96 ct =
static_cast<int>((IW * (
Nc - 1)) / 255.);
97 cr =
static_cast<int>((Tij * (
Nc - 1)) / 255.);
98 et = (IW * (
Nc - 1)) / 255. - ct;
99 er = (
static_cast<double>(Tij) * (
Nc - 1)) / 255. - cr;
102 double *tptemp =
new double[
nbParam];
103 for (
unsigned int it = 0; it <
nbParam; it++)
104 tptemp[it] =
dW[0][it] * dx +
dW[1][it] * dy;
141 double MI = 0, MIprec = -1000;
147 unsigned int iteration = 0;
150 double evolRMS_init = 0;
151 double evolRMS_prec = 0;
152 double evolRMS_delta;
155 if (iteration % 5 == 0)
164 Warp->computeCoeff(
p);
165#ifdef VISP_HAVE_OPENMP
166 int nthreads = omp_get_num_procs();
169 omp_set_num_threads(nthreads);
170#pragma omp parallel for default(shared)
172 for (
int point = 0; point < static_cast<int>(
templateSize); point++) {
184 if ((i2 >= 0) && (j2 >= 0) && (i2 < I.getHeight() - 1) && (j2 < I.getWidth() - 1)) {
189 IW = I.getValue(i2, j2);
191 IW =
BI.getValue(i2, j2);
193 double dx =
dIx.getValue(i2, j2) * (
Nc - 1) / 255.;
194 double dy =
dIy.getValue(i2, j2) * (
Nc - 1) / 255.;
196 int ct =
static_cast<int>((IW * (
Nc - 1)) / 255.);
197 int cr =
static_cast<int>((Tij * (
Nc - 1)) / 255.);
198 double et = (IW * (
Nc - 1)) / 255. - ct;
199 double er = (
static_cast<double>(Tij) * (
Nc - 1)) / 255. - cr;
203 double *tptemp =
new double[
nbParam];
204 for (
unsigned int it = 0; it <
nbParam; it++)
205 tptemp[it] = (
dW[0][it] * dx +
dW[1][it] * dy);
248 switch (minimizationMethod) {
252 p_test_LMA =
p - 100000.1 *
dp;
256 double MI_LMA = -
getCost(I, p_test_LMA);
280 double s_scal_y = s_quasi.
t() * y_quasi;
281 if (std::fabs(s_scal_y) > std::numeric_limits<double>::epsilon()) {
282 KQuasiNewton = KQuasiNewton + 0.001 * (s_quasi * s_quasi.
t() / s_scal_y -
283 KQuasiNewton * y_quasi * y_quasi.
t() * KQuasiNewton /
284 (y_quasi.
t() * KQuasiNewton * y_quasi));
287 dp = -KQuasiNewton *
G;
309 if (iteration == 0) {
315 evolRMS_delta = std::fabs(
evolRMS - evolRMS_prec);
318 }
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)
Definition of the vpImage class member functions.
static void computeHLM(const vpMatrix &H, const double &alpha, vpMatrix &HLM)
vpTemplateTrackerMIForwardAdditional()
Default constructor.
void initHessienDesired(const vpImage< unsigned char > &I)
void trackNoPyr(const vpImage< unsigned char > &I)
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)
vpTemplateTrackerMI(const vpTemplateTrackerMI &)=delete
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 iterationGlobale
unsigned int templateSize
Error that can be emitted by the vpTracker class and its derivatives.
@ notEnoughPointError
Not enough point to track.