Visual Servoing Platform  version 3.0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
vpBasicFeature.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2017 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * ("GPL") version 2 as published by the Free Software Foundation.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ViSP with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * See http://visp.inria.fr for more information.
17  *
18  * This software was developed at:
19  * Inria Rennes - Bretagne Atlantique
20  * Campus Universitaire de Beaulieu
21  * 35042 Rennes Cedex
22  * France
23  *
24  * If you have questions regarding the use of this file, please contact
25  * Inria at visp@inria.fr
26  *
27  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29  *
30  * Description:
31  * Visual feature.
32  *
33  * Authors:
34  * Eric Marchand
35  * Nicolas Mansard
36  *
37  *****************************************************************************/
38 
39 
40 
41 #ifndef vpBasicFeature_H
42 #define vpBasicFeature_H
43 
49 #include <visp3/core/vpMatrix.h>
50 #include <visp3/core/vpColVector.h>
51 
52 // Display Issue
53 
54 // Meter/pixel conversion
55 #include <visp3/core/vpCameraParameters.h>
56 
57 //Color / image / display
58 #include <visp3/core/vpColor.h>
59 #include <visp3/core/vpImage.h>
60 #include <visp3/core/vpRGBa.h>
61 
62 // #define FEATURE_ALL 0xff
63 
64 // #define FEATURE_LINE1 0x1
65 // #define FEATURE_LINE2 0x2
66 // #define FEATURE_LINE3 0x4
67 // #define FEATURE_LINE4 0x8
68 // #define FEATURE_LINE5 0x10
69 // #define FEATURE_LINE6 0x20
70 // #define FEATURE_LINE7 0x40
71 // #define FEATURE_LINE8 0x80
72 
73 
79 class VISP_EXPORT vpBasicFeature
80 {
81 public: // Public constantes
82  static const unsigned int FEATURE_LINE [32];
83 
84  enum {
85  FEATURE_ALL = 0xffff
86  };
92  typedef enum
93  {
96  } vpBasicFeatureDeallocatorType;
97 
98 protected:
102  unsigned int dim_s ;
103  //int featureLine[8] ;
105  bool *flags;
107  unsigned int nbParameters;
108 
109 public:
110  vpBasicFeature() ;
111  vpBasicFeature(const vpBasicFeature &f) ;
112  virtual ~vpBasicFeature();
113 
117  unsigned int dimension_s() { return dim_s ; }
118 
119  virtual void display(const vpCameraParameters &cam,
120  const vpImage<unsigned char> &I,
121  const vpColor &color=vpColor::green,
122  unsigned int thickness=1) const = 0;
123  virtual void display(const vpCameraParameters &cam,
124  const vpImage<vpRGBa> &I,
125  const vpColor &color=vpColor::green,
126  unsigned int thickness=1) const = 0;
127 
128  virtual void init() = 0 ;
129 
130  virtual vpColVector error(const vpBasicFeature &s_star,
131  const unsigned int select= FEATURE_ALL);
132 
133  // Get the feature vector.
134  vpColVector get_s(unsigned int select=FEATURE_ALL) const;
136 
137  // Get the feature vector dimension.
138  unsigned int getDimension(const unsigned int select=FEATURE_ALL) const;
140  virtual vpMatrix interaction(const unsigned int select = FEATURE_ALL) = 0;
142  virtual inline double operator[](const unsigned int i) const { return s[i]; }
143  vpBasicFeature &operator=(const vpBasicFeature &f) ;
145  virtual void print(const unsigned int select= FEATURE_ALL) const = 0 ;
146 
147  virtual vpBasicFeature *duplicate() const = 0 ;
148 
149  void setDeallocate(vpBasicFeatureDeallocatorType d) { deallocate = d ; }
150  void setFlags();
152 
154  static unsigned int selectAll() { return FEATURE_ALL ; }
155 
156 protected:
157  void resetFlags();
158 
159 protected:
161 } ;
162 
163 #endif
164 
165 /*
166  * Local variables:
167  * c-basic-offset: 2
168  * End:
169  */
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:97
bool * flags
Ensure that all the parameters needed to compute the iteraction matrix are set.
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:121
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:166
class that defines what is a visual feature
Generic class defining intrinsic camera parameters.
vpBasicFeatureDeallocatorType deallocate
Implementation of column vector and the associated operations.
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.