ViSP  2.7.0
vpMbtPolygon.h
1 /****************************************************************************
2  *
3  * $Id: vpMbtPolygon.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  *
34  * Description:
35  * Implements a polygon of the model used by the model-based tracker.
36  *
37  * Authors:
38  * Nicolas Melchior
39  * Romain Tallonneau
40  * Eric Marchand
41  * Aurelien Yol
42  *
43  *****************************************************************************/
44 
50 #ifndef vpMbtPolygon_HH
51 #define vpMbtPolygon_HH
52 
53 #include <visp/vpPoint.h>
54 #include <visp/vpMeterPixelConversion.h>
55 #include <visp/vpPixelMeterConversion.h>
56 
57 #include <vector>
58 
67 class VISP_EXPORT vpMbtPolygon
68 {
69 public:
71  int index;
73  unsigned int nbpt;
75  bool isvisible;
80 
81 public:
82  vpMbtPolygon() ;
83  virtual ~vpMbtPolygon() ;
84 
85  void addPoint(const unsigned int n, const vpPoint &P) ;
86 
87  void changeFrame(const vpHomogeneousMatrix &cMo) ;
88 
94  inline int getIndex() const {return index ;}
95 
101  inline unsigned int getNbPoint() const {return nbpt ;}
102 
103  vpPoint & getPoint(const unsigned int _index);
104 
105  std::vector<vpImagePoint> getRoi(const vpCameraParameters &_cam);
106 
107  inline bool isAppearing() const {return isappearing;}
108  bool isVisible(const vpHomogeneousMatrix &cMo, const bool &depthTest = false) ;
109  virtual bool isVisible(const vpHomogeneousMatrix &cMo, const double alpha) ;
110  bool isVisible() const {return isvisible;}
111 
117  virtual inline void setIndex(const int i ) { index = i ; }
118  virtual void setNbPoint(const unsigned int nb) ;
119 
120 public:
121  static void getMinMaxRoi(const std::vector<vpImagePoint> &roi, int & i_min, int &i_max, int &j_min, int &j_max);
122  static bool roiInsideImage(const vpImage<unsigned char>& I, const std::vector<vpImagePoint>& corners);
123 };
124 
125 #endif
126 
bool isVisible() const
Definition: vpMbtPolygon.h:110
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
int index
Index of the polygon. Cannot be unsigned int because deafult value is -1.
Definition: vpMbtPolygon.h:71
unsigned int nbpt
Number of points used to define the polygon.
Definition: vpMbtPolygon.h:73
Class that defines what is a point.
Definition: vpPoint.h:65
bool isAppearing() const
Definition: vpMbtPolygon.h:107
Implementation of a polygon of the model used by the model-based tracker.
Definition: vpMbtPolygon.h:67
int getIndex() const
Definition: vpMbtPolygon.h:94
Generic class defining intrinsic camera parameters.
bool isappearing
flag to specify whether the face is appearing or not
Definition: vpMbtPolygon.h:77
unsigned int getNbPoint() const
Definition: vpMbtPolygon.h:101
bool isvisible
flag to specify whether the face is visible or not
Definition: vpMbtPolygon.h:75
virtual void setIndex(const int i)
Definition: vpMbtPolygon.h:117
vpPoint * p
corners in the object frame
Definition: vpMbtPolygon.h:79