ViSP  2.6.2
vpFeatureMoment.h
1 /****************************************************************************
2 *
3 * $Id: vpFeatureMoment.h 3653 2012-03-28 12:43:23Z fspindle $
4 *
5 * This file is part of the ViSP software.
6 * Copyright (C) 2005 - 2012 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 
118 
145 class VISP_EXPORT vpFeatureMoment : public vpBasicFeature{
146 protected:
148  vpMoment& getMoment(){return *moment;}
151  std::vector<vpMatrix> interaction_matrices;
152 
153  double A;
154  double B;
155  double C;
156  char _name[255];
157 public:
167  vpFeatureMoment(vpMomentDatabase& moments,double A=0.0, double B=0.0, double C=0.0,vpFeatureMomentDatabase* featureMoments=NULL,unsigned int nbmatrices=1) :
168  moment(NULL),
169  moments(moments),
170  featureMomentsDataBase(featureMoments),
171  interaction_matrices(nbmatrices),
172  A(A),B(B),C(C) {}
173  virtual ~vpFeatureMoment();
174 
175  virtual void compute_interaction (void);
176  vpBasicFeature* duplicate () const;
177  void display (const vpCameraParameters &cam, const vpImage< unsigned char > &I,
178  const vpColor &color=vpColor::green, unsigned int thickness=1) const ;
179  void display (const vpCameraParameters &cam, const vpImage< vpRGBa > &I,
180  const vpColor &color=vpColor::green, unsigned int thickness=1) const ;
181 
182  int getDimension (unsigned int select=FEATURE_ALL) const;
183  void init (void);
184  vpMatrix interaction (const unsigned int select=FEATURE_ALL);
185  void linkTo(vpFeatureMomentDatabase& featureMoments);
186 
191  virtual const char* momentName() = 0;
195  virtual const char* name() = 0;
196  void print (const unsigned int select=FEATURE_ALL) const ;
197 
198  void update (double A, double B, double C);
199 
200 #ifndef DOXYGEN_SHOULD_SKIP_THIS
201  void operator=(const vpFeatureMoment &){
202  throw vpException(vpException::functionNotImplementedError,"Not implemented!");
203  }
204 #endif
205 
206 };
207 
222 class VISP_EXPORT vpMomentGenericFeature : public vpFeatureMoment{
223 public:
224  vpMomentGenericFeature(vpMomentDatabase& moments,double A, double B, double C,vpFeatureMomentDatabase* featureMoments, vpMoment* moment) : vpFeatureMoment(moments,A,B,C,featureMoments){this->moment = moment;}
228  const char* momentName() { return NULL;}
232  virtual const char* name() { return NULL;}
233 };
234 
235 #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:123
Class for generic objects.
std::vector< vpMatrix > interaction_matrices
virtual const char * name()
static const vpColor green
Definition: vpColor.h:168
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.