ViSP
 All Classes Functions Variables Enumerations Enumerator Friends Groups Pages
vpMbtDistanceCylinder.h
1 /****************************************************************************
2  *
3  * $Id: vpMbtDistanceCylinder.h 4056 2013-01-05 13:04:42Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2013 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& cam) {cam = 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& cam) {this->cam = cam;}
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& name) {this->name = name;}
204 
210  inline void setName(const char* name) {this->name = name;}
211 
212 
213  void trackMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
214 
215  void updateMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
216 
217  private:
218  void getCylinderLineExtremity(double &i, double &j,double rho, double theta, vpCircle *circle);
219  void project(const vpHomogeneousMatrix &cMo);
220 } ;
221 
222 #endif
223