ViSP  2.8.0
vpFeatureEllipse.h
1 /****************************************************************************
2  *
3  * $Id: vpFeatureEllipse.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  * 2D ellipse visual feature.
36  *
37  * Authors:
38  * Eric Marchand
39  *
40  *****************************************************************************/
41 
42 
43 
44 #ifndef vpFeatureEllipse_H
45 #define vpFeatureEllipse_H
46 
52 #include <visp/vpMatrix.h>
53 #include <visp/vpBasicFeature.h>
54 
55 #include <visp/vpHomogeneousMatrix.h>
56 #include <visp/vpRGBa.h>
57 
58 
64 class VISP_EXPORT vpFeatureEllipse : public vpBasicFeature
65 {
66  /*
67  attributes and members directly related to the vpBasicFeature needs
68  other functionalities are useful but not mandatory
69  */
70 private:
73  double A,B,C ;
74 
75 
76 public:
78  void init() ;
82  virtual ~vpFeatureEllipse() { if (flags != NULL) delete [] flags; }
83 
84 public:
88  vpFeatureEllipse(const double x, const double y,
90  const double mu20, const double mu11, const double mu02);
91 
92  // void buildFrom(const vpEllipse &p) ;
93  void buildFrom(const double x, const double y,
94  const double mu20, const double mu11, const double mu02) ;
95  void buildFrom(const double x, const double y,
96  const double mu20, const double mu11, const double mu02,
97  const double A, const double B, const double C) ;
98  void set_x(const double x);
99  void set_y(const double y);
100  void set_xy(const double x,const double y);
101  void setABC(const double A, const double B, const double C) ;
102  void setMu(const double mu20, const double mu11, const double mu02) ;
103 
104  double get_x() const {return s[0];}
105  double get_y() const {return s[1];}
106  double getMu20() const {return s[2];}
107  double getMu11() const {return s[3];}
108  double getMu02() const {return s[4];}
109 
110 public:
115  // feature selection
116  inline static unsigned int selectX() { return FEATURE_LINE[0] ; }
117  inline static unsigned int selectY() { return FEATURE_LINE[1] ; }
118  inline static unsigned int selectMu20() { return FEATURE_LINE[2] ; }
119  inline static unsigned int selectMu11() { return FEATURE_LINE[3] ; }
120  inline static unsigned int selectMu02() { return FEATURE_LINE[4] ; }
121 
123  vpMatrix interaction(const unsigned int select = FEATURE_ALL);
126  vpColVector error(const vpBasicFeature &s_star,
127  const unsigned int select = FEATURE_ALL) ;
129  vpColVector error(const unsigned int select = FEATURE_ALL) ;
131  void print(const unsigned int select = FEATURE_ALL ) const ;
132 
134  vpFeatureEllipse *duplicate() const ;
135 
136 
137 public:
138  void display(const vpCameraParameters &cam,
139  const vpImage<unsigned char> &I,
140  const vpColor &color=vpColor::green,
141  unsigned int thickness=1) const ;
142  void display(const vpCameraParameters &cam,
143  const vpImage<vpRGBa> &I,
144  const vpColor &color=vpColor::green,
145  unsigned int thickness=1) const ;
146 } ;
147 
148 
149 
150 #endif
151 
152 /*
153  * Local variables:
154  * c-basic-offset: 2
155  * End:
156  */
Definition of the vpMatrix class.
Definition: vpMatrix.h:96
bool * flags
Ensure that all the parameters needed to compute the iteraction matrix are set.
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:125
double getMu02() const
double get_y() const
double getMu20() const
static unsigned int selectY()
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 unsigned int selectMu02()
static const vpColor green
Definition: vpColor.h:170
double getMu11() const
class that defines what is a visual feature
static unsigned int selectX()
static unsigned int selectMu11()
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
static unsigned int selectMu20()
Class that provides a data structure for the column vectors as well as a set of operations on these v...
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