ViSP  2.9.0
vpMbtDistanceCylinder.h
1 /****************************************************************************
2  *
3  * $Id: vpMbtDistanceCylinder.h 4649 2014-02-07 14:57:11Z 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 
67 class VISP_EXPORT vpMbtDistanceCylinder
68 {
69  private :
70  std::string name;
71  unsigned int index;
73  vpMe *me;
74  double alpha;
75  double wmean1;
76  double wmean2;
77  vpFeatureLine featureline1 ;
78  vpFeatureLine featureline2 ;
79 
80  public:
85 
90 
92  double radius;
93 
98 
104  unsigned int nbFeature;
106  unsigned int nbFeaturel1;
108  unsigned int nbFeaturel2;
110  bool Reinit;
113 
114  public:
117 
118  void buildFrom(const vpPoint &_p1, const vpPoint &_p2, const double r);
119 
120  void computeInteractionMatrixError(const vpHomogeneousMatrix &cMo, const vpImage<unsigned char> &I);
121 
122  void display(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor col, const unsigned int thickness = 1);
123  void display(const vpImage<vpRGBa> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor col, const unsigned int thickness = 1);
124  void displayMovingEdges(const vpImage<unsigned char> &I);
125 
131  inline void getCameraParameters(vpCameraParameters& camera) {camera = this->cam;}
132 
138  inline unsigned int getIndex() {return index ;}
139 
146  inline double getMeanWeight1() const {return wmean1;}
147 
154  inline double getMeanWeight2() const {return wmean2;}
155 
161  inline std::string getName() const {return name;}
162 
163  void initInteractionMatrixError();
164 
165  void initMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
166 
167  void reinitMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
168 
173  inline void setCameraParameters(const vpCameraParameters& camera) {this->cam = camera;}
174 
180  inline void setIndex(const unsigned int i) {index = i;}
181 
187  inline void setMeanWeight1(const double wmean) {this->wmean1 = wmean;}
188 
194  inline void setMeanWeight2(const double wmean) {this->wmean2 = wmean;}
195 
196  void setMovingEdge(vpMe *Me);
197 
203  inline void setName(const std::string& cyl_name) {this->name = cyl_name;}
204 
210  inline void setName(const char* cyl_name) {this->name = std::string(cyl_name);}
211 
212  void trackMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
213 
214  void updateMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
215 
216  private:
217  void getCylinderLineExtremity(double &i, double &j,double rho, double theta, vpCircle *circle);
218  void project(const vpHomogeneousMatrix &cMo);
219 } ;
220 
221 #endif
222 
Definition of the vpMatrix class.
Definition: vpMatrix.h:98
vpCylinder * c
The cylinder.
void setName(const char *cyl_name)
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)
Implementation of a line used by the model-based tracker.
Definition: vpMbtMeLine.h:62
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.
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)
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)