ViSP  2.10.0
vpMbtDistanceCylinder.h
1 /****************************************************************************
2  *
3  * $Id: vpMbtDistanceCylinder.h 4914 2014-10-02 13:25:47Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2014 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  * Description:
34  * Manage a cylinder used in the model-based tracker.
35  *
36  * Authors:
37  * Nicolas Melchior
38  * Romain Tallonneau
39  * Eric Marchand
40  * Bertrand Delabarre
41  *
42  *****************************************************************************/
43 
49 #ifndef vpMbtDistanceCylinder_HH
50 #define vpMbtDistanceCylinder_HH
51 
52 #include <visp/vpPoint.h>
53 #include <visp/vpMbtMeLine.h>
54 #include <visp/vpLine.h>
55 #include <visp/vpHomogeneousMatrix.h>
56 #include <visp/vpFeatureLine.h>
57 #include <visp/vpCylinder.h>
58 #include <visp/vpCircle.h>
59 #include <visp/vpMbHiddenFaces.h>
60 
68 class VISP_EXPORT vpMbtDistanceCylinder
69 {
70  private :
71  std::string name;
72  unsigned int index;
74  vpMe *me;
75  double alpha;
76  double wmean1;
77  double wmean2;
78  vpFeatureLine featureline1 ;
79  vpFeatureLine featureline2 ;
80 
81  public:
83  vpMbtMeLine *meline1;
85  vpMbtMeLine *meline2;
86 
91 
93  double radius;
94 
99 
105  unsigned int nbFeature;
107  unsigned int nbFeaturel1;
109  unsigned int nbFeaturel2;
111  bool Reinit;
114 
120  bool isvisible;
121 
122  public:
125 
126  void buildFrom(const vpPoint &_p1, const vpPoint &_p2, const double r);
127 
128  void computeInteractionMatrixError(const vpHomogeneousMatrix &cMo, const vpImage<unsigned char> &I);
129 
130  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);
131  void display(const vpImage<vpRGBa> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor col, const unsigned int thickness = 1, const bool displayFullModel = false);
132  void displayMovingEdges(const vpImage<unsigned char> &I);
133 
139  inline void getCameraParameters(vpCameraParameters& camera) {camera = this->cam;}
140 
146  inline unsigned int getIndex() {return index ;}
147 
154  inline double getMeanWeight1() const {return wmean1;}
155 
162  inline double getMeanWeight2() const {return wmean2;}
163 
169  inline std::string getName() const {return name;}
170 
171  void initInteractionMatrixError();
172 
173  bool initMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
174 
180  inline bool isVisible() const {return isvisible; }
181 
182  void reinitMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
183 
188  inline void setCameraParameters(const vpCameraParameters& camera) {this->cam = camera;}
189 
195  inline void setIndex(const unsigned int i) {index = i;}
196 
202  inline void setMeanWeight1(const double wmean) {this->wmean1 = wmean;}
203 
209  inline void setMeanWeight2(const double wmean) {this->wmean2 = wmean;}
210 
211  void setMovingEdge(vpMe *Me);
212 
218  inline void setName(const std::string& cyl_name) {this->name = cyl_name;}
219 
225  inline void setName(const char* cyl_name) {this->name = std::string(cyl_name);}
226 
232  inline void setVisible(bool _isvisible) {isvisible = _isvisible ;}
233 
234  void trackMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
235 
236  void updateMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
237 
238  private:
239  void getCylinderLineExtremity(double &i, double &j,double rho, double theta, vpCircle *circle);
240  void project(const vpHomogeneousMatrix &cMo);
241 } ;
242 
243 #endif
244 
Definition of the vpMatrix class.
Definition: vpMatrix.h:98
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)
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
void setCameraParameters(const vpCameraParameters &camera)
Class to define colors available for display functionnalities.
Definition: vpColor.h:125
Manage a cylinder used in the model-based tracker.
Contains predetermined masks for sites and holds moving edges tracking parameters.
Definition: vpMe.h:70
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:65
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:97
Class that provides a data structure for the column vectors as well as a set of operations on these v...
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:61
vpMbtMeLine * meline2
The moving edge containers (second line of the cylinder)
std::string getName() const
void getCameraParameters(vpCameraParameters &camera)