ViSP  2.9.0
vpMbtDistanceLine.h
1 /****************************************************************************
2  *
3  * $Id: vpMbtDistanceLine.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  *
34  * Description:
35  * Manage the line of a polygon used in the model-based tracker.
36  *
37  * Authors:
38  * Nicolas Melchior
39  * Romain Tallonneau
40  * Eric Marchand
41  *
42  *****************************************************************************/
43 
49 #ifndef vpMbtDistanceLine_HH
50 #define vpMbtDistanceLine_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/vpMbHiddenFaces.h>
58 
59 #include <list>
60 
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 ;
80  vpMbtPolygon poly;
81 
82  public:
96  unsigned int nbFeature;
98  bool Reinit;
102  std::list<int> Lindex_polygon;
104  bool isvisible;
105 
106  public:
108  ~vpMbtDistanceLine() ;
109 
110  void buildFrom(vpPoint &_p1, vpPoint &_p2);
111 
112  bool closeToImageBorder(const vpImage<unsigned char>& I, const unsigned int threshold);
113  void computeInteractionMatrixError(const vpHomogeneousMatrix &cMo);
114 
115  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);
116  void display(const vpImage<vpRGBa> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor col, const unsigned int thickness = 1, const bool displayFullModel = false);
117  void displayMovingEdges(const vpImage<unsigned char> &I);
118 
124  inline void getCameraParameters(vpCameraParameters& camera) const {camera = this->cam;}
125 
131  inline unsigned int getIndex() const {return index ;}
132 
139  inline double getMeanWeight() const {return wmean;}
140 
146  inline std::string getName() const {return name;}
147 
153  inline vpMbtPolygon& getPolygon() {return poly;}
154 
155  void initInteractionMatrixError();
156 
157  void initMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
158 
164  inline bool isVisible() const {return isvisible; }
165 
166  void reinitMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
167 
172  inline void setCameraParameters(const vpCameraParameters& camera) {this->cam = camera;}
173 
179  inline void setIndex(const unsigned int i) {index = i;}
180 
186  inline void setMeanWeight(const double w_mean) {this->wmean = w_mean;}
187 
188  void setMovingEdge(vpMe *Me);
189 
195  inline void setName(const std::string line_name) {this->name = line_name;}
196 
202  inline void setName(const char* line_name) {this->name = std::string(line_name);}
203 
209  inline void setVisible(bool _isvisible) {isvisible = _isvisible ;}
210 
211  void trackMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
212 
213  void updateMovingEdge(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo);
214 
215  private:
216  void belongToPolygon(int index_) { Lindex_polygon.push_back(index_); }
217  void project(const vpHomogeneousMatrix &cMo);
218  void setFace( vpMbHiddenFaces<vpMbtPolygon> *_hiddenface) { hiddenface = _hiddenface ; }
219 
220 
221 } ;
222 
223 #endif
224 
Definition of the vpMatrix class.
Definition: vpMatrix.h:98
void getCameraParameters(vpCameraParameters &camera) const
void setVisible(bool _isvisible)
vpLine * line
The 3D line.
std::string getName() const
bool Reinit
Indicates if the line has to be reinitialized.
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
std::list< int > Lindex_polygon
Index of the faces which contain the line.
void setName(const char *line_name)
Class to define colors available for display functionnalities.
Definition: vpColor.h:125
vpPoint * p1
The first extremity.
unsigned int getIndex() const
Contains predetermined masks for sites and holds moving edges tracking parameters.
Definition: vpMe.h:70
Manage the line of a polygon used in the model-based tracker.
Implementation of a line used by the model-based tracker.
Definition: vpMbtMeLine.h:62
vpMbtPolygon & getPolygon()
bool isvisible
Indicates if the line is visible or not.
unsigned int nbFeature
The number of moving edges.
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
Implementation of a polygon of the model used by the model-based tracker.
Definition: vpMbtPolygon.h:67
vpPoint * p2
The second extremity.
vpColVector error
The error vector.
bool isVisible() const
Generic class defining intrinsic camera parameters.
Class that defines a 2D line visual feature which is composed by two parameters that are and ...
void setIndex(const unsigned int i)
void setCameraParameters(const vpCameraParameters &camera)
Class that provides a data structure for the column vectors as well as a set of operations on these v...
Definition: vpColVector.h:72
double getMeanWeight() const
vpMbHiddenFaces< vpMbtPolygon > * hiddenface
Pointer to the list of faces.
void setMeanWeight(const double w_mean)
void setName(const std::string line_name)
vpMatrix L
The interaction matrix.
vpMbtMeLine * meline
The moving edge container.