Visual Servoing Platform version 3.6.0
Loading...
Searching...
No Matches
vpTemplateTrackerTriangle.h
1/****************************************************************************
2 *
3 * ViSP, open source Visual Servoing Platform software.
4 * Copyright (C) 2005 - 2023 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 https://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 *
38*****************************************************************************/
44#ifndef vpTemplateTrackerTriangle_hh
45#define vpTemplateTrackerTriangle_hh
46
47#include <assert.h>
48#include <vector>
49
50#include <visp3/core/vpColVector.h>
51#include <visp3/core/vpImagePoint.h>
52#include <visp3/core/vpMath.h>
53#include <visp3/core/vpMatrix.h>
54#include <visp3/tt/vpTemplateTrackerHeader.h>
55
61{
62protected:
63 double minx_temp;
64 double miny_temp;
68
69 double l_t;
70 double h_t;
71
73 double uvinv00;
74 double uvinv01;
75 double uvinv10;
76 double uvinv11;
78 double area;
79
80private:
81 vpColVector getCorner1() const;
82 vpColVector getCorner2() const;
83 vpColVector getCorner3() const;
84
85public:
88 vpTemplateTrackerTriangle(const vpColVector &c1, const vpColVector &c2, const vpColVector &c3);
89 vpTemplateTrackerTriangle(const vpImagePoint &c1, const vpImagePoint &c2, const vpImagePoint &c3);
90 vpTemplateTrackerTriangle(int x1, int y1, int x2, int y2, int x3, int y3);
91 vpTemplateTrackerTriangle(double x1, double y1, double x2, double y2, double x3, double y3);
92
98 inline double getArea() const { return this->area; }
99
100 vpTemplateTrackerTriangle getPyramidDown() const;
101 void getCorners(vpColVector &c1, vpColVector &c2, vpColVector &c3) const;
102 void getCorners(vpImagePoint &c1, vpImagePoint &c2, vpImagePoint &c3) const;
103 void getCorners(std::vector<vpImagePoint> &c) const;
104
115 vpColVector getCorner(unsigned int i) const
116 {
117 assert(i < 3);
118 if (i == 0)
119 return getCorner1();
120 else if (i == 1)
121 return getCorner2();
122 else /*if(i==2)*/
123 return getCorner3();
124 };
134 void getCorner(unsigned int i, double &x, double &y) const
135 {
136 assert(i < 3);
137 if (i == 0) {
138 x = C1.x;
139 y = C1.y;
140 } else if (i == 1) {
141 x = C2.x;
142 y = C2.y;
143 } else /*if(i==2)*/ {
144 x = C3.x;
145 y = C3.y;
146 }
147 };
148
149 double getMaxx() const;
150 double getMaxy() const;
151 double getMinx() const;
152 double getMiny() const;
153
154 void getSize(double &w, double &h) const;
155 void getSize(int &w, int &h) const;
156
157 void init(const vpColVector &c1, const vpColVector &c2, const vpColVector &c3);
158 void init(const vpImagePoint &c1, const vpImagePoint &c2, const vpImagePoint &c3);
159 void init(int x1, int y1, int x2, int y2, int x3, int y3);
160 void init(double x1, double y1, double x2, double y2, double x3, double y3);
161 bool inTriangle(const vpImagePoint &ip) const;
162 bool inTriangle(const int &i, const int &j) const;
163 bool inTriangle(const double &i, const double &j) const;
164
166};
167#endif
Implementation of column vector and the associated operations.
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
vpColVector getCorner(unsigned int i) const
vpTemplateTrackerDPoint C3
Corner 2.
vpTemplateTrackerDPoint C2
Corner 1.
void getCorner(unsigned int i, double &x, double &y) const