Visual Servoing Platform  version 3.0.0
vpMbtDistanceCircle.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2015 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * ("GPL") version 2 as published by the Free Software Foundation.
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 http://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 circle used in the model-based tracker.
32  *
33  * Authors:
34  * Fabien Spindler
35  *
36  *****************************************************************************/
37 
43 #ifndef vpMbtDistanceCircle_HH
44 #define vpMbtDistanceCircle_HH
45 
46 #include <visp3/core/vpPoint.h>
47 #include <visp3/mbt/vpMbtMeEllipse.h>
48 #include <visp3/core/vpHomogeneousMatrix.h>
49 #include <visp3/visual_features/vpFeatureEllipse.h>
50 #include <visp3/core/vpCircle.h>
51 #include <visp3/mbt/vpMbHiddenFaces.h>
52 
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(NULL), wmean(1),
110 // featureEllipse(), isTrackedCircle(true), meEllipse(NULL),
111 // circle(NULL), radius(0.), p1(NULL), p2(NULL), p3(NULL),
112 // L(), error(), nbFeature(0), Reinit(false),
113 // hiddenface(NULL), index_polygon(-1), isvisible(false)
114 // {
115 // throw vpException(vpException::functionNotImplementedError, "Not implemented!");
116 // }
117 // vpMbtDistanceCircle &operator=(const vpMbtDistanceCircle &){
118 // throw vpException(vpException::functionNotImplementedError, "Not implemented!");
119 // return *this;
120 // }
121 //#endif
122 
123  public:
126 
127  void buildFrom(const vpPoint &_p1, const vpPoint &_p2, const vpPoint &_p3, const double r);
128 
129  void computeInteractionMatrixError(const vpHomogeneousMatrix &cMo);
130 
131  void display(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor col, const unsigned int thickness = 1, const bool displayFullModel = false);
132  void display(const vpImage<vpRGBa> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor col, const unsigned int thickness = 1, const bool displayFullModel = false);
133  void displayMovingEdges(const vpImage<unsigned char> &I);
134 
140  inline void getCameraParameters(vpCameraParameters& camera) {camera = this->cam;}
141 
147  inline unsigned int getIndex() {return index ;}
148 
155  inline double getMeanWeight() const {return wmean;}
156 
162  inline std::string getName() const {return name;}
163 
169 // inline vpMbtPolygon& getPolygon() {return poly;}
170 
171  void initInteractionMatrixError();
172 
173  bool initMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
179  inline bool isTracked() const {return isTrackedCircle;}
180 
186  inline bool isVisible() const {return isvisible; }
187 
188  void reinitMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
189 
194  inline void setCameraParameters(const vpCameraParameters& camera) {this->cam = camera;}
195 
201  inline void setTracked(const bool& track) {this->isTrackedCircle = track;}
202 
208  inline void setIndex(const unsigned int i) {index = i;}
209 
215  inline void setMeanWeight(const double _wmean) {this->wmean = _wmean;}
216 
217  void setMovingEdge(vpMe *Me);
218 
224  inline void setName(const std::string& circle_name) {this->name = circle_name;}
225 
231  inline void setName(const char* circle_name) {this->name = std::string(circle_name);}
232 
238  inline void setVisible(bool _isvisible) {isvisible = _isvisible ;}
239 
240 
241  void trackMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
242 
243  void updateMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
244 
245  private:
246  void project(const vpHomogeneousMatrix &cMo);
247 } ;
248 
249 #endif
250 
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:92
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.
Implementation of an homogeneous matrix and operations on such kind of matrices.
vpMatrix L
The interaction matrix.
Class to define colors available for display functionnalities.
Definition: vpColor.h:121
vpColVector error
The error vector.
vpMbtMeEllipse * meEllipse
The moving edge containers.
Definition: vpMe.h:59
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 what is a point.
Definition: vpPoint.h:59
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 setVisible(bool _isvisible)
vpCircle * circle
The circle to track.
std::string getName() const
double getMeanWeight() const
void setIndex(const unsigned int i)
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72
void setMeanWeight(const double _wmean)
Class that defines 2D ellipse visual feature.
double radius
The radius of the circle.
Class that defines what is a circle.
Definition: vpCircle.h:57
vpPoint * p1
The center of the circle.