/usr/include/visp/vpTemplateTracker.h is in libvisp-dev 2.9.0-3+b2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | /****************************************************************************
*
* $Id: vpTemplateTracker.h 4648 2014-02-07 13:30:07Z ayol $
*
* This file is part of the ViSP software.
* Copyright (C) 2005 - 2014 by INRIA. All rights reserved.
*
* This software is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* ("GPL") version 2 as published by the Free Software Foundation.
* See the file LICENSE.txt at the root directory of this source
* distribution for additional information about the GNU GPL.
*
* For using ViSP with software that can not be combined with the GNU
* GPL, please contact INRIA about acquiring a ViSP Professional
* Edition License.
*
* See http://www.irisa.fr/lagadic/visp/visp.html for more information.
*
* This software was developed at:
* INRIA Rennes - Bretagne Atlantique
* Campus Universitaire de Beaulieu
* 35042 Rennes Cedex
* France
* http://www.irisa.fr/lagadic
*
* If you have questions regarding the use of this file, please contact
* INRIA at visp@inria.fr
*
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* Description:
* Template tracker.
*
* Authors:
* Amaury Dame
* Aurelien Yol
* Fabien Spindler
*
*****************************************************************************/
/*!
\file vpTemplateTracker.h
\brief
*/
#ifndef vpTemplateTracker_hh
#define vpTemplateTracker_hh
#include <math.h>
#include <visp/vpTemplateTrackerHeader.h>
#include <visp/vpTemplateTrackerZone.h>
#include <visp/vpTemplateTrackerWarp.h>
#include <visp/vpImageFilter.h>
class VISP_EXPORT vpTemplateTracker
{
protected:
//traitement pyramidal
unsigned int nbLvlPyr; // If = 1, disable pyramidal usage
unsigned int l0Pyr;
bool pyrInitialised;
vpTemplateTrackerPoint *ptTemplate;
vpTemplateTrackerPoint **ptTemplatePyr;
bool ptTemplateInit;
unsigned int templateSize;
unsigned int *templateSizePyr;
bool *ptTemplateSelect;
bool **ptTemplateSelectPyr;
bool ptTemplateSelectInit;
unsigned int templateSelectSize;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
vpTemplateTrackerPointSuppMIInv *ptTemplateSupp; //pour inverse et compo
vpTemplateTrackerPointSuppMIInv **ptTemplateSuppPyr; //pour inverse et compo
#endif
vpTemplateTrackerPointCompo *ptTemplateCompo; //pour ESM
vpTemplateTrackerPointCompo **ptTemplateCompoPyr; //pour ESM
vpTemplateTrackerZone *zoneTracked;
vpTemplateTrackerZone *zoneTrackedPyr;
vpImage<unsigned char> *pyr_IDes;
vpMatrix H;
vpMatrix Hdesire;
vpMatrix *HdesirePyr;
vpMatrix HLM;
vpMatrix HLMdesire;
vpMatrix *HLMdesirePyr;
vpMatrix HLMdesireInverse;
vpMatrix *HLMdesireInversePyr;
vpColVector G;
double gain;
double thresholdGradient;
bool costFunctionVerification;
bool blur;
bool useBrent;
unsigned int nbIterBrent;
unsigned int taillef;
double *fgG;
double *fgdG;
double ratioPixelIn;
int mod_i;
int mod_j;//variable de sampling de zone de reference
unsigned int nbParam ;
double lambdaDep ;
unsigned int iterationMax ;
//pour BFGS
unsigned int iterationGlobale;
//diverge is set to true if there is no more point in the tracked area
bool diverge;
unsigned int nbIteration;
bool useCompositionnal;
bool useInverse;
vpTemplateTrackerWarp *Warp;
//Parametre de deplacement
vpColVector p;
vpColVector dp;
//temporary values for warping
vpColVector X1;
vpColVector X2;
//temporary derivative matrix
vpMatrix dW;
vpImage<double> BI;
vpImage<double> dIx ;
vpImage<double> dIy ;
vpTemplateTrackerZone zoneRef_; // Reference zone
public:
vpTemplateTracker(vpTemplateTrackerWarp *_warp);
virtual ~vpTemplateTracker();
void display(const vpImage<unsigned char> &I, const vpColor& col = vpColor::green, const unsigned int thickness=3);
void display(const vpImage<vpRGBa> &I, const vpColor& col = vpColor::green, const unsigned int thickness=3);
bool getDiverge() const {return diverge;}
vpColVector getdp(){ return dp; }
vpColVector getG() const { return G; }
vpMatrix getH() const { return H; }
unsigned int getNbParam() const { return nbParam ; }
unsigned int getNbIteration() const { return nbIteration; }
vpColVector getp() const { return p;}
double getRatioPixelIn() const {return ratioPixelIn;}
/*!
\return The pointer to the warper.
*/
vpTemplateTrackerWarp *getWarp() const {return Warp;}
/*!
Return the reference template zone.
*/
vpTemplateTrackerZone getZoneRef() const { return zoneRef_; }
void initClick(const vpImage<unsigned char> &I, bool delaunay=false);
void initFromPoints(const vpImage<unsigned char> &I, const std::vector< vpImagePoint > &v_ip, bool delaunay=false);
void initFromZone(const vpImage<unsigned char> &I, const vpTemplateTrackerZone& zone);
void resetTracker();
void setBlur(bool b){blur = b;}
void setCostFunctionVerification(bool b){costFunctionVerification = b;}
void setGain(double g){gain=g;}
void setGaussianFilterSize(unsigned int new_taill);
void setHDes(vpMatrix &tH){ Hdesire=tH; vpMatrix::computeHLM(Hdesire,lambdaDep,HLMdesire); HLMdesireInverse = HLMdesire.inverseByLU();}
void setIterationMax(const unsigned int &n) { iterationMax = n ; }
void setLambda(double l) { lambdaDep = l ; }
void setNbIterBrent(const unsigned int &b){nbIterBrent=b;}
void setp(const vpColVector &tp){ p=tp; diverge=false; iterationGlobale=0; }
/*!
Set the number of pyramid levels used in the multi-resolution scheme.
If \e nlevels > 1, the tracker uses a pyramidal approach.
\param nlevels: Number of pyramid levels. Algorithm starts at level nlevels-1.
\param level_to_stop: Last level of the pyramid that will be considered. (Lowest level is Zero)
*/
void setPyramidal(unsigned int nlevels=2, unsigned int level_to_stop=1) {
nbLvlPyr = nlevels;
l0Pyr = level_to_stop;
if(l0Pyr >= nlevels){
std::cout << "Warning: level_to_stop: " << level_to_stop << " higher than level_to_start: " << nlevels-1 << " (nlevels-1)" <<std::endl;
std::cout << "Level to stop put to: " << nlevels-1 << std::endl;
l0Pyr = nlevels-1;
}
}
void setSampling(int _mod_i,int _mod_j){mod_i=_mod_i;mod_j=_mod_j;}
void setThresholdGradient(double threshold){thresholdGradient=threshold;}
/*! By default Brent usage is disabled. */
void setUseBrent(bool b){useBrent = b;}
void track(const vpImage<unsigned char> &I);
void trackRobust(const vpImage<unsigned char> &I);
protected:
void computeOptimalBrentGain(const vpImage<unsigned char> &I,vpColVector &tp,double tMI,vpColVector &direction,double &alpha);
virtual double getCost(const vpImage<unsigned char> &I, vpColVector &tp) = 0;
void getGaussianBluredImage(const vpImage<unsigned char> &I){ vpImageFilter::filter(I, BI,fgG,taillef); }
void initCompInverse(const vpImage<unsigned char> &I);
virtual void initCompInversePyr(const vpImage<unsigned char> &I);
virtual void initHessienDesired(const vpImage<unsigned char> &I)=0;
virtual void initHessienDesiredPyr(const vpImage<unsigned char> &I);
virtual void initPyramidal(unsigned int nbLvl,unsigned int l0);
void initTracking(const vpImage<unsigned char>& I,vpTemplateTrackerZone &zone);
virtual void initTrackingPyr(const vpImage<unsigned char>& I,vpTemplateTrackerZone &zone);
virtual void trackNoPyr(const vpImage<unsigned char> &I) = 0;
virtual void trackPyr(const vpImage<unsigned char> &I);
};
#endif
|