Visual Servoing Platform  version 3.6.1 under development (2024-04-26)
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/vpCircle.h>
45 #include <visp3/core/vpHomogeneousMatrix.h>
46 #include <visp3/core/vpPoint.h>
47 #include <visp3/mbt/vpMbHiddenFaces.h>
48 #include <visp3/mbt/vpMbtMeEllipse.h>
49 #include <visp3/visual_features/vpFeatureEllipse.h>
50 
58 class VISP_EXPORT vpMbtDistanceCircle
59 {
60 private:
61  std::string name;
62  unsigned int index;
64  vpMe *me;
65  // double alpha;
66  double wmean;
67  vpFeatureEllipse featureEllipse;
69  // vpMbtPolygon poly;
70  bool isTrackedCircle;
71 
72 public:
74  vpMbtMeEllipse *meEllipse;
75 
78 
80  double radius;
81 
88 
94  unsigned int nbFeature;
96  bool Reinit;
102  bool isvisible;
103 
104  // private:
105  //#ifndef DOXYGEN_SHOULD_SKIP_THIS
106  // vpMbtDistanceCircle(const vpMbtDistanceCircle &)
107  // : name(), index(0), cam(), me(nullptr), wmean(1),
108  // featureEllipse(), isTrackedCircle(true), meEllipse(nullptr),
109  // circle(nullptr), radius(0.), p1(nullptr), p2(nullptr), p3(nullptr),
110  // L(), error(), nbFeature(0), Reinit(false),
111  // hiddenface(nullptr), index_polygon(-1), isvisible(false)
112  // {
113  // throw vpException(vpException::functionNotImplementedError, "Not
114  // implemented!");
115  // }
116  // vpMbtDistanceCircle &operator=(const vpMbtDistanceCircle &){
117  // throw vpException(vpException::functionNotImplementedError, "Not
118  // implemented!"); return *this;
119  // }
120  //#endif
121 
122 public:
124  virtual ~vpMbtDistanceCircle();
125 
126  void buildFrom(const vpPoint &_p1, const vpPoint &_p2, const vpPoint &_p3, double r);
127 
128  void computeInteractionMatrixError(const vpHomogeneousMatrix &cMo);
129 
130  void display(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
131  const vpColor &col, unsigned int thickness = 1, bool displayFullModel = false);
132  void display(const vpImage<vpRGBa> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
133  const vpColor &col, unsigned int thickness = 1, bool displayFullModel = false);
134  void displayMovingEdges(const vpImage<unsigned char> &I);
135  void displayMovingEdges(const vpImage<vpRGBa> &I);
136 
142  inline void getCameraParameters(vpCameraParameters &camera) { camera = this->cam; }
143 
149  inline unsigned int getIndex() { return index; }
150 
158  inline double getMeanWeight() const { return wmean; }
159 
160  std::vector<std::vector<double> > getFeaturesForDisplay();
161 
162  std::vector<double> getModelForDisplay(const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
163  bool displayFullModel = false);
164 
170  inline std::string getName() const { return name; }
171 
172  void initInteractionMatrixError();
173 
174  bool initMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, bool doNotTrack,
175  const vpImage<bool> *mask = nullptr);
176 
182  inline bool isTracked() const { return isTrackedCircle; }
183 
189  inline bool isVisible() const { return isvisible; }
190 
191  void reinitMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo,
192  const vpImage<bool> *mask = nullptr);
193 
198  inline void setCameraParameters(const vpCameraParameters &camera) { this->cam = camera; }
199 
205  inline void setTracked(const bool &track) { this->isTrackedCircle = track; }
206 
212  inline void setIndex(unsigned int i) { index = i; }
213 
219  inline void setMeanWeight(double _wmean) { this->wmean = _wmean; }
220 
221  void setMovingEdge(vpMe *Me);
222 
228  inline void setName(const std::string &circle_name) { this->name = circle_name; }
229 
235  inline void setName(const char *circle_name) { this->name = std::string(circle_name); }
236 
243  inline void setVisible(bool _isvisible) { isvisible = _isvisible; }
244 
245  void trackMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
246 
247  void updateMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
248 
249 private:
250  void project(const vpHomogeneousMatrix &cMo);
251 };
252 
253 #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:86
Implementation of column vector and the associated operations.
Definition: vpColVector.h:163
Class to define RGB colors available for display functionalities.
Definition: vpColor.h:152
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:146
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
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)
void setTracked(const bool &track)
Definition: vpMe.h:124
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
Definition: vpPoint.h:77