Visual Servoing Platform  version 3.0.0
vpFeatureEllipse.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  * 2D ellipse visual feature.
32  *
33  * Authors:
34  * Eric Marchand
35  *
36  *****************************************************************************/
37 
38 
39 
40 #ifndef vpFeatureEllipse_H
41 #define vpFeatureEllipse_H
42 
48 #include <visp3/core/vpMatrix.h>
49 #include <visp3/visual_features/vpBasicFeature.h>
50 
51 #include <visp3/core/vpHomogeneousMatrix.h>
52 #include <visp3/core/vpRGBa.h>
53 
54 
60 class VISP_EXPORT vpFeatureEllipse : public vpBasicFeature
61 {
62  /*
63  attributes and members directly related to the vpBasicFeature needs
64  other functionalities are useful but not mandatory
65  */
66 private:
69  double A,B,C ;
70 
71 
72 public:
74  void init() ;
78  virtual ~vpFeatureEllipse() { }
79 
80 public:
84  vpFeatureEllipse(const double x, const double y,
86  const double mu20, const double mu11, const double mu02);
87 
88  // void buildFrom(const vpEllipse &p) ;
89  void buildFrom(const double x, const double y,
90  const double mu20, const double mu11, const double mu02) ;
91  void buildFrom(const double x, const double y,
92  const double mu20, const double mu11, const double mu02,
93  const double A, const double B, const double C) ;
94  void set_x(const double x);
95  void set_y(const double y);
96  void set_xy(const double x,const double y);
97  void setABC(const double A, const double B, const double C) ;
98  void setMu(const double mu20, const double mu11, const double mu02) ;
99 
100  double get_x() const {return s[0];}
101  double get_y() const {return s[1];}
102  double getMu20() const {return s[2];}
103  double getMu11() const {return s[3];}
104  double getMu02() const {return s[4];}
105 
106 public:
111  // feature selection
112  static unsigned int selectX();
113  static unsigned int selectY();
114  static unsigned int selectMu20();
115  static unsigned int selectMu11();
116  static unsigned int selectMu02();
117 
119  vpMatrix interaction(const unsigned int select = FEATURE_ALL);
122  vpColVector error(const vpBasicFeature &s_star,
123  const unsigned int select = FEATURE_ALL) ;
125  vpColVector error(const unsigned int select = FEATURE_ALL) ;
127  void print(const unsigned int select = FEATURE_ALL ) const ;
128 
130  vpFeatureEllipse *duplicate() const ;
131 
132 
133 public:
134  void display(const vpCameraParameters &cam,
135  const vpImage<unsigned char> &I,
136  const vpColor &color=vpColor::green,
137  unsigned int thickness=1) const ;
138  void display(const vpCameraParameters &cam,
139  const vpImage<vpRGBa> &I,
140  const vpColor &color=vpColor::green,
141  unsigned int thickness=1) const ;
142 } ;
143 
144 
145 
146 #endif
147 
148 /*
149  * Local variables:
150  * c-basic-offset: 2
151  * End:
152  */
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:92
virtual void print(const unsigned int select=FEATURE_ALL) const =0
Print the name of the feature.
Class to define colors available for display functionnalities.
Definition: vpColor.h:121
double getMu02() const
double get_y() const
double getMu20() const
virtual vpColVector error(const vpBasicFeature &s_star, const unsigned int select=FEATURE_ALL)
Compute the error between two visual features from a subset of the possible features.
static const vpColor green
Definition: vpColor.h:166
double getMu11() const
class that defines what is a visual feature
virtual vpMatrix interaction(const unsigned int select=FEATURE_ALL)=0
Compute the interaction matrix from a subset of the possible features.
Generic class defining intrinsic camera parameters.
virtual ~vpFeatureEllipse()
Destructor.
virtual void init()=0
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72
double get_x() const
virtual vpBasicFeature * duplicate() const =0
Class that defines 2D ellipse visual feature.
virtual void display(const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const =0