ViSP  2.8.0
vpBasicFeature.h
1 /****************************************************************************
2  *
3  * $Id: vpBasicFeature.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  * 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  virtual ~vpBasicFeature() { /*vpTRACE("0x%x", this)*/; }
111  virtual inline double operator[](const unsigned int i) const { return s[i]; }
112 
114  static unsigned int selectAll() { return FEATURE_ALL ; }
115 
116  // Get the feature vector.
117  vpColVector get_s(unsigned int select=FEATURE_ALL) const;
118 
119  // Get the feature vector dimension.
120  unsigned int getDimension(const unsigned int select=FEATURE_ALL) const;
122  virtual vpMatrix interaction(const unsigned int select = FEATURE_ALL) = 0;
123  virtual vpColVector error(const vpBasicFeature &s_star,
124  const unsigned int select= FEATURE_ALL);
126  virtual void print(const unsigned int select= FEATURE_ALL) const = 0 ;
127 
128  virtual vpBasicFeature *duplicate() const = 0 ;
129 
130 public:
131  virtual void display(const vpCameraParameters &cam,
132  const vpImage<unsigned char> &I,
133  const vpColor &color=vpColor::green,
134  unsigned int thickness=1) const = 0;
135  virtual void display(const vpCameraParameters &cam,
136  const vpImage<vpRGBa> &I,
137  const vpColor &color=vpColor::green,
138  unsigned int thickness=1) const = 0;
139 
140  void setFlags();
141 
142 protected:
143  void resetFlags();
144  // memory issue (used by the vpServo class)
145 public:
146 
152  typedef enum
153  {
156  } vpBasicFeatureDeallocatorType;
157 
158 protected:
160 public:
161  void setDeallocate(vpBasicFeatureDeallocatorType d) { deallocate = d ; }
163 } ;
164 
165 #endif
166 
167 /*
168  * Local variables:
169  * c-basic-offset: 2
170  * End:
171  */
Definition of the vpMatrix class.
Definition: vpMatrix.h:96
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()
Class required to compute the visual servoing control law descbribed in and .
Definition: vpServo.h:153
unsigned int nbParameters
Number of parameters needed to compute the interaction matrix.
vpColVector s
State of the visual feature.