Visual Servoing Platform version 3.6.0
Loading...
Searching...
No Matches
vpBasicFeature.h
1/****************************************************************************
2 *
3 * ViSP, open source Visual Servoing Platform software.
4 * Copyright (C) 2005 - 2023 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 https://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 * Nicolas Mansard
36 *
37*****************************************************************************/
38
39#ifndef vpBasicFeature_H
40#define vpBasicFeature_H
47#include <visp3/core/vpColVector.h>
48#include <visp3/core/vpMatrix.h>
49
50// Display Issue
51
52// Meter/pixel conversion
53#include <visp3/core/vpCameraParameters.h>
54
55// Color / image / display
56#include <visp3/core/vpColor.h>
57#include <visp3/core/vpImage.h>
58#include <visp3/core/vpRGBa.h>
59
60// #define FEATURE_ALL 0xff
61
62// #define FEATURE_LINE1 0x1
63// #define FEATURE_LINE2 0x2
64// #define FEATURE_LINE3 0x4
65// #define FEATURE_LINE4 0x8
66// #define FEATURE_LINE5 0x10
67// #define FEATURE_LINE6 0x20
68// #define FEATURE_LINE7 0x40
69// #define FEATURE_LINE8 0x80
70
76class VISP_EXPORT vpBasicFeature
77{
78public: // Public constantes
79 static const unsigned int FEATURE_LINE[32];
80
81 enum { FEATURE_ALL = 0xffff };
87 typedef enum { user, vpServo } vpBasicFeatureDeallocatorType;
88
89protected:
93 unsigned int dim_s;
94 // int featureLine[8] ;
97 bool *flags;
99 unsigned int nbParameters;
100
101public:
104 virtual ~vpBasicFeature();
105
109 unsigned int dimension_s() { return dim_s; }
110
111 virtual void display(const vpCameraParameters &cam, const vpImage<unsigned char> &I,
112 const vpColor &color = vpColor::green, unsigned int thickness = 1) const = 0;
113 virtual void display(const vpCameraParameters &cam, const vpImage<vpRGBa> &I, const vpColor &color = vpColor::green,
114 unsigned int thickness = 1) const = 0;
115
116 virtual void init() = 0;
117
118 virtual vpColVector error(const vpBasicFeature &s_star, unsigned int select = FEATURE_ALL);
119
120 // Get the feature vector.
121 vpColVector get_s(unsigned int select = FEATURE_ALL) const;
123
124 // Get the feature vector dimension.
125 unsigned int getDimension(unsigned int select = FEATURE_ALL) const;
127 virtual vpMatrix interaction(unsigned int select = FEATURE_ALL) = 0;
129 virtual inline double operator[](unsigned int i) const { return s[i]; }
130 vpBasicFeature &operator=(const vpBasicFeature &f);
132 virtual void print(unsigned int select = FEATURE_ALL) const = 0;
133
134 virtual vpBasicFeature *duplicate() const = 0;
135
137 void setFlags();
139
141 static unsigned int selectAll() { return FEATURE_ALL; }
142
143protected:
144 void resetFlags();
145
146protected:
148};
149
150#endif
class that defines what is a visual feature
vpColVector s
State of the visual feature.
vpBasicFeatureDeallocatorType getDeallocate()
virtual void init()=0
unsigned int nbParameters
Number of parameters needed to compute the interaction matrix.
virtual void display(const vpCameraParameters &cam, const vpImage< vpRGBa > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const =0
virtual vpMatrix interaction(unsigned int select=FEATURE_ALL)=0
Compute the interaction matrix from a subset of the possible features.
static unsigned int selectAll()
Select all the features.
void setDeallocate(vpBasicFeatureDeallocatorType d)
virtual void print(unsigned int select=FEATURE_ALL) const =0
Print the name of the feature.
virtual double operator[](unsigned int i) const
Return element i in the state vector (usage : x = s[i] )
virtual void display(const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const =0
unsigned int dimension_s()
virtual vpBasicFeature * duplicate() const =0
unsigned int dim_s
Dimension of the visual feature.
vpBasicFeatureDeallocatorType deallocate
Generic class defining intrinsic camera parameters.
Implementation of column vector and the associated operations.
Class to define RGB colors available for display functionalities.
Definition vpColor.h:152
static const vpColor green
Definition vpColor.h:214
Definition of the vpImage class member functions.
Definition vpImage.h:135
Implementation of a matrix and operations on matrices.
Definition vpMatrix.h:152