ViSP  2.6.2
vpMbtDistanceCylinder.h
1 /****************************************************************************
2  *
3  * $Id: vpMbtDistanceCylinder.h 3530 2012-01-03 10:52:12Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2012 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  * Make the complete tracking of an object by using its CAD model. Cylinder
35  * tracking.
36  *
37  * Authors:
38  * Nicolas Melchior
39  * Romain Tallonneau
40  * Eric Marchand
41  * Bertrand Delabarre
42  *
43  *****************************************************************************/
44 
45 #ifndef DOXYGEN_SHOULD_SKIP_THIS
46 
52 #ifndef vpMbtDistanceCylinder_HH
53 #define vpMbtDistanceCylinder_HH
54 
55 #include <visp/vpPoint.h>
56 #include <visp/vpMbtMeLine.h>
57 #include <visp/vpLine.h>
58 #include <visp/vpHomogeneousMatrix.h>
59 #include <visp/vpFeatureLine.h>
60 #include <visp/vpCylinder.h>
61 #include <visp/vpCircle.h>
62 
63 class VISP_EXPORT vpMbtDistanceCylinder
64 {
65  private :
66  std::string name;
67  unsigned int index;
69  vpMe *me;
70  double alpha;
71  double wmean1;
72  double wmean2;
73  vpFeatureLine featureline1 ;
74  vpFeatureLine featureline2 ;
75 
76  public:
78  vpMbtMeLine *meline1;
80  vpMbtMeLine *meline2;
81 
83  vpCircle *cercle1;
85  vpCircle *cercle2;
86 
88  double radius;
89 
91  vpPoint *p1;
93  vpPoint *p2;
94 
96  vpMatrix L;
98  vpColVector error;
100  unsigned int nbFeature;
102  unsigned int nbFeaturel1;
104  unsigned int nbFeaturel2;
106  bool Reinit;
108  vpCylinder *c;
109 
110  public:
111  vpMbtDistanceCylinder() ;
112  ~vpMbtDistanceCylinder() ;
113 
119  inline void getCameraParameters(vpCameraParameters& cam) {cam = this->cam;}
120 
125  inline void setCameraParameters(const vpCameraParameters& cam) {this->cam = cam;}
126 
133  inline double getMeanWeight1() const {return wmean1;}
134 
140  inline void setMeanWeight1(const double wmean) {this->wmean1 = wmean;}
141 
148  inline double getMeanWeight2() const {return wmean2;}
149 
155  inline void setMeanWeight2(const double wmean) {this->wmean2 = wmean;}
156 
162  inline void setIndex(const unsigned int i) {index = i;}
163 
169  inline unsigned int getIndex() {return index ;}
170 
176  inline std::string getName() const {return name;}
177 
183  inline void setName(const std::string& name) {this->name = name;}
184 
190  inline void setName(const char* name) {this->name = name;}
191 
192  void setMovingEdge(vpMe *Me);
193 
194  void buildFrom(const vpPoint &_p1, const vpPoint &_p2, const double r);
195 
196  void initMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
197  void trackMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
198  void updateMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
199 
200  void initInteractionMatrixError();
201  void computeInteractionMatrixError(const vpHomogeneousMatrix &cMo, const vpImage<unsigned char> &I);
202  void display(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor col, const unsigned int thickness = 1);
203  void display(const vpImage<vpRGBa> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor col, const unsigned int thickness = 1);
204  void displayMovingEdges(const vpImage<unsigned char> &I);
205 
206  void reinitMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
207 
208  private:
209  void project(const vpHomogeneousMatrix &cMo);
210 
211  void getCylinderLineExtremity(double &i, double &j,double rho, double theta, vpCircle *circle);
212 
213 } ;
214 
215 #endif
216 #endif
217 
Definition of the vpMatrix class.
Definition: vpMatrix.h:96
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
Class to define colors available for display functionnalities.
Definition: vpColor.h:123
Contains predetermined masks for sites and holds moving edges tracking parameters.
Definition: vpMe.h:70
Class that defines what is a point.
Definition: vpPoint.h:65
Generic class defining intrinsic camera parameters.
Class that defines a 2D line visual feature which is composed by two parameters that are and ...
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
Class that defines what is a circle.
Definition: vpCircle.h:61