Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpTemplateTrackerTriangle.h
1/*
2 * ViSP, open source Visual Servoing Platform software.
3 * Copyright (C) 2005 - 2025 by Inria. All rights reserved.
4 *
5 * This software is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * See the file LICENSE.txt at the root directory of this source
10 * distribution for additional information about the GNU GPL.
11 *
12 * For using ViSP with software that can not be combined with the GNU
13 * GPL, please contact Inria about acquiring a ViSP Professional
14 * Edition License.
15 *
16 * See https://visp.inria.fr for more information.
17 *
18 * This software was developed at:
19 * Inria Rennes - Bretagne Atlantique
20 * Campus Universitaire de Beaulieu
21 * 35042 Rennes Cedex
22 * France
23 *
24 * If you have questions regarding the use of this file, please contact
25 * Inria at visp@inria.fr
26 *
27 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29 *
30 * Description:
31 * Template tracker.
32 *
33 * Authors:
34 * Amaury Dame
35 * Aurelien Yol
36 */
41
42#ifndef vpTemplateTrackerTriangle_hh
43#define vpTemplateTrackerTriangle_hh
44
45#include <assert.h>
46#include <vector>
47
48#include <visp3/core/vpColVector.h>
49#include <visp3/core/vpConfig.h>
50#include <visp3/core/vpImagePoint.h>
51#include <visp3/core/vpMath.h>
52#include <visp3/core/vpMatrix.h>
53#include <visp3/tt/vpTemplateTrackerHeader.h>
54
68{
69protected:
70 double minx_temp;
71 double miny_temp;
75
76 double l_t;
77 double h_t;
78
80 double uvinv00;
81 double uvinv01;
82 double uvinv10;
83 double uvinv11;
85 double area;
86
87private:
88 vpColVector getCorner1() const;
89 vpColVector getCorner2() const;
90 vpColVector getCorner3() const;
91
92public:
95 vpTemplateTrackerTriangle(const vpColVector &c1, const vpColVector &c2, const vpColVector &c3);
96 vpTemplateTrackerTriangle(const vpImagePoint &c1, const vpImagePoint &c2, const vpImagePoint &c3);
97 vpTemplateTrackerTriangle(int x1, int y1, int x2, int y2, int x3, int y3);
98 vpTemplateTrackerTriangle(double x1, double y1, double x2, double y2, double x3, double y3);
99
105 inline double getArea() const { return this->area; }
106
107 vpTemplateTrackerTriangle getPyramidDown() const;
108 void getCorners(vpColVector &c1, vpColVector &c2, vpColVector &c3) const;
109 void getCorners(vpImagePoint &c1, vpImagePoint &c2, vpImagePoint &c3) const;
110 void getCorners(std::vector<vpImagePoint> &c) const;
111
122 vpColVector getCorner(unsigned int i) const
123 {
124 assert(i < 3);
125 if (i == 0)
126 return getCorner1();
127 else if (i == 1)
128 return getCorner2();
129 else /*if(i==2)*/
130 return getCorner3();
131 };
132
141 void getCorner(unsigned int i, double &x, double &y) const
142 {
143 assert(i < 3);
144 if (i == 0) {
145 x = C1.x;
146 y = C1.y;
147 }
148 else if (i == 1) {
149 x = C2.x;
150 y = C2.y;
151 }
152 else /*if(i==2)*/ {
153 x = C3.x;
154 y = C3.y;
155 }
156 };
157
158 double getMaxx() const;
159 double getMaxy() const;
160 double getMinx() const;
161 double getMiny() const;
162
163 void getSize(double &w, double &h) const;
164 void getSize(int &w, int &h) const;
165
166 void init(const vpColVector &c1, const vpColVector &c2, const vpColVector &c3);
167 void init(const vpImagePoint &c1, const vpImagePoint &c2, const vpImagePoint &c3);
168 void init(int x1, int y1, int x2, int y2, int x3, int y3);
169 void init(double x1, double y1, double x2, double y2, double x3, double y3);
170 bool inTriangle(const vpImagePoint &ip) const;
171 bool inTriangle(const int &i, const int &j) const;
172 bool inTriangle(const double &i, const double &j) const;
173
175};
176END_VISP_NAMESPACE
177#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