Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpFeatureMoment.h
1/*
2 * ViSP, open source Visual Servoing Platform software.
3 * Copyright (C) 2005 - 2025 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 * Base for all moment features
32 */
33
41#ifndef _vpFeatureMoment_h_
42#define _vpFeatureMoment_h_
43
44#include <vector>
45#include <string>
46#include <visp3/core/vpConfig.h>
47#include <visp3/core/vpException.h>
48#include <visp3/visual_features/vpBasicFeature.h>
49
51class vpMomentObject;
54class vpMoment;
55
161class VISP_EXPORT vpFeatureMoment : public vpBasicFeature
162{
163protected:
165 const vpMoment &getMoment() const { return *moment; }
168 std::vector<vpMatrix> interaction_matrices;
169
170 double A;
171 double B;
172 double C;
173 std::string m_name;
174
175 // private:
176 //#ifndef DOXYGEN_SHOULD_SKIP_THIS
177 // vpFeatureMoment(const vpFeatureMoment &fm)
178 // : vpBasicFeature(), moment(nullptr), moments(fm.moments),
179 // featureMomentsDataBase(nullptr),
180 // interaction_matrices(), A(0), B(0), C(0)
181 // {
182 // throw vpException(vpException::functionNotImplementedError, "Not
183 // implemented!");
184 // }
185 // vpFeatureMoment &operator=(const vpFeatureMoment &){
186 // throw vpException(vpException::functionNotImplementedError, "Not
187 // implemented!"); return *this;
188 // }
189 //#endif
190#if !defined(VISP_MOMENTS_COMBINE_MATRICES)
191#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
192 vpFeatureMoment(const vpFeatureMoment &) = delete; // non construction-copyable
193 vpFeatureMoment &operator=(const vpFeatureMoment &) = delete; // non copyable
194#endif
195#endif
196
197public:
212 vpFeatureMoment(vpMomentDatabase &data_base, double A_ = 0.0, double B_ = 0.0, double C_ = 0.0,
213 vpFeatureMomentDatabase *featureMoments = nullptr, unsigned int nbmatrices = 1)
214 : vpBasicFeature(), moment(nullptr), moments(data_base), featureMomentsDataBase(featureMoments),
215 interaction_matrices(nbmatrices), A(A_), B(B_), C(C_), m_name()
216 { }
217
220 virtual void compute_interaction(void);
221
222 vpBasicFeature *duplicate() const VP_OVERRIDE;
223 void display(const vpCameraParameters &cam, const vpImage<unsigned char> &I, const vpColor &color = vpColor::green,
224 unsigned int thickness = 1) const VP_OVERRIDE;
225 void display(const vpCameraParameters &cam, const vpImage<vpRGBa> &I, const vpColor &color = vpColor::green,
226 unsigned int thickness = 1) const VP_OVERRIDE;
227
228 int getDimension(unsigned int select = FEATURE_ALL) const;
229 void init(void) VP_OVERRIDE;
230 vpMatrix interaction(unsigned int select = FEATURE_ALL) VP_OVERRIDE;
231
232 void linkTo(vpFeatureMomentDatabase &featureMoments);
233
238 virtual const std::string momentName() const = 0;
239
243 virtual const std::string name() const = 0;
244
245 void print(unsigned int select = FEATURE_ALL) const VP_OVERRIDE;
246 virtual void printDependencies(std::ostream &os) const;
247
248 void update(double A, double B, double C);
249
251 friend VISP_EXPORT std::ostream &operator<<(std::ostream &os, const vpFeatureMoment &featM);
252};
253
271class VISP_EXPORT vpMomentGenericFeature : public vpFeatureMoment
272{
273public:
274 vpMomentGenericFeature(vpMomentDatabase &data_base, double A_, double B_, double C_,
275 vpFeatureMomentDatabase *featureMoments, const vpMoment *p_moment)
276 : vpFeatureMoment(data_base, A_, B_, C_, featureMoments)
277 {
278 this->moment = p_moment;
279 }
280
284 const std::string momentName() const { return std::string(); }
285
289 virtual const std::string name() const { return std::string(); }
290};
291END_VISP_NAMESPACE
292#endif
class that defines what is a visual feature
virtual vpBasicFeature * duplicate() const =0
Generic class defining intrinsic camera parameters.
Class to define RGB colors available for display functionalities.
Definition vpColor.h:157
This class allows to register all feature moments (implemented in vpFeatureMoment....
vpFeatureMoment(vpMomentDatabase &data_base, double A_=0.0, double B_=0.0, double C_=0.0, vpFeatureMomentDatabase *featureMoments=nullptr, unsigned int nbmatrices=1)
virtual void printDependencies(std::ostream &os) const
std::vector< vpMatrix > interaction_matrices
vpFeatureMomentDatabase * featureMomentsDataBase
vpMomentDatabase & moments
const vpMoment & getMoment() const
const vpMoment * moment
vpFeatureMoment(const vpFeatureMoment &)=delete
void print(unsigned int select=FEATURE_ALL) const VP_OVERRIDE
virtual const std::string name() const =0
void update(double A, double B, double C)
virtual const std::string momentName() const =0
vpFeatureMoment & operator=(const vpFeatureMoment &)=delete
Definition of the vpImage class member functions.
Definition vpImage.h:131
Implementation of a matrix and operations on matrices.
Definition vpMatrix.h:175
This class allows to register all vpMoments so they can access each other according to their dependen...
vpMomentGenericFeature(vpMomentDatabase &data_base, double A_, double B_, double C_, vpFeatureMomentDatabase *featureMoments, const vpMoment *p_moment)
const std::string momentName() const
virtual const std::string name() const
Class for generic objects.
This class defines shared methods/attributes for 2D moments.
Definition vpMoment.h:106