Visual Servoing Platform version 3.6.0
Loading...
Searching...
No Matches
vpMbtDistanceLine.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 * Manage the line of a polygon used in the model-based tracker.
33 *
34 * Authors:
35 * Romain Tallonneau
36 *
37*****************************************************************************/
38
44#ifndef vpMbtDistanceLine_HH
45#define vpMbtDistanceLine_HH
46
47#include <visp3/core/vpHomogeneousMatrix.h>
48#include <visp3/core/vpLine.h>
49#include <visp3/core/vpPoint.h>
50#include <visp3/core/vpUniRand.h>
51#include <visp3/mbt/vpMbHiddenFaces.h>
52#include <visp3/mbt/vpMbtMeLine.h>
53#include <visp3/visual_features/vpFeatureLine.h>
54
55#include <list>
56
65class VISP_EXPORT vpMbtDistanceLine
66{
67private:
68 std::string name;
69 unsigned int index;
71 vpMe *me;
72 bool isTrackedLine;
73 bool isTrackedLineWithVisibility;
74 double wmean;
75 vpFeatureLine featureline;
77 vpMbtPolygon poly;
78
79public:
83 // vpMbtMeLine *meline;
84 std::vector<vpMbtMeLine *> meline;
96 // unsigned int nbFeature;
97 std::vector<unsigned int> nbFeature;
99 unsigned int nbFeatureTotal;
101 bool Reinit;
105 std::list<int> Lindex_polygon;
108 std::vector<bool> Lindex_polygon_tracked;
111
112 // private:
113 //#ifndef DOXYGEN_SHOULD_SKIP_THIS
114 // vpMbtDistanceLine(const vpMbtDistanceLine &)
115 // : name(), index(0), cam(), me(NULL), isTrackedLine(true),
116 // isTrackedLineWithVisibility(true),
117 // wmean(1), featureline(), poly(), useScanLine(false), meline(),
118 // line(NULL), p1(NULL), p2(NULL), L(), error(), nbFeature(),
119 // nbFeatureTotal(0), Reinit(false), hiddenface(NULL),
120 // Lindex_polygon(), Lindex_polygon_tracked(), isvisible(false)
121 // {
122 // throw vpException(vpException::functionNotImplementedError, "Not
123 // implemented!");
124 // }
125 // vpMbtDistanceLine &operator=(const vpMbtDistanceLine &){
126 // throw vpException(vpException::functionNotImplementedError, "Not
127 // implemented!"); return *this;
128 // }
129 //#endif
130
131public:
133 virtual ~vpMbtDistanceLine();
134
135 void addPolygon(const int &index);
136
137 void buildFrom(vpPoint &_p1, vpPoint &_p2, vpUniRand &rand_gen);
138
139 bool closeToImageBorder(const vpImage<unsigned char> &I, const unsigned int threshold);
140 void computeInteractionMatrixError(const vpHomogeneousMatrix &cMo);
141
142 void display(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
143 const vpColor &col, unsigned int thickness = 1, bool displayFullModel = false);
144 void display(const vpImage<vpRGBa> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
145 const vpColor &col, unsigned int thickness = 1, bool displayFullModel = false);
146 void displayMovingEdges(const vpImage<unsigned char> &I);
147 void displayMovingEdges(const vpImage<vpRGBa> &I);
148
154 inline void getCameraParameters(vpCameraParameters &camera) const { camera = this->cam; }
155
161 inline unsigned int getIndex() const { return index; }
162
170 inline double getMeanWeight() const { return wmean; }
171
172 std::vector<std::vector<double> > getFeaturesForDisplay();
173
174 std::vector<std::vector<double> > getModelForDisplay(unsigned int width, unsigned int height,
175 const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
176 bool displayFullModel = false);
177
183 inline std::string getName() const { return name; }
184
190 inline vpMbtPolygon &getPolygon() { return poly; }
191
192 void initInteractionMatrixError();
193
194 bool initMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, bool doNotTrack,
195 const vpImage<bool> *mask = NULL);
196
202 inline bool isTracked() const { return isTrackedLineWithVisibility; }
203
209 inline bool isVisible() const { return isvisible; }
210
211 void reinitMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo,
212 const vpImage<bool> *mask = NULL);
213
218 inline void setCameraParameters(const vpCameraParameters &camera) { this->cam = camera; }
219
225 inline void setIndex(unsigned int i) { index = i; }
226
232 inline void setMeanWeight(double w_mean) { this->wmean = w_mean; }
233
234 void setMovingEdge(vpMe *Me);
235
241 inline void setName(const std::string &line_name) { this->name = line_name; }
242
248 inline void setName(const char *line_name) { this->name = std::string(line_name); }
249
250 void setTracked(const std::string &name, const bool &track);
251
258 void setVisible(bool _isvisible) { isvisible = _isvisible; }
259
260 void trackMovingEdge(const vpImage<unsigned char> &I);
261
262 void updateMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
263
264 void updateTracked();
265
266private:
267 void project(const vpHomogeneousMatrix &cMo);
268};
269
270#endif
Generic class defining intrinsic camera parameters.
Implementation of column vector and the associated operations.
Class to define RGB colors available for display functionalities.
Definition vpColor.h:152
Class that defines a 2D line visual feature which is composed by two parameters that are and ,...
Implementation of an homogeneous matrix and operations on such kind of matrices.
Definition of the vpImage class member functions.
Definition vpImage.h:135
Class that defines a 3D line in the object frame and allows forward projection of the line in the cam...
Definition vpLine.h:100
Implementation of a matrix and operations on matrices.
Definition vpMatrix.h:152
Implementation of the polygons management for the model-based trackers.
Manage the line of a polygon used in the model-based tracker.
std::vector< unsigned int > nbFeature
The number of moving edges.
std::vector< bool > Lindex_polygon_tracked
bool isvisible
Indicates if the line is visible or not.
void setIndex(unsigned int i)
vpPoint * p2
The second extremity.
double getMeanWeight() const
vpLine * line
The 3D line.
void getCameraParameters(vpCameraParameters &camera) const
std::list< int > Lindex_polygon
Index of the faces which contain the line.
unsigned int nbFeatureTotal
The number of moving edges.
bool Reinit
Indicates if the line has to be reinitialized.
std::string getName() const
vpColVector error
The error vector.
vpMbHiddenFaces< vpMbtPolygon > * hiddenface
Pointer to the list of faces.
vpMbtPolygon & getPolygon()
bool useScanLine
Use scanline rendering.
vpPoint * p1
The first extremity.
unsigned int getIndex() const
void setName(const char *line_name)
std::vector< vpMbtMeLine * > meline
The moving edge container.
vpMatrix L
The interaction matrix.
void setCameraParameters(const vpCameraParameters &camera)
void setName(const std::string &line_name)
void setMeanWeight(double w_mean)
void setVisible(bool _isvisible)
Implementation of a polygon of the model used by the model-based tracker.
Definition vpMe.h:122
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
Definition vpPoint.h:77
Class for generating random numbers with uniform probability density.
Definition vpUniRand.h:122