Visual Servoing Platform  version 3.5.0 under development (2022-02-15)
vpFeatureTranslation.h
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2019 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * See the file LICENSE.txt at the root directory of this source
11  * distribution for additional information about the GNU GPL.
12  *
13  * For using ViSP with software that can not be combined with the GNU
14  * GPL, please contact Inria about acquiring a ViSP Professional
15  * Edition License.
16  *
17  * See http://visp.inria.fr for more information.
18  *
19  * This software was developed at:
20  * Inria Rennes - Bretagne Atlantique
21  * Campus Universitaire de Beaulieu
22  * 35042 Rennes Cedex
23  * France
24  *
25  * If you have questions regarding the use of this file, please contact
26  * Inria at visp@inria.fr
27  *
28  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30  *
31  * Description:
32  * 3D translation visual feature.
33  *
34  * Authors:
35  * Eric Marchand
36  * Fabien Spindler
37  *
38  *****************************************************************************/
39 
40 #ifndef vpFeatureTranslation_H
41 #define vpFeatureTranslation_H
42 
48 #include <visp3/core/vpHomogeneousMatrix.h>
49 #include <visp3/core/vpMatrix.h>
50 #include <visp3/core/vpRGBa.h>
51 #include <visp3/core/vpTranslationVector.h>
52 #include <visp3/visual_features/vpBasicFeature.h>
53 
276 class VISP_EXPORT vpFeatureTranslation : public vpBasicFeature
277 {
278 public:
283  typedef enum {
295  cMo
297 
298  // basic contructor
300  // basic constructor specifying the type of translation feature
301  explicit vpFeatureTranslation(vpFeatureTranslationRepresentationType r);
302  // constructor : build from an homogeneous matrix
303  // cdMc is the displacement that the camera has to realize
304  vpFeatureTranslation(vpHomogeneousMatrix &f2Mf1, vpFeatureTranslationRepresentationType r);
307 
308  // build from an homogeneous matrix
309  // cdMc is the displacement that the camera has to realize
310  void buildFrom(const vpHomogeneousMatrix &f2Mf1);
311 
312  void display(const vpCameraParameters &cam, const vpImage<unsigned char> &I, const vpColor &color = vpColor::green,
313  unsigned int thickness = 1) const;
314  void display(const vpCameraParameters &cam, const vpImage<vpRGBa> &I, const vpColor &color = vpColor::green,
315  unsigned int thickness = 1) const;
316 
319 
320  // compute the error between two visual features from a subset
321  // a the possible features
322  vpColVector error(const vpBasicFeature &s_star, unsigned int select = FEATURE_ALL);
323 
324  vpFeatureTranslationRepresentationType getFeatureTranslationType() const;
325 
326  double get_Tx() const;
327  double get_Ty() const;
328  double get_Tz() const;
329 
330  // basic construction
331  void init();
332  // compute the interaction matrix from a subset a the possible features
333  vpMatrix interaction(unsigned int select = FEATURE_ALL);
334 
335  // print the name of the feature
336  void print(unsigned int select = FEATURE_ALL) const;
337 
338  void set_Tx(double t_x);
339  void set_Ty(double t_y);
340  void set_Tz(double t_z);
341 
342  void setFeatureTranslationType(const vpFeatureTranslationRepresentationType r);
343 
344  // feature selection
345  static unsigned int selectTx();
346  static unsigned int selectTy();
347  static unsigned int selectTz();
348 
349 private:
351  vpHomogeneousMatrix f2Mf1;
352  vpFeatureTranslationRepresentationType translation;
353 };
354 
355 #endif
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:153
Class that defines the translation visual feature .
Implementation of an homogeneous matrix and operations on such kind of matrices.
Class to define RGB colors available for display functionnalities.
Definition: vpColor.h:157
static const vpColor green
Definition: vpColor.h:220
virtual void print(unsigned int select=FEATURE_ALL) const =0
Print the name of the feature.
class that defines what is a visual feature
virtual vpColVector error(const vpBasicFeature &s_star, unsigned int select=FEATURE_ALL)
Generic class defining intrinsic camera parameters.
virtual void init()=0
Implementation of column vector and the associated operations.
Definition: vpColVector.h:130
virtual vpBasicFeature * duplicate() const =0
virtual vpMatrix interaction(unsigned int select=FEATURE_ALL)=0
Compute the interaction matrix from a subset of the possible features.
virtual void display(const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const =0
virtual ~vpFeatureTranslation()
Destructor. Does nothing.