Visual Servoing Platform  version 3.0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
vpMbtDistanceCylinder.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2017 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 cylinder used in the model-based tracker.
32  *
33  * Authors:
34  * Nicolas Melchior
35  * Romain Tallonneau
36  * Eric Marchand
37  * Bertrand Delabarre
38  *
39  *****************************************************************************/
40 
46 #ifndef vpMbtDistanceCylinder_HH
47 #define vpMbtDistanceCylinder_HH
48 
49 #include <visp3/core/vpPoint.h>
50 #include <visp3/mbt/vpMbtMeLine.h>
51 #include <visp3/core/vpLine.h>
52 #include <visp3/core/vpHomogeneousMatrix.h>
53 #include <visp3/visual_features/vpFeatureLine.h>
54 #include <visp3/core/vpCylinder.h>
55 #include <visp3/core/vpCircle.h>
56 #include <visp3/mbt/vpMbHiddenFaces.h>
57 
65 class VISP_EXPORT vpMbtDistanceCylinder
66 {
67  private :
68  std::string name;
69  unsigned int index;
71  vpMe *me;
72  double wmean1;
73  double wmean2;
74  vpFeatureLine featureline1 ;
75  vpFeatureLine featureline2 ;
76  bool isTrackedCylinder;
77 
78  public:
80  vpMbtMeLine *meline1;
82  vpMbtMeLine *meline2;
83 
88 
90  double radius;
91 
96 
102  unsigned int nbFeature;
104  unsigned int nbFeaturel1;
106  unsigned int nbFeaturel2;
108  bool Reinit;
111 
117  bool isvisible;
118 
119 //private:
120 //#ifndef DOXYGEN_SHOULD_SKIP_THIS
121 // vpMbtDistanceCylinder(const vpMbtDistanceCylinder &)
122 // : name(), index(0), cam(), me(NULL), wmean1(1), wmean2(1),
123 // featureline1(), featureline2(), isTrackedCylinder(true), meline1(NULL), meline2(NULL),
124 // cercle1(NULL), cercle2(NULL), radius(0), p1(NULL), p2(NULL), L(),
125 // error(), nbFeature(0), nbFeaturel1(0), nbFeaturel2(0), Reinit(false),
126 // c(NULL), hiddenface(NULL), index_polygon(-1), isvisible(false)
127 // {
128 // throw vpException(vpException::functionNotImplementedError, "Not implemented!");
129 // }
130 // vpMbtDistanceCylinder &operator=(const vpMbtDistanceCylinder &){
131 // throw vpException(vpException::functionNotImplementedError, "Not implemented!");
132 // return *this;
133 // }
134 //#endif
135 
136  public:
139 
140  void buildFrom(const vpPoint &_p1, const vpPoint &_p2, const double r);
141 
142  void computeInteractionMatrixError(const vpHomogeneousMatrix &cMo, const vpImage<unsigned char> &I);
143 
144  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);
145  void display(const vpImage<vpRGBa> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor col, const unsigned int thickness = 1, const bool displayFullModel = false);
146  void displayMovingEdges(const vpImage<unsigned char> &I);
147 
153  inline void getCameraParameters(vpCameraParameters& camera) {camera = this->cam;}
154 
160  inline unsigned int getIndex() {return index ;}
161 
168  inline double getMeanWeight1() const {return wmean1;}
169 
176  inline double getMeanWeight2() const {return wmean2;}
177 
183  inline std::string getName() const {return name;}
184 
185  void initInteractionMatrixError();
186 
187  bool initMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
188 
194  inline bool isTracked() const {return isTrackedCylinder;}
195 
201  inline bool isVisible() const {return isvisible; }
202 
203  void reinitMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
204 
209  inline void setCameraParameters(const vpCameraParameters& camera) {this->cam = camera;}
210 
216  inline void setTracked(const bool& track) {this->isTrackedCylinder = track;}
217 
223  inline void setIndex(const unsigned int i) {index = i;}
224 
230  inline void setMeanWeight1(const double wmean) {this->wmean1 = wmean;}
231 
237  inline void setMeanWeight2(const double wmean) {this->wmean2 = wmean;}
238 
239  void setMovingEdge(vpMe *Me);
240 
246  inline void setName(const std::string& cyl_name) {this->name = cyl_name;}
247 
253  inline void setName(const char* cyl_name) {this->name = std::string(cyl_name);}
254 
260  inline void setVisible(bool _isvisible) {isvisible = _isvisible ;}
261 
262  void trackMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
263 
264  void updateMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
265 
266  private:
267  void project(const vpHomogeneousMatrix &cMo);
268 } ;
269 
270 #endif
271 
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:97
vpCylinder * c
The cylinder.
vpMbHiddenFaces< vpMbtPolygon > * hiddenface
Pointer to the list of faces.
void setName(const char *cyl_name)
bool isvisible
Indicates if the cylinder is visible or not.
void setMeanWeight2(const double wmean)
Implementation of an homogeneous matrix and operations on such kind of matrices.
void setCameraParameters(const vpCameraParameters &camera)
Class to define colors available for display functionnalities.
Definition: vpColor.h:121
Manage a cylinder used in the model-based tracker.
Definition: vpMe.h:59
unsigned int nbFeature
The number of moving edges.
void setIndex(const unsigned int i)
vpPoint * p1
The first extremity on the axe.
Class that defines what is a point.
Definition: vpPoint.h:59
vpMatrix L
The interaction matrix.
unsigned int nbFeaturel1
The number of moving edges on line 1.
int index_polygon
Index of the face which contains the cylinder.
vpCircle * cercle2
The lower circle limiting the cylinder.
Generic class defining intrinsic camera parameters.
Class that defines a 2D line visual feature which is composed by two parameters that are and ...
vpMbtMeLine * meline1
The moving edge containers (first line of the cylinder)
void setMeanWeight1(const double wmean)
void setVisible(bool _isvisible)
vpPoint * p2
The second extremity on the axe.
Class that defines what is a cylinder.
Definition: vpCylinder.h:93
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72
vpColVector error
The error vector.
vpCircle * cercle1
The upper circle limiting the cylinder.
bool Reinit
Indicates if the line has to be reinitialized.
double radius
The radius of the cylinder.
unsigned int nbFeaturel2
The number of moving edges on line 2.
void setName(const std::string &cyl_name)
Class that defines what is a circle.
Definition: vpCircle.h:57
vpMbtMeLine * meline2
The moving edge containers (second line of the cylinder)
std::string getName() const
void getCameraParameters(vpCameraParameters &camera)
void setTracked(const bool &track)