Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpMbtDistanceCylinder.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 a cylinder used in the model-based tracker.
32 *
33 * Authors:
34 * Romain Tallonneau
35 * Bertrand Delabarre
36 */
37
42
43#ifndef vpMbtDistanceCylinder_HH
44#define vpMbtDistanceCylinder_HH
45
46#include <visp3/core/vpCircle.h>
47#include <visp3/core/vpConfig.h>
48#include <visp3/core/vpCylinder.h>
49#include <visp3/core/vpHomogeneousMatrix.h>
50#include <visp3/core/vpLine.h>
51#include <visp3/core/vpPoint.h>
52#include <visp3/mbt/vpMbHiddenFaces.h>
53#include <visp3/mbt/vpMbtMeLine.h>
54#include <visp3/visual_features/vpFeatureLine.h>
55
76class VISP_EXPORT vpMbtDistanceCylinder
77{
78private:
79 std::string name;
80 unsigned int index;
82 vpMe *me;
83 double wmean1;
84 double wmean2;
85 vpFeatureLine featureline1;
86 vpFeatureLine featureline2;
87 bool isTrackedCylinder;
88
89public:
91 vpMbtMeLine *meline1;
93 vpMbtMeLine *meline2;
94
99
101 double radius;
102
107
113 unsigned int nbFeature;
115 unsigned int nbFeaturel1;
117 unsigned int nbFeaturel2;
119 bool Reinit;
122
129
130 // private:
131 //#ifndef DOXYGEN_SHOULD_SKIP_THIS
132 // vpMbtDistanceCylinder(const vpMbtDistanceCylinder &)
133 // : name(), index(0), cam(), me(nullptr), wmean1(1), wmean2(1),
134 // featureline1(), featureline2(), isTrackedCylinder(true),
135 // meline1(nullptr), meline2(nullptr), cercle1(nullptr), cercle2(nullptr),
136 // radius(0), p1(nullptr), p2(nullptr), L(), error(), nbFeature(0),
137 // nbFeaturel1(0), nbFeaturel2(0), Reinit(false), c(nullptr),
138 // hiddenface(nullptr), index_polygon(-1), isvisible(false)
139 // {
140 // throw vpException(vpException::functionNotImplementedError, "Not
141 // implemented!");
142 // }
143 // vpMbtDistanceCylinder &operator=(const vpMbtDistanceCylinder &){
144 // throw vpException(vpException::functionNotImplementedError, "Not
145 // implemented!"); return *this;
146 // }
147 //#endif
148
149#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
150 vpMbtDistanceCylinder(const vpMbtDistanceCylinder &) = delete; // non construction-copyable
151 vpMbtDistanceCylinder &operator=(const vpMbtDistanceCylinder &) = delete; // non copyable
152#endif
153
154public:
156 virtual ~vpMbtDistanceCylinder();
157
158 void buildFrom(const vpPoint &_p1, const vpPoint &_p2, double r);
159
161
162 void display(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
163 const vpColor &col, unsigned int thickness = 1, bool displayFullModel = false);
164 void display(const vpImage<vpRGBa> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
165 const vpColor &col, unsigned int thickness = 1, bool displayFullModel = false);
167 void displayMovingEdges(const vpImage<vpRGBa> &I);
168
174 inline void getCameraParameters(vpCameraParameters &camera) { camera = this->cam; }
175
181 inline unsigned int getIndex() { return index; }
182
190 inline double getMeanWeight1() const { return wmean1; }
191
199 inline double getMeanWeight2() const { return wmean2; }
200
201 std::vector<std::vector<double> > getFeaturesForDisplay();
202
203 std::vector<std::vector<double> > getModelForDisplay(unsigned int width, unsigned int height,
204 const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
205 bool displayFullModel = false);
206
212 inline std::string getName() const { return name; }
213
214 void initInteractionMatrixError();
215
216 bool initMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, bool doNotTrack,
217 const vpImage<bool> *mask = nullptr, const int &initRange = 0);
218
224 inline bool isTracked() const { return isTrackedCylinder; }
225
231 inline bool isVisible() const { return isvisible; }
232
233 void reinitMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo,
234 const vpImage<bool> *mask = nullptr);
235
240 inline void setCameraParameters(const vpCameraParameters &camera) { this->cam = camera; }
241
247 inline void setTracked(const bool &track) { this->isTrackedCylinder = track; }
248
254 inline void setIndex(unsigned int i) { index = i; }
255
261 inline void setMeanWeight1(double wmean) { this->wmean1 = wmean; }
262
268 inline void setMeanWeight2(double wmean) { this->wmean2 = wmean; }
269
270 void setMovingEdge(vpMe *Me);
271
277 inline void setName(const std::string &cyl_name) { this->name = cyl_name; }
278
284 inline void setName(const char *cyl_name) { this->name = std::string(cyl_name); }
285
292 inline void setVisible(bool _isvisible) { isvisible = _isvisible; }
293
294 void trackMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
295
296 void updateMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
297
298private:
299 void project(const vpHomogeneousMatrix &cMo);
300};
301END_VISP_NAMESPACE
302#endif
Generic class defining intrinsic camera parameters.
Class that defines a 3D circle in the object frame and allows forward projection of a 3D circle in th...
Definition vpCircle.h:87
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 3D cylinder in the object frame and allows forward projection of a 3D cylinder i...
Definition vpCylinder.h:101
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
Implementation of a matrix and operations on matrices.
Definition vpMatrix.h:175
Implementation of the polygons management for the model-based trackers.
void setMeanWeight1(double wmean)
void buildFrom(const vpPoint &_p1, const vpPoint &_p2, double r)
void setCameraParameters(const vpCameraParameters &camera)
void computeInteractionMatrixError(const vpHomogeneousMatrix &cMo, const vpImage< unsigned char > &I)
vpMbtDistanceCylinder & operator=(const vpMbtDistanceCylinder &)=delete
vpMbtDistanceCylinder(const vpMbtDistanceCylinder &)=delete
void setName(const std::string &cyl_name)
vpMbtMeLine * meline2
The moving edge containers (second line of the cylinder).
void setVisible(bool _isvisible)
void getCameraParameters(vpCameraParameters &camera)
vpCylinder * c
The cylinder.
vpMatrix L
The interaction matrix.
unsigned int nbFeaturel2
The number of moving edges on line 2.
bool Reinit
Indicates if the line has to be reinitialized.
vpPoint * p2
The second extremity on the axe.
vpCircle * cercle1
The upper circle limiting the cylinder.
vpMbHiddenFaces< vpMbtPolygon > * hiddenface
Pointer to the list of faces.
void setMeanWeight2(double wmean)
double radius
The radius of the cylinder.
unsigned int nbFeaturel1
The number of moving edges on line 1.
vpColVector error
The error vector.
void setTracked(const bool &track)
std::string getName() const
void displayMovingEdges(const vpImage< unsigned char > &I)
void setName(const char *cyl_name)
void display(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &col, unsigned int thickness=1, bool displayFullModel=false)
unsigned int nbFeature
The number of moving edges.
int index_polygon
Index of the face which contains the cylinder.
vpCircle * cercle2
The lower circle limiting the cylinder.
bool isvisible
Indicates if the cylinder is visible or not.
void setIndex(unsigned int i)
vpPoint * p1
The first extremity on the axe.
vpMbtMeLine * meline1
The moving edge containers (first line of the cylinder).
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