Visual Servoing Platform  version 3.0.0
vpBasicFeature.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2015 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  };
87 
88 protected:
92  unsigned int dim_s ;
93  //int featureLine[8] ;
95  bool *flags;
97  unsigned int nbParameters;
98 
99 public:
101  unsigned int dimension_s() { return dim_s ; }
102 
103 public:
104 
105  virtual void init() = 0 ;
106 
107  vpBasicFeature() ;
108  vpBasicFeature(const vpBasicFeature &f) ;
109  vpBasicFeature &operator=(const vpBasicFeature &f) ;
110  virtual ~vpBasicFeature();
112  virtual inline double operator[](const unsigned int i) const { return s[i]; }
113 
115  static unsigned int selectAll() { return FEATURE_ALL ; }
116 
117  // Get the feature vector.
118  vpColVector get_s(unsigned int select=FEATURE_ALL) const;
119 
120  // Get the feature vector dimension.
121  unsigned int getDimension(const unsigned int select=FEATURE_ALL) const;
123  virtual vpMatrix interaction(const unsigned int select = FEATURE_ALL) = 0;
124  virtual vpColVector error(const vpBasicFeature &s_star,
125  const unsigned int select= FEATURE_ALL);
127  virtual void print(const unsigned int select= FEATURE_ALL) const = 0 ;
128 
129  virtual vpBasicFeature *duplicate() const = 0 ;
130 
131 public:
132  virtual void display(const vpCameraParameters &cam,
133  const vpImage<unsigned char> &I,
134  const vpColor &color=vpColor::green,
135  unsigned int thickness=1) const = 0;
136  virtual void display(const vpCameraParameters &cam,
137  const vpImage<vpRGBa> &I,
138  const vpColor &color=vpColor::green,
139  unsigned int thickness=1) const = 0;
140 
141  void setFlags();
142 
143 protected:
144  void resetFlags();
145  // memory issue (used by the vpServo class)
146 public:
147 
153  typedef enum
154  {
157  } vpBasicFeatureDeallocatorType;
158 
159 protected:
161 public:
162  void setDeallocate(vpBasicFeatureDeallocatorType d) { deallocate = d ; }
164 } ;
165 
166 #endif
167 
168 /*
169  * Local variables:
170  * c-basic-offset: 2
171  * End:
172  */
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:92
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.