Visual Servoing Platform version 3.5.0
vpTemplateTrackerTriangle.h
1/****************************************************************************
2 *
3 * ViSP, open source Visual Servoing Platform software.
4 * Copyright (C) 2005 - 2019 by Inria. All rights reserved.
5 *
6 * This software is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 * See the file LICENSE.txt at the root directory of this source
11 * distribution for additional information about the GNU GPL.
12 *
13 * For using ViSP with software that can not be combined with the GNU
14 * GPL, please contact Inria about acquiring a ViSP Professional
15 * Edition License.
16 *
17 * See http://visp.inria.fr for more information.
18 *
19 * This software was developed at:
20 * Inria Rennes - Bretagne Atlantique
21 * Campus Universitaire de Beaulieu
22 * 35042 Rennes Cedex
23 * France
24 *
25 * If you have questions regarding the use of this file, please contact
26 * Inria at visp@inria.fr
27 *
28 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30 *
31 * Description:
32 * Template tracker.
33 *
34 * Authors:
35 * Amaury Dame
36 * Aurelien Yol
37 * Fabien Spindler
38 *
39 *****************************************************************************/
45#ifndef vpTemplateTrackerTriangle_hh
46#define vpTemplateTrackerTriangle_hh
47
48#include <assert.h>
49#include <vector>
50
51#include <visp3/core/vpColVector.h>
52#include <visp3/core/vpImagePoint.h>
53#include <visp3/core/vpMath.h>
54#include <visp3/core/vpMatrix.h>
55#include <visp3/tt/vpTemplateTrackerHeader.h>
56
62{
63protected:
64 double minx_temp;
65 double miny_temp;
69
70 double l_t;
71 double h_t;
72
74 double uvinv00;
75 double uvinv01;
76 double uvinv10;
77 double uvinv11;
79 double area;
80
81private:
82 vpColVector getCorner1() const;
83 vpColVector getCorner2() const;
84 vpColVector getCorner3() const;
85
86public:
89 vpTemplateTrackerTriangle(const vpColVector &c1, const vpColVector &c2, const vpColVector &c3);
90 vpTemplateTrackerTriangle(const vpImagePoint &c1, const vpImagePoint &c2, const vpImagePoint &c3);
91 vpTemplateTrackerTriangle(int x1, int y1, int x2, int y2, int x3, int y3);
92 vpTemplateTrackerTriangle(double x1, double y1, double x2, double y2, double x3, double y3);
93
99 inline double getArea() const { return this->area; }
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 {
118 assert(i < 3);
119 if (i == 0)
120 return getCorner1();
121 else if (i == 1)
122 return getCorner2();
123 else /*if(i==2)*/
124 return getCorner3();
125 };
135 void getCorner(unsigned int i, double &x, double &y) const
136 {
137 assert(i < 3);
138 if (i == 0) {
139 x = C1.x;
140 y = C1.y;
141 } else if (i == 1) {
142 x = C2.x;
143 y = C2.y;
144 } else /*if(i==2)*/ {
145 x = C3.x;
146 y = C3.y;
147 }
148 };
149
150 double getMaxx() const;
151 double getMaxy() const;
152 double getMinx() const;
153 double getMiny() const;
154
155 void getSize(double &w, double &h) const;
156 void getSize(int &w, int &h) const;
157
158 void init(const vpColVector &c1, const vpColVector &c2, const vpColVector &c3);
159 void init(const vpImagePoint &c1, const vpImagePoint &c2, const vpImagePoint &c3);
160 void init(int x1, int y1, int x2, int y2, int x3, int y3);
161 void init(double x1, double y1, double x2, double y2, double x3, double y3);
162 bool inTriangle(const vpImagePoint &ip) const;
163 bool inTriangle(const int &i, const int &j) const;
164 bool inTriangle(const double &i, const double &j) const;
165
167};
168#endif
Implementation of column vector and the associated operations.
Definition: vpColVector.h:131
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:88
vpColVector getCorner(unsigned int i) const
vpTemplateTrackerDPoint C3
Corner 2.
vpTemplateTrackerDPoint C2
Corner 1.
void getCorner(unsigned int i, double &x, double &y) const