ViSP  2.6.2
vpMbtDistanceLine.h
1 /****************************************************************************
2  *
3  * $Id: vpMbtDistanceLine.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  *
34  * Description:
35  * Make the complete tracking of an object by using its CAD model
36  *
37  * Authors:
38  * Nicolas Melchior
39  * Romain Tallonneau
40  * Eric Marchand
41  *
42  *****************************************************************************/
43 
44 #ifndef DOXYGEN_SHOULD_SKIP_THIS
45 
51 #ifndef vpMbtDistanceLine_HH
52 #define vpMbtDistanceLine_HH
53 
54 #include <visp/vpPoint.h>
55 #include <visp/vpMbtMeLine.h>
56 #include <visp/vpLine.h>
57 #include <visp/vpHomogeneousMatrix.h>
58 #include <visp/vpFeatureLine.h>
59 #include <visp/vpMbtHiddenFace.h>
60 
61 #include <list>
62 
69 class VISP_EXPORT vpMbtDistanceLine
70 {
71  private :
72  std::string name;
73  unsigned int index;
75  vpMe *me;
76  double alpha;
77  double wmean;
78  vpFeatureLine featureline ;
79 
80  public:
82  vpMbtMeLine *meline;
84  vpLine *line;
86  vpPoint *p1;
88  vpPoint *p2;
90  vpMatrix L;
92  vpColVector error;
94  unsigned int nbFeature;
96  bool Reinit;
98  vpMbtHiddenFaces *hiddenface;
100  std::list<int> Lindex_polygon;
102  bool isvisible;
103 
104  public:
105  vpMbtDistanceLine() ;
106  ~vpMbtDistanceLine() ;
107 
113  inline void getCameraParameters(vpCameraParameters& cam) {cam = this->cam;}
114 
119  inline void setCameraParameters(const vpCameraParameters& cam) {this->cam = cam;}
120 
127  inline double getMeanWeight() const {return wmean;}
128 
134  inline void setMeanWeight(const double wmean) {this->wmean = wmean;}
135 
141  inline void setVisible(bool _isvisible) {isvisible = _isvisible ;}
142 
148  inline bool isVisible() const {return isvisible; }
149 
155  inline void setIndex(const unsigned int i) {index = i;}
156 
162  inline unsigned int getIndex() {return index ;}
163 
169  inline std::string getName() const {return name;}
170 
176  inline void setName(const std::string name) {this->name = name;}
177 
183  inline void setName(const char* name) {this->name = name;}
184 
185  void setMovingEdge(vpMe *Me);
186 
187  void buildFrom(vpPoint &_p1, vpPoint &_p2);
188 
189  void initMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
190  void trackMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
191  void updateMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
192 
193  void initInteractionMatrixError();
194  void computeInteractionMatrixError(const vpHomogeneousMatrix &cMo);
195  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);
196  void display(const vpImage<vpRGBa> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor col, const unsigned int thickness = 1, const bool displayFullModel = false);
197  void displayMovingEdges(const vpImage<unsigned char> &I);
198 
199  bool closeToImageBorder(const vpImage<unsigned char>& I, const unsigned int threshold);
200 
201  void reinitMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
202 
203  private:
204  void project(const vpHomogeneousMatrix &cMo);
205  void setFace( vpMbtHiddenFaces *_hiddenface) { hiddenface = _hiddenface ; }
206  void belongToPolygon(int index) { Lindex_polygon.push_back(index); }
207 
208 } ;
209 
210 #endif
211 #endif
212 
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
Class that defines a line in the object frame, the camera frame and the image plane. All the parameters must be set in meter.
Definition: vpLine.h:124
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 provides a data structure for the column vectors as well as a set of operations on these v...
Definition: vpColVector.h:72