Visual Servoing Platform  version 3.4.0
vpMbtDistanceCircle.h
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2019 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 http://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  * Authors:
35  * Fabien Spindler
36  *
37  *****************************************************************************/
38 
44 #ifndef vpMbtDistanceCircle_HH
45 #define vpMbtDistanceCircle_HH
46 
47 #include <visp3/core/vpCircle.h>
48 #include <visp3/core/vpHomogeneousMatrix.h>
49 #include <visp3/core/vpPoint.h>
50 #include <visp3/mbt/vpMbHiddenFaces.h>
51 #include <visp3/mbt/vpMbtMeEllipse.h>
52 #include <visp3/visual_features/vpFeatureEllipse.h>
53 
61 class VISP_EXPORT vpMbtDistanceCircle
62 {
63 private:
64  std::string name;
65  unsigned int index;
67  vpMe *me;
68  // double alpha;
69  double wmean;
70  vpFeatureEllipse featureEllipse;
72  // vpMbtPolygon poly;
73  bool isTrackedCircle;
74 
75 public:
77  vpMbtMeEllipse *meEllipse;
78 
81 
83  double radius;
84 
91 
97  unsigned int nbFeature;
99  bool Reinit;
105  bool isvisible;
106 
107  // private:
108  //#ifndef DOXYGEN_SHOULD_SKIP_THIS
109  // vpMbtDistanceCircle(const vpMbtDistanceCircle &)
110  // : name(), index(0), cam(), me(NULL), wmean(1),
111  // featureEllipse(), isTrackedCircle(true), meEllipse(NULL),
112  // circle(NULL), radius(0.), p1(NULL), p2(NULL), p3(NULL),
113  // L(), error(), nbFeature(0), Reinit(false),
114  // hiddenface(NULL), index_polygon(-1), isvisible(false)
115  // {
116  // throw vpException(vpException::functionNotImplementedError, "Not
117  // implemented!");
118  // }
119  // vpMbtDistanceCircle &operator=(const vpMbtDistanceCircle &){
120  // throw vpException(vpException::functionNotImplementedError, "Not
121  // implemented!"); return *this;
122  // }
123  //#endif
124 
125 public:
127  virtual ~vpMbtDistanceCircle();
128 
129  void buildFrom(const vpPoint &_p1, const vpPoint &_p2, const vpPoint &_p3, double r);
130 
131  void computeInteractionMatrixError(const vpHomogeneousMatrix &cMo);
132 
133  void display(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
134  const vpColor &col, unsigned int thickness = 1, bool displayFullModel = false);
135  void display(const vpImage<vpRGBa> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
136  const vpColor &col, unsigned int thickness = 1, bool displayFullModel = false);
137  void displayMovingEdges(const vpImage<unsigned char> &I);
138  void displayMovingEdges(const vpImage<vpRGBa> &I);
139 
145  inline void getCameraParameters(vpCameraParameters &camera) { camera = this->cam; }
146 
152  inline unsigned int getIndex() { return index; }
153 
161  inline double getMeanWeight() const { return wmean; }
162 
163  std::vector<std::vector<double> > getFeaturesForDisplay();
164 
165  std::vector<double> getModelForDisplay(const vpHomogeneousMatrix &cMo,
166  const vpCameraParameters &cam,
167  bool displayFullModel = false);
168 
174  inline std::string getName() const { return name; }
175 
181  // inline vpMbtPolygon& getPolygon() {return poly;}
182 
183  void initInteractionMatrixError();
184 
185  bool initMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, bool doNotTrack,
186  const vpImage<bool> *mask = NULL);
187 
193  inline bool isTracked() const { return isTrackedCircle; }
194 
200  inline bool isVisible() const { return isvisible; }
201 
202  void reinitMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo,
203  const vpImage<bool> *mask = NULL);
204 
209  inline void setCameraParameters(const vpCameraParameters &camera) { this->cam = camera; }
210 
216  inline void setTracked(const bool &track) { this->isTrackedCircle = track; }
217 
223  inline void setIndex(unsigned int i) { index = i; }
224 
230  inline void setMeanWeight(double _wmean) { this->wmean = _wmean; }
231 
232  void setMovingEdge(vpMe *Me);
233 
239  inline void setName(const std::string &circle_name) { this->name = circle_name; }
240 
246  inline void setName(const char *circle_name) { this->name = std::string(circle_name); }
247 
254  inline void setVisible(bool _isvisible) { isvisible = _isvisible; }
255 
256  void trackMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
257 
258  void updateMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
259 
260 private:
261  void project(const vpHomogeneousMatrix &cMo);
262 };
263 
264 #endif
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:153
unsigned int nbFeature
The number of moving edges.
void setCameraParameters(const vpCameraParameters &camera)
vpPoint * p3
An other point on the plane containing the circle.
vpMbHiddenFaces< vpMbtPolygon > * hiddenface
Pointer to the list of faces.
void setIndex(unsigned int i)
Implementation of an homogeneous matrix and operations on such kind of matrices.
vpMatrix L
The interaction matrix.
Class to define RGB colors available for display functionnalities.
Definition: vpColor.h:157
vpColVector error
The error vector.
vpMbtMeEllipse * meEllipse
The moving edge containers.
Definition: vpMe.h:60
void getCameraParameters(vpCameraParameters &camera)
int index_polygon
Index of the faces which contain the line.
vpPoint * p2
A point on the plane containing the circle.
void setTracked(const bool &track)
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
Definition: vpPoint.h:81
Manage a circle used in the model-based tracker.
bool Reinit
Indicates if the circle has to be reinitialized.
void setName(const char *circle_name)
void setName(const std::string &circle_name)
bool isvisible
Indicates if the circle is visible or not.
Generic class defining intrinsic camera parameters.
void setMeanWeight(double _wmean)
void setVisible(bool _isvisible)
vpCircle * circle
The circle to track.
std::string getName() const
double getMeanWeight() const
Implementation of column vector and the associated operations.
Definition: vpColVector.h:130
Class that defines 2D ellipse visual feature.
double radius
The radius of the circle.
Class that defines a 3D circle in the object frame and allows forward projection of a 3D circle in th...
Definition: vpCircle.h:91
vpPoint * p1
The center of the circle.