Visual Servoing Platform  version 3.0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
vpFeatureEllipse.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2017 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:
76  virtual ~vpFeatureEllipse() { }
77 
81  vpFeatureEllipse(const double x, const double y,
83  const double mu20, const double mu11, const double mu02);
84 
85  // void buildFrom(const vpEllipse &p) ;
86  void buildFrom(const double x, const double y,
87  const double mu20, const double mu11, const double mu02) ;
88  void buildFrom(const double x, const double y,
89  const double mu20, const double mu11, const double mu02,
90  const double A, const double B, const double C) ;
91 
92  void display(const vpCameraParameters &cam,
93  const vpImage<unsigned char> &I,
94  const vpColor &color=vpColor::green,
95  unsigned int thickness=1) const ;
96  void display(const vpCameraParameters &cam,
97  const vpImage<vpRGBa> &I,
98  const vpColor &color=vpColor::green,
99  unsigned int thickness=1) const ;
101  vpFeatureEllipse *duplicate() const ;
102 
105  vpColVector error(const vpBasicFeature &s_star,
106  const unsigned int select = FEATURE_ALL) ;
108  vpColVector error(const unsigned int select = FEATURE_ALL) ;
109 
110  double get_x() const {return s[0];}
111  double get_y() const {return s[1];}
112  double getMu20() const {return s[2];}
113  double getMu11() const {return s[3];}
114  double getMu02() const {return s[4];}
115 
117  void init() ;
119  vpMatrix interaction(const unsigned int select = FEATURE_ALL);
120 
122  void print(const unsigned int select = FEATURE_ALL ) const ;
123 
124  void set_x(const double x);
125  void set_y(const double y);
126  void set_xy(const double x,const double y);
127  void setABC(const double A, const double B, const double C) ;
128  void setMu(const double mu20, const double mu11, const double mu02) ;
129 
130 public:
135  // feature selection
136  static unsigned int selectX();
137  static unsigned int selectY();
138  static unsigned int selectMu20();
139  static unsigned int selectMu11();
140  static unsigned int selectMu02();
141 } ;
142 
143 #endif
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:97
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