ViSP  2.9.0
vpTemplateTrackerTriangle.h
1 /****************************************************************************
2  *
3  * $Id: vpTemplateTrackerTriangle.h 4636 2014-02-04 08:17:58Z 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 
78  private:
79  vpColVector getCorner1() const;
80  vpColVector getCorner2() const;
81  vpColVector getCorner3() const;
82 
83  public:
86  vpTemplateTrackerTriangle(const vpColVector &c1, const vpColVector &c2, const vpColVector &c3);
87  vpTemplateTrackerTriangle(const vpImagePoint &c1, const vpImagePoint &c2, const vpImagePoint &c3);
88  vpTemplateTrackerTriangle(int x1, int y1, int x2, int y2, int x3, int y3);
89  vpTemplateTrackerTriangle(double x1, double y1, double x2, double y2, double x3, double y3);
90 
91  vpTemplateTrackerTriangle getPyramidDown() const;
92  void getCorners(vpColVector &c1,vpColVector &c2,vpColVector &c3) const;
93  void getCorners(vpImagePoint &c1, vpImagePoint &c2, vpImagePoint &c3) const;
94  void getCorners(std::vector<vpImagePoint> &c) const;
95 
106  vpColVector getCorner(unsigned int i) const {
107  assert(i<3);
108  if(i==0) return getCorner1();
109  else if(i==1) return getCorner2();
110  else /*if(i==2)*/ return getCorner3();
111  };
120  void getCorner(unsigned int i, double &x, double &y) const {
121  assert(i<3);
122  if(i==0) {
123  x = C1.x;
124  y = C1.y;
125  }
126  else if(i==1) {
127  x = C2.x;
128  y = C2.y;
129  }
130  else /*if(i==2)*/ {
131  x = C3.x;
132  y = C3.y;
133  }
134  };
135 
136  double getMaxx() const;
137  double getMaxy() const;
138  double getMinx() const;
139  double getMiny() const;
140 
141  void getSize(double &w, double &h) const;
142  void getSize(int &w, int &h) const;
143 
144  void init(const vpColVector &c1,const vpColVector &c2,const vpColVector &c3);
145  void init(const vpImagePoint &c1, const vpImagePoint &c2, const vpImagePoint &c3);
146  void init(int x1,int y1, int x2,int y2, int x3,int y3);
147  void init(double x1,double y1, double x2,double y2, double x3,double y3);
148  bool inTriangle(const vpImagePoint &ip) const;
149  bool inTriangle(const int &i, const int &j) const;
150  bool inTriangle(const double &i,const double &j) const;
151 
153 };
154 #endif
155 
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:92