ViSP  2.10.0
vpTemplateTrackerWarpTranslation.cpp
1 /****************************************************************************
2  *
3  * $Id: vpTemplateTrackerWarpTranslation.cpp 4649 2014-02-07 14:57:11Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2014 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  * Description:
34  * Template tracker.
35  *
36  * Authors:
37  * Amaury Dame
38  * Aurelien Yol
39  * Fabien Spindler
40  *
41  *****************************************************************************/
42 #include <visp/vpTemplateTrackerWarpTranslation.h>
43 
45 {
46  nbParam = 2 ;
47  dW.resize(2,nbParam);
48 }
49 
50 
51 //get the parameter corresponding to the lower level of a gaussian pyramid
53 {
54  pdown[0]=p[0]/2.;
55  pdown[1]=p[1]/2.;
56 }
57 
59 {
60  pup[0]=p[0]*2.;
61  pup[1]=p[1]*2.;
62 }
63 
64 /*calcul de di*dw(x,p0)/dp
65 */
66 void vpTemplateTrackerWarpTranslation::getdW0(const int &/*i*/,const int &/*j*/,const double &dy,const double &dx,double *dIdW)
67 {
68  dIdW[0]=dx;
69  dIdW[1]=dy;
70 }
71 /*calcul de dw(x,p0)/dp
72 */
73 void vpTemplateTrackerWarpTranslation::getdWdp0(const int &/*i*/,const int &/*j*/,double *dIdW)
74 {
75  dIdW[0]=1.;
76  dIdW[1]=0;
77 
78  dIdW[2]=0;
79  dIdW[3]=1.;
80 }
81 
82 void vpTemplateTrackerWarpTranslation::warpX(const int &i,const int &j,double &i2,double &j2,const vpColVector &ParamM)
83 {
84  j2=j+ParamM[0];
85  i2=i+ParamM[1];
86 }
87 
88 
90 {
91  vXres[0]=vX[0]+ParamM[0];
92  vXres[1]=vX[1]+ParamM[1];
93 }
94 
95 void vpTemplateTrackerWarpTranslation::dWarp(const vpColVector &/*X1*/,const vpColVector &/*X2*/,const vpColVector &/*ParamM*/,
96  vpMatrix &dW_)
97 {
98  dW_[0][0]=1;dW_[0][1]=0;
99  dW_[1][0]=0;dW_[1][1]=1;
100 }
101 
102 /*compute dw=dw/dx*dw/dp
103 */
104 void vpTemplateTrackerWarpTranslation::dWarpCompo(const vpColVector &/*X1*/,const vpColVector &/*X2*/,const vpColVector &/*ParamM*/,
105  const double *dwdp0,vpMatrix &dW_)
106 {
107  for(unsigned int i=0;i<nbParam;i++)
108  {
109  dW_[0][i]=dwdp0[i];
110  dW_[1][i]=dwdp0[i+nbParam];
111  }
112 }
113 
115 {
116  vXres[0]=vX[0]+ParamM[0];
117  vXres[1]=vX[1]+ParamM[1];
118 }
120 {
121  ParamMinv[0]=-ParamM[0];
122  ParamMinv[1]=-ParamM[1];
123 }
124 
126 {
127  pres[0]=p1[0]+p2[0];
128  pres[1]=p1[1]+p2[1];
129 }
Definition of the vpMatrix class.
Definition: vpMatrix.h:98
void resize(const unsigned int nrows, const unsigned int ncols, const bool nullify=true)
Definition: vpMatrix.cpp:199
void getParamPyramidDown(const vpColVector &p, vpColVector &pdown)
void getParamPyramidUp(const vpColVector &p, vpColVector &pup)
void getdW0(const int &i, const int &j, const double &dy, const double &dx, double *dIdW)
void warpXInv(const vpColVector &vX, vpColVector &vXres, const vpColVector &ParamM)
void dWarp(const vpColVector &X1, const vpColVector &X2, const vpColVector &ParamM, vpMatrix &dW)
Class that provides a data structure for the column vectors as well as a set of operations on these v...
Definition: vpColVector.h:72
void pRondp(const vpColVector &p1, const vpColVector &p2, vpColVector &pres) const
void warpX(const vpColVector &vX, vpColVector &vXres, const vpColVector &ParamM)
void dWarpCompo(const vpColVector &X1, const vpColVector &X2, const vpColVector &ParamM, const double *dwdp0, vpMatrix &dW)
void getParamInverse(const vpColVector &ParamM, vpColVector &ParamMinv) const
void getdWdp0(const int &i, const int &j, double *dIdW)