Visual Servoing Platform  version 3.6.1 under development (2025-02-01)
vpMbtDistanceCircle.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 a circle used in the model-based tracker.
33  *
34 *****************************************************************************/
35 
41 #ifndef vpMbtDistanceCircle_HH
42 #define vpMbtDistanceCircle_HH
43 
44 #include <visp3/core/vpConfig.h>
45 #include <visp3/core/vpCircle.h>
46 #include <visp3/core/vpHomogeneousMatrix.h>
47 #include <visp3/core/vpPoint.h>
48 #include <visp3/mbt/vpMbHiddenFaces.h>
49 #include <visp3/mbt/vpMbtMeEllipse.h>
50 #include <visp3/visual_features/vpFeatureEllipse.h>
51 
52 BEGIN_VISP_NAMESPACE
60 class VISP_EXPORT vpMbtDistanceCircle
61 {
62 private:
63  std::string name;
64  unsigned int index;
66  vpMe *me;
67  // double alpha;
68  double wmean;
69  vpFeatureEllipse featureEllipse;
71  // vpMbtPolygon poly;
72  bool isTrackedCircle;
73 
74 public:
76  vpMbtMeEllipse *meEllipse;
77 
80 
82  double radius;
83 
90 
96  unsigned int nbFeature;
98  bool Reinit;
104  bool isvisible;
105 
106  // private:
107  //#ifndef DOXYGEN_SHOULD_SKIP_THIS
108  // vpMbtDistanceCircle(const vpMbtDistanceCircle &)
109  // : name(), index(0), cam(), me(nullptr), wmean(1),
110  // featureEllipse(), isTrackedCircle(true), meEllipse(nullptr),
111  // circle(nullptr), radius(0.), p1(nullptr), p2(nullptr), p3(nullptr),
112  // L(), error(), nbFeature(0), Reinit(false),
113  // hiddenface(nullptr), index_polygon(-1), isvisible(false)
114  // {
115  // throw vpException(vpException::functionNotImplementedError, "Not
116  // implemented!");
117  // }
118  // vpMbtDistanceCircle &operator=(const vpMbtDistanceCircle &){
119  // throw vpException(vpException::functionNotImplementedError, "Not
120  // implemented!"); return *this;
121  // }
122  //#endif
123 
124 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
125  vpMbtDistanceCircle(const vpMbtDistanceCircle &) = delete; // non construction-copyable
126  vpMbtDistanceCircle &operator=(const vpMbtDistanceCircle &) = delete; // non copyable
127 #endif
128 
129 public:
131  virtual ~vpMbtDistanceCircle();
132 
133  void buildFrom(const vpPoint &_p1, const vpPoint &_p2, const vpPoint &_p3, double r);
134 
135  void computeInteractionMatrixError(const vpHomogeneousMatrix &cMo);
136 
137  void display(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
138  const vpColor &col, unsigned int thickness = 1, bool displayFullModel = false);
139  void display(const vpImage<vpRGBa> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
140  const vpColor &col, unsigned int thickness = 1, bool displayFullModel = false);
141  void displayMovingEdges(const vpImage<unsigned char> &I);
142  void displayMovingEdges(const vpImage<vpRGBa> &I);
143 
149  inline void getCameraParameters(vpCameraParameters &camera) { camera = this->cam; }
150 
156  inline unsigned int getIndex() { return index; }
157 
165  inline double getMeanWeight() const { return wmean; }
166 
167  std::vector<std::vector<double> > getFeaturesForDisplay();
168 
169  std::vector<double> getModelForDisplay(const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
170  bool displayFullModel = false);
171 
177  inline std::string getName() const { return name; }
178 
179  void initInteractionMatrixError();
180 
181  bool initMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, bool doNotTrack,
182  const vpImage<bool> *mask = nullptr);
183 
189  inline bool isTracked() const { return isTrackedCircle; }
190 
196  inline bool isVisible() const { return isvisible; }
197 
198  void reinitMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo,
199  const vpImage<bool> *mask = nullptr);
200 
205  inline void setCameraParameters(const vpCameraParameters &camera) { this->cam = camera; }
206 
212  inline void setTracked(const bool &track) { this->isTrackedCircle = track; }
213 
219  inline void setIndex(unsigned int i) { index = i; }
220 
226  inline void setMeanWeight(double _wmean) { this->wmean = _wmean; }
227 
228  void setMovingEdge(vpMe *Me);
229 
235  inline void setName(const std::string &circle_name) { this->name = circle_name; }
236 
242  inline void setName(const char *circle_name) { this->name = std::string(circle_name); }
243 
250  inline void setVisible(bool _isvisible) { isvisible = _isvisible; }
251 
252  void trackMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
253 
254  void updateMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
255 
256 private:
257  void project(const vpHomogeneousMatrix &cMo);
258 };
259 END_VISP_NAMESPACE
260 #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.
Definition: vpColVector.h:191
Class to define RGB colors available for display functionalities.
Definition: vpColor.h:157
Class that defines 2D ellipse visual feature.
Implementation of an homogeneous matrix and operations on such kind of matrices.
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:169
Manage a circle used in the model-based tracker.
void setVisible(bool _isvisible)
void setName(const char *circle_name)
void setCameraParameters(const vpCameraParameters &camera)
vpColVector error
The error vector.
vpMbHiddenFaces< vpMbtPolygon > * hiddenface
Pointer to the list of faces.
vpPoint * p1
The center of the circle.
double getMeanWeight() const
unsigned int nbFeature
The number of moving edges.
vpMatrix L
The interaction matrix.
void getCameraParameters(vpCameraParameters &camera)
void setIndex(unsigned int i)
std::string getName() const
vpMbtDistanceCircle & operator=(const vpMbtDistanceCircle &)=delete
vpCircle * circle
The circle to track.
vpPoint * p2
A point on the plane containing the circle.
void setMeanWeight(double _wmean)
bool isvisible
Indicates if the circle is visible or not.
bool Reinit
Indicates if the circle has to be reinitialized.
double radius
The radius of the circle.
int index_polygon
Index of the faces which contain the line.
vpPoint * p3
An other point on the plane containing the circle.
vpMbtMeEllipse * meEllipse
The moving edge containers.
void setName(const std::string &circle_name)
vpMbtDistanceCircle(const vpMbtDistanceCircle &)=delete
void setTracked(const bool &track)
Definition: vpMe.h:134
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
Definition: vpPoint.h:79