Visual Servoing Platform  version 3.6.1 under development (2024-07-27)
vpFeatureMomentCInvariant.h
1 /*
2  * ViSP, open source Visual Servoing Platform software.
3  * Copyright (C) 2005 - 2023 by Inria. All rights reserved.
4  *
5  * This software is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
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 https://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  * Implementation for all supported moment features.
32  */
33 
38 #ifndef _vpFeatureMomentCInvariant_h_
39 #define _vpFeatureMomentCInvariant_h_
40 
41 #include <visp3/core/vpConfig.h>
42 #include <visp3/visual_features/vpFeatureMoment.h>
43 
44 #ifdef VISP_MOMENTS_COMBINE_MATRICES
46 
92 class VISP_EXPORT vpFeatureMomentCInvariant : public vpFeatureMoment
93 {
94 public:
105  vpFeatureMomentCInvariant(vpMomentDatabase &moments, double A, double B, double C,
106  vpFeatureMomentDatabase *featureMoments = nullptr)
107  : vpFeatureMoment(moments, A, B, C, featureMoments, 16)
108  { }
109 
110  void compute_interaction() VP_OVERRIDE;
111 
115  const std::string momentName() const VP_OVERRIDE
116  {
117  return "vpMomentCInvariant";
118  }
119 
123  const std::string name() const VP_OVERRIDE
124  {
125  return "vpFeatureMomentCInvariant";
126  }
127 
131  static unsigned int selectC1() { return 1 << 0; }
135  static unsigned int selectC2() { return 1 << 1; }
139  static unsigned int selectC3() { return 1 << 2; }
143  static unsigned int selectC4() { return 1 << 3; }
147  static unsigned int selectC5() { return 1 << 4; }
151  static unsigned int selectC6() { return 1 << 5; }
155  static unsigned int selectC7() { return 1 << 6; }
159  static unsigned int selectC8() { return 1 << 7; }
163  static unsigned int selectC9() { return 1 << 8; }
167  static unsigned int selectC10() { return 1 << 9; }
171  static unsigned int selectSx() { return 1 << 10; }
175  static unsigned int selectSy() { return 1 << 11; }
179  static unsigned int selectPx() { return 1 << 12; }
183  static unsigned int selectPy() { return 1 << 13; }
184 };
185 END_VISP_NAMESPACE
186 #else
188 class vpMomentDatabase;
189 
235 class VISP_EXPORT vpFeatureMomentCInvariant : public vpFeatureMoment
236 {
237 private:
238  std::vector<vpMatrix> LI;
239 
240 public:
251  vpFeatureMomentCInvariant(vpMomentDatabase &data_base, double A_, double B_, double C_,
252  vpFeatureMomentDatabase *featureMoments = nullptr)
253  : vpFeatureMoment(data_base, A_, B_, C_, featureMoments, 16), LI(16)
254  { }
255 
256  void compute_interaction() VP_OVERRIDE;
260  const std::string momentName() const VP_OVERRIDE
261  {
262  return "vpMomentCInvariant";
263  }
267  const std::string name() const VP_OVERRIDE
268  {
269  return "vpFeatureMomentCInvariant";
270  }
271 
275  static unsigned int selectC1() { return 1 << 0; }
279  static unsigned int selectC2() { return 1 << 1; }
283  static unsigned int selectC3() { return 1 << 2; }
287  static unsigned int selectC4() { return 1 << 3; }
291  static unsigned int selectC5() { return 1 << 4; }
295  static unsigned int selectC6() { return 1 << 5; }
299  static unsigned int selectC7() { return 1 << 6; }
303  static unsigned int selectC8() { return 1 << 7; }
307  static unsigned int selectC9() { return 1 << 8; }
311  static unsigned int selectC10() { return 1 << 9; }
315  static unsigned int selectSx() { return 1 << 10; }
319  static unsigned int selectSy() { return 1 << 11; }
323  static unsigned int selectPx() { return 1 << 12; }
327  static unsigned int selectPy() { return 1 << 13; }
328 
332  void printLsofInvariants(std::ostream &os) const;
333 
334  friend VISP_EXPORT std::ostream &operator<<(std::ostream &os, const vpFeatureMomentCInvariant &featcinv);
335 };
336 END_VISP_NAMESPACE
337 #endif
338 #endif
Functionality computation for 2D rotation/translation/scale non-symmetric invariant moment feature....
const std::string name() const VP_OVERRIDE
vpFeatureMomentCInvariant(vpMomentDatabase &data_base, double A_, double B_, double C_, vpFeatureMomentDatabase *featureMoments=nullptr)
This class allows to register all feature moments (implemented in vpFeatureMoment....
This class defines shared system methods/attributes for 2D moment features but no functional code....
friend VISP_EXPORT std::ostream & operator<<(std::ostream &os, const vpFeatureMoment &featM)
virtual const std::string name() const =0
virtual void compute_interaction(void)
This class allows to register all vpMoments so they can access each other according to their dependen...