ViSP  2.8.0
vpFeatureMoment.h
1 /****************************************************************************
2 *
3 * $Id: vpFeatureMoment.h 4276 2013-06-25 12:36:48Z 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 * 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:
149  vpMoment& getMoment(){return *moment;}
152  std::vector<vpMatrix> interaction_matrices;
153 
154  double A;
155  double B;
156  double C;
157  char _name[255];
158 public:
168  vpFeatureMoment(vpMomentDatabase& moments,double A=0.0, double B=0.0, double C=0.0,vpFeatureMomentDatabase* featureMoments=NULL,unsigned int nbmatrices=1) :
169  moment(NULL),
170  moments(moments),
171  featureMomentsDataBase(featureMoments),
172  interaction_matrices(nbmatrices),
173  A(A),B(B),C(C) {}
174  virtual ~vpFeatureMoment();
175 
176  virtual void compute_interaction (void);
177  vpBasicFeature* duplicate () const;
178  void display (const vpCameraParameters &cam, const vpImage< unsigned char > &I,
179  const vpColor &color=vpColor::green, unsigned int thickness=1) const ;
180  void display (const vpCameraParameters &cam, const vpImage< vpRGBa > &I,
181  const vpColor &color=vpColor::green, unsigned int thickness=1) const ;
182 
183  int getDimension (unsigned int select=FEATURE_ALL) const;
184  void init (void);
185  vpMatrix interaction (const unsigned int select=FEATURE_ALL);
186  void linkTo(vpFeatureMomentDatabase& featureMoments);
187 
192  virtual const char* momentName() = 0;
196  virtual const char* name() = 0;
197  void print (const unsigned int select=FEATURE_ALL) const ;
198 
199  void update (double A, double B, double C);
200 
201 #ifndef DOXYGEN_SHOULD_SKIP_THIS
202  void operator=(const vpFeatureMoment &){
203  throw vpException(vpException::functionNotImplementedError,"Not implemented!");
204  }
205 #endif
206 
207 };
208 
223 class VISP_EXPORT vpMomentGenericFeature : public vpFeatureMoment{
224 public:
225  vpMomentGenericFeature(vpMomentDatabase& moments,double A, double B, double C,vpFeatureMomentDatabase* featureMoments, vpMoment* moment) : vpFeatureMoment(moments,A,B,C,featureMoments){this->moment = moment;}
229  const char* momentName() { return NULL;}
233  virtual const char* name() { return NULL;}
234 };
235 
236 #endif
Definition of the vpMatrix class.
Definition: vpMatrix.h:96
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.
vpFeatureMoment(vpMomentDatabase &moments, double A=0.0, double B=0.0, double C=0.0, vpFeatureMomentDatabase *featureMoments=NULL, unsigned int nbmatrices=1)
Class to define colors available for display functionnalities.
Definition: vpColor.h:125
error that can be emited by ViSP classes.
Definition: vpException.h:75
Class for generic objects.
std::vector< vpMatrix > interaction_matrices
virtual const char * name()
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
vpMomentGenericFeature(vpMomentDatabase &moments, double A, double B, double C, vpFeatureMomentDatabase *featureMoments, vpMoment *moment)
vpMoment & getMoment()
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:104
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
const char * momentName()
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
This class allows to register all feature moments (implemented in vpFeatureMoment... classes) so they can access each other according to their dependencies.