ViSP  2.9.0
vpBasicFeature.h
1 /****************************************************************************
2  *
3  * $Id: vpBasicFeature.h 4632 2014-02-03 17:06:40Z 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  * Visual feature.
36  *
37  * Authors:
38  * Eric Marchand
39  * Nicolas Mansard
40  *
41  *****************************************************************************/
42 
43 
44 
45 #ifndef vpBasicFeature_H
46 #define vpBasicFeature_H
47 
53 #include <visp/vpMatrix.h>
54 #include <visp/vpColVector.h>
55 
56 // Display Issue
57 
58 // Meter/pixel conversion
59 #include <visp/vpCameraParameters.h>
60 
61 //Color / image / display
62 #include <visp/vpColor.h>
63 #include <visp/vpImage.h>
64 #include <visp/vpRGBa.h>
65 
66 // #define FEATURE_ALL 0xff
67 
68 // #define FEATURE_LINE1 0x1
69 // #define FEATURE_LINE2 0x2
70 // #define FEATURE_LINE3 0x4
71 // #define FEATURE_LINE4 0x8
72 // #define FEATURE_LINE5 0x10
73 // #define FEATURE_LINE6 0x20
74 // #define FEATURE_LINE7 0x40
75 // #define FEATURE_LINE8 0x80
76 
77 
82 class VISP_EXPORT vpBasicFeature
83 {
84 public: // Public constantes
85  static const unsigned int FEATURE_LINE [32];
86 
87  static const unsigned int FEATURE_ALL;
88 
89 protected:
93  unsigned int dim_s ;
94  //int featureLine[8] ;
96  bool *flags;
98  unsigned int nbParameters;
99 
100 public:
102  unsigned int dimension_s() { return dim_s ; }
103 
104 public:
105 
106  virtual void init() = 0 ;
107 
108  vpBasicFeature() ;
109  vpBasicFeature(const vpBasicFeature &f) ;
110  vpBasicFeature &operator=(const vpBasicFeature &f) ;
111  virtual ~vpBasicFeature() { /*vpTRACE("0x%x", this)*/; }
113  virtual inline double operator[](const unsigned int i) const { return s[i]; }
114 
116  static unsigned int selectAll() { return FEATURE_ALL ; }
117 
118  // Get the feature vector.
119  vpColVector get_s(unsigned int select=FEATURE_ALL) const;
120 
121  // Get the feature vector dimension.
122  unsigned int getDimension(const unsigned int select=FEATURE_ALL) const;
124  virtual vpMatrix interaction(const unsigned int select = FEATURE_ALL) = 0;
125  virtual vpColVector error(const vpBasicFeature &s_star,
126  const unsigned int select= FEATURE_ALL);
128  virtual void print(const unsigned int select= FEATURE_ALL) const = 0 ;
129 
130  virtual vpBasicFeature *duplicate() const = 0 ;
131 
132 public:
133  virtual void display(const vpCameraParameters &cam,
134  const vpImage<unsigned char> &I,
135  const vpColor &color=vpColor::green,
136  unsigned int thickness=1) const = 0;
137  virtual void display(const vpCameraParameters &cam,
138  const vpImage<vpRGBa> &I,
139  const vpColor &color=vpColor::green,
140  unsigned int thickness=1) const = 0;
141 
142  void setFlags();
143 
144 protected:
145  void resetFlags();
146  // memory issue (used by the vpServo class)
147 public:
148 
154  typedef enum
155  {
158  } vpBasicFeatureDeallocatorType;
159 
160 protected:
162 public:
163  void setDeallocate(vpBasicFeatureDeallocatorType d) { deallocate = d ; }
165 } ;
166 
167 #endif
168 
169 /*
170  * Local variables:
171  * c-basic-offset: 2
172  * End:
173  */
Definition of the vpMatrix class.
Definition: vpMatrix.h:98
bool * flags
Ensure that all the parameters needed to compute the iteraction matrix are set.
static const unsigned int FEATURE_ALL
void setDeallocate(vpBasicFeatureDeallocatorType d)
virtual double operator[](const unsigned int i) const
Return element i in the state vector (usage : x = s[i] )
Class to define colors available for display functionnalities.
Definition: vpColor.h:125
unsigned int dim_s
Dimension of the visual feature.
static unsigned int selectAll()
Select all the features.
unsigned int dimension_s()
static const vpColor green
Definition: vpColor.h:170
class that defines what is a visual feature
virtual ~vpBasicFeature()
Generic class defining intrinsic camera parameters.
vpBasicFeatureDeallocatorType deallocate
Class that provides a data structure for the column vectors as well as a set of operations on these v...
Definition: vpColVector.h:72
vpBasicFeatureDeallocatorType getDeallocate()
unsigned int nbParameters
Number of parameters needed to compute the interaction matrix.
vpColVector s
State of the visual feature.