ViSP  2.10.0
vpTemplateTrackerTriangle.h
1 /****************************************************************************
2  *
3  * $Id: vpTemplateTrackerTriangle.h 4781 2014-07-15 13:03: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  *****************************************************************************/
47 #ifndef vpTemplateTrackerTriangle_hh
48 #define vpTemplateTrackerTriangle_hh
49 
50 #include <assert.h>
51 #include <vector>
52 
53 #include <visp/vpMatrix.h>
54 #include <visp/vpMath.h>
55 #include <visp/vpColVector.h>
56 #include <visp/vpImagePoint.h>
57 #include <visp/vpTemplateTrackerHeader.h>
58 
59 class VISP_EXPORT vpTemplateTrackerTriangle
60 {
61  protected:
62  double minx_temp;
63  double miny_temp;
67 
68  double l_t;
69  double h_t;
70 
71  bool not_good;
72  double uvinv00;
73  double uvinv01;
74  double uvinv10;
75  double uvinv11;
77  double area;
78 
79  private:
80  vpColVector getCorner1() const;
81  vpColVector getCorner2() const;
82  vpColVector getCorner3() const;
83 
84  public:
87  vpTemplateTrackerTriangle(const vpColVector &c1, const vpColVector &c2, const vpColVector &c3);
88  vpTemplateTrackerTriangle(const vpImagePoint &c1, const vpImagePoint &c2, const vpImagePoint &c3);
89  vpTemplateTrackerTriangle(int x1, int y1, int x2, int y2, int x3, int y3);
90  vpTemplateTrackerTriangle(double x1, double y1, double x2, double y2, double x3, double y3);
91 
97  inline double getArea() const{
98  return this->area;
99  }
100 
101  vpTemplateTrackerTriangle getPyramidDown() const;
102  void getCorners(vpColVector &c1,vpColVector &c2,vpColVector &c3) const;
103  void getCorners(vpImagePoint &c1, vpImagePoint &c2, vpImagePoint &c3) const;
104  void getCorners(std::vector<vpImagePoint> &c) const;
105 
116  vpColVector getCorner(unsigned int i) const {
117  assert(i<3);
118  if(i==0) return getCorner1();
119  else if(i==1) return getCorner2();
120  else /*if(i==2)*/ return getCorner3();
121  };
130  void getCorner(unsigned int i, double &x, double &y) const {
131  assert(i<3);
132  if(i==0) {
133  x = C1.x;
134  y = C1.y;
135  }
136  else if(i==1) {
137  x = C2.x;
138  y = C2.y;
139  }
140  else /*if(i==2)*/ {
141  x = C3.x;
142  y = C3.y;
143  }
144  };
145 
146  double getMaxx() const;
147  double getMaxy() const;
148  double getMinx() const;
149  double getMiny() const;
150 
151  void getSize(double &w, double &h) const;
152  void getSize(int &w, int &h) const;
153 
154  void init(const vpColVector &c1,const vpColVector &c2,const vpColVector &c3);
155  void init(const vpImagePoint &c1, const vpImagePoint &c2, const vpImagePoint &c3);
156  void init(int x1,int y1, int x2,int y2, int x3,int y3);
157  void init(double x1,double y1, double x2,double y2, double x3,double y3);
158  bool inTriangle(const vpImagePoint &ip) const;
159  bool inTriangle(const int &i, const int &j) const;
160  bool inTriangle(const double &i,const double &j) const;
161 
163 };
164 #endif
165 
void getCorner(unsigned int i, double &x, double &y) const
vpColVector getCorner(unsigned int i) const
vpTemplateTrackerDPoint C2
Corner 1.
vpTemplateTrackerDPoint C3
Corner 2.
Class that provides a data structure for the column vectors as well as a set of operations on these v...
Definition: vpColVector.h:72
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:93