Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpMbtDistanceLine.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 * Manage the line of a polygon used in the model-based tracker.
32 *
33 * Authors:
34 * Romain Tallonneau
35 */
36
41
42#ifndef vpMbtDistanceLine_HH
43#define vpMbtDistanceLine_HH
44
45#include <visp3/core/vpConfig.h>
46#include <visp3/core/vpHomogeneousMatrix.h>
47#include <visp3/core/vpLine.h>
48#include <visp3/core/vpPoint.h>
49#include <visp3/core/vpUniRand.h>
50#include <visp3/mbt/vpMbHiddenFaces.h>
51#include <visp3/mbt/vpMbtMeLine.h>
52#include <visp3/visual_features/vpFeatureLine.h>
53
54#include <list>
55
76class VISP_EXPORT vpMbtDistanceLine
77{
78private:
79 std::string name;
80 unsigned int index;
82 vpMe *me;
83 bool isTrackedLine;
84 bool isTrackedLineWithVisibility;
85 double wmean;
86 vpFeatureLine featureline;
88 vpMbtPolygon poly;
89
90public:
94 // vpMbtMeLine *meline;
95 std::vector<vpMbtMeLine *> meline;
107 // unsigned int nbFeature;
108 std::vector<unsigned int> nbFeature;
110 unsigned int nbFeatureTotal;
112 bool Reinit;
116 std::list<int> Lindex_polygon;
119 std::vector<bool> Lindex_polygon_tracked;
122
123 // private:
124 //#ifndef DOXYGEN_SHOULD_SKIP_THIS
125 // vpMbtDistanceLine(const vpMbtDistanceLine &)
126 // : name(), index(0), cam(), me(nullptr), isTrackedLine(true),
127 // isTrackedLineWithVisibility(true),
128 // wmean(1), featureline(), poly(), useScanLine(false), meline(),
129 // line(nullptr), p1(nullptr), p2(nullptr), L(), error(), nbFeature(),
130 // nbFeatureTotal(0), Reinit(false), hiddenface(nullptr),
131 // Lindex_polygon(), Lindex_polygon_tracked(), isvisible(false)
132 // {
133 // throw vpException(vpException::functionNotImplementedError, "Not
134 // implemented!");
135 // }
136 // vpMbtDistanceLine &operator=(const vpMbtDistanceLine &){
137 // throw vpException(vpException::functionNotImplementedError, "Not
138 // implemented!"); return *this;
139 // }
140 //#endif
141
142#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
143 vpMbtDistanceLine(const vpMbtDistanceLine &) = delete; // non construction-copyable
144 vpMbtDistanceLine &operator=(const vpMbtDistanceLine &) = delete; // non copyable
145#endif
146
147public:
149 virtual ~vpMbtDistanceLine();
150
151 void addPolygon(const int &index);
152
153 void buildFrom(vpPoint &_p1, vpPoint &_p2, vpUniRand &rand_gen);
154
155 bool closeToImageBorder(const vpImage<unsigned char> &I, const unsigned int threshold);
157
158 void display(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
159 const vpColor &col, unsigned int thickness = 1, bool displayFullModel = false);
160 void display(const vpImage<vpRGBa> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
161 const vpColor &col, unsigned int thickness = 1, bool displayFullModel = false);
163 void displayMovingEdges(const vpImage<vpRGBa> &I);
164
170 inline void getCameraParameters(vpCameraParameters &camera) const { camera = this->cam; }
171
177 inline unsigned int getIndex() const { return index; }
178
186 inline double getMeanWeight() const { return wmean; }
187
188 std::vector<std::vector<double> > getFeaturesForDisplay();
189
190 std::vector<std::vector<double> > getModelForDisplay(unsigned int width, unsigned int height,
191 const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
192 bool displayFullModel = false);
193
199 inline std::string getName() const { return name; }
200
206 inline vpMbtPolygon &getPolygon() { return poly; }
207
208 void initInteractionMatrixError();
209
210 bool initMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, bool doNotTrack,
211 const vpImage<bool> *mask = nullptr, const int &initRange = 0);
212
218 inline bool isTracked() const { return isTrackedLineWithVisibility; }
219
225 inline bool isVisible() const { return isvisible; }
226
227 void reinitMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo,
228 const vpImage<bool> *mask = nullptr);
229
234 inline void setCameraParameters(const vpCameraParameters &camera) { this->cam = camera; }
235
241 inline void setIndex(unsigned int i) { index = i; }
242
248 inline void setMeanWeight(double w_mean) { this->wmean = w_mean; }
249
250 void setMovingEdge(vpMe *Me);
251
257 inline void setName(const std::string &line_name) { this->name = line_name; }
258
264 inline void setName(const char *line_name) { this->name = std::string(line_name); }
265
266 void setTracked(const std::string &name, const bool &track);
267
274 void setVisible(bool _isvisible) { isvisible = _isvisible; }
275
276 void trackMovingEdge(const vpImage<unsigned char> &I);
277
278 void updateMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
279
280 void updateTracked();
281
282private:
283 void project(const vpHomogeneousMatrix &cMo);
284};
285END_VISP_NAMESPACE
286#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:157
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:131
Class that defines a 3D line in the object frame and allows forward projection of the line in the cam...
Definition vpLine.h:103
Implementation of a matrix and operations on matrices.
Definition vpMatrix.h:175
Implementation of the polygons management for the model-based trackers.
std::vector< unsigned int > nbFeature
The number of moving edges.
void displayMovingEdges(const vpImage< unsigned char > &I)
std::vector< bool > Lindex_polygon_tracked
bool isvisible
Indicates if the line is visible or not.
void setIndex(unsigned int i)
void computeInteractionMatrixError(const vpHomogeneousMatrix &cMo)
vpPoint * p2
The second extremity.
double getMeanWeight() const
vpLine * line
The 3D line.
void display(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &col, unsigned int thickness=1, bool displayFullModel=false)
void getCameraParameters(vpCameraParameters &camera) const
std::list< int > Lindex_polygon
Index of the faces which contain the line.
void buildFrom(vpPoint &_p1, vpPoint &_p2, vpUniRand &rand_gen)
unsigned int nbFeatureTotal
The number of moving edges.
vpMbtDistanceLine(const vpMbtDistanceLine &)=delete
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.
bool closeToImageBorder(const vpImage< unsigned char > &I, const unsigned int threshold)
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)
void addPolygon(const int &index)
vpMbtDistanceLine & operator=(const vpMbtDistanceLine &)=delete
Implementation of a polygon of the model used by the model-based tracker.
Definition vpMe.h:143
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
Definition vpPoint.h:79
Class for generating random numbers with uniform probability density.
Definition vpUniRand.h:127