ViSP  2.9.0
vpFeatureMoment.h
1 /****************************************************************************
2 *
3 * $Id: vpFeatureMoment.h 4649 2014-02-07 14:57:11Z fspindle $
4 *
5 * This file is part of the ViSP software.
6 * Copyright (C) 2005 - 2014 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 * Base for all moment features
36 *
37 * Authors:
38 * Filip Novotny
39 *
40 *****************************************************************************/
47 #ifndef __FEATUREMOMENT_H__
48 #define __FEATUREMOMENT_H__
49 
50 #include <visp/vpConfig.h>
51 #include <visp/vpBasicFeature.h>
52 #include <visp/vpException.h>
53 #include <vector>
54 
55 class vpMomentObject;
56 class vpMomentDatabase;
58 class vpMoment;
59 
119 
146 class VISP_EXPORT vpFeatureMoment : public vpBasicFeature{
147 protected:
148  const vpMoment* moment;
149  const vpMoment& getMoment() const {return *moment;}
152  std::vector<vpMatrix> interaction_matrices;
153 
154  double A;
155  double B;
156  double C;
157  char _name[255];
158 
159 public:
169  vpFeatureMoment(vpMomentDatabase& data_base,double A_=0.0, double B_=0.0, double C_=0.0,
170  vpFeatureMomentDatabase* featureMoments=NULL,unsigned int nbmatrices=1)
171  : moment(NULL),
172  moments(data_base),
173  featureMomentsDataBase(featureMoments),
174  interaction_matrices(nbmatrices),
175  A(A_),B(B_),C(C_) {}
176  virtual ~vpFeatureMoment();
177 
178  virtual void compute_interaction (void);
179  vpBasicFeature* duplicate () const;
180  void display (const vpCameraParameters &cam, const vpImage< unsigned char > &I,
181  const vpColor &color=vpColor::green, unsigned int thickness=1) const ;
182  void display (const vpCameraParameters &cam, const vpImage< vpRGBa > &I,
183  const vpColor &color=vpColor::green, unsigned int thickness=1) const ;
184 
185  int getDimension (unsigned int select=FEATURE_ALL) const;
186  void init (void);
187  vpMatrix interaction (const unsigned int select=FEATURE_ALL) ;
188  void linkTo(vpFeatureMomentDatabase& featureMoments);
189 
194  virtual const char* momentName() const = 0;
198  virtual const char* name() const = 0;
199  void print (const unsigned int select=FEATURE_ALL) const ;
200 
201  void update (double A, double B, double C);
202 
203 #ifndef DOXYGEN_SHOULD_SKIP_THIS
205  throw vpException(vpException::functionNotImplementedError,"Not implemented!");
206  }
207 #endif
208 
209 };
210 
225 class VISP_EXPORT vpMomentGenericFeature : public vpFeatureMoment{
226 public:
227  vpMomentGenericFeature(vpMomentDatabase& data_base,double A_, double B_, double C_,
228  vpFeatureMomentDatabase* featureMoments, const vpMoment* p_moment)
229  : vpFeatureMoment(data_base,A_,B_,C_,featureMoments){this->moment = p_moment;}
233  const char* momentName() const { return NULL;}
237  virtual const char* name() const { return NULL;}
238 };
239 
240 #endif
vpBasicFeature & operator=(const vpBasicFeature &f)
Definition of the vpMatrix class.
Definition: vpMatrix.h:98
const vpMoment * moment
unsigned int getDimension(const unsigned int select=FEATURE_ALL) const
Get the feature vector dimension.
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
const char * momentName() const
error that can be emited by ViSP classes.
Definition: vpException.h:76
Class for generic objects.
std::vector< vpMatrix > interaction_matrices
static const vpColor green
Definition: vpColor.h:170
This class defines a generic feature used for moment feature duplication.
class that defines what is a visual feature
This class allows to register all vpMoments so they can access each other according to their dependen...
This class defines shared methods/attributes for 2D moments.
Definition: vpMoment.h:108
This class defines shared system methods/attributes for 2D moment features but no functional code...
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.
vpMomentDatabase & moments
virtual void init()=0
vpFeatureMomentDatabase * featureMomentsDataBase
vpMomentGenericFeature(vpMomentDatabase &data_base, double A_, double B_, double C_, vpFeatureMomentDatabase *featureMoments, const vpMoment *p_moment)
const vpMoment & getMoment() const
vpFeatureMoment(vpMomentDatabase &data_base, double A_=0.0, double B_=0.0, double C_=0.0, vpFeatureMomentDatabase *featureMoments=NULL, unsigned int nbmatrices=1)
virtual vpBasicFeature * duplicate() const =0
virtual void display(const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const =0
virtual const char * name() const
This class allows to register all feature moments (implemented in vpFeatureMoment... classes) so they can access each other according to their dependencies.