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