Visual Servoing Platform  version 3.5.0 under development (2022-02-15)
vpPoint.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  * Point feature.
33  *
34  * Authors:
35  * Eric Marchand
36  *
37  *****************************************************************************/
38 
39 #ifndef vpPoint_H
40 #define vpPoint_H
41 
48 
49 #include <visp3/core/vpColor.h>
50 #include <visp3/core/vpForwardProjection.h>
51 #include <visp3/core/vpMatrix.h>
52 
81 class VISP_EXPORT vpPoint : public vpForwardProjection
82 {
83 
84 public:
86  vpPoint();
87  vpPoint(double oX, double oY, double oZ);
88  explicit vpPoint(const vpColVector &oP);
89  explicit vpPoint(const std::vector<double> &oP);
91  virtual ~vpPoint() {}
92 
93 public:
94  // Compute the 3D coordinates _cP (camera frame)
95  void changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &cP) const;
96  void changeFrame(const vpHomogeneousMatrix &cMo);
97 
98  void display(const vpImage<unsigned char> &I, const vpCameraParameters &cam, const vpColor &color = vpColor::green,
99  unsigned int thickness = 1);
100  void display(const vpImage<vpRGBa> &I, const vpCameraParameters &cam, const vpColor &color = vpColor::green,
101  unsigned int thickness = 1);
102  void display(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
103  const vpColor &color = vpColor::green, unsigned int thickness = 1);
104  void display(const vpImage<vpRGBa> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
105  const vpColor &color = vpColor::green, unsigned int thickness = 1);
106  vpPoint *duplicate() const;
107 
108  // Get coordinates
109  double get_X() const;
110  double get_Y() const;
111  double get_Z() const;
112  double get_W() const;
113  double get_oX() const;
114  double get_oY() const;
115  double get_oZ() const;
116  double get_oW() const;
117  double get_x() const;
118  double get_y() const;
119  double get_w() const;
120 
121  void getWorldCoordinates(double &oX, double &oY, double &oZ);
122  void getWorldCoordinates(vpColVector &oP);
123  vpColVector getWorldCoordinates(void);
124  void getWorldCoordinates(std::vector<double> &oP);
125 
126  friend VISP_EXPORT std::ostream &operator<<(std::ostream &os, const vpPoint &vpp);
127 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
128  vpPoint &operator=(const vpPoint &vpp) = default;
129 #else
130  vpPoint &operator=(const vpPoint &vpp);
131 #endif
132 
135  void projection(const vpColVector &_cP, vpColVector &_p) const;
136 
137  void projection();
138 
139  // Set coordinates
140  void set_X(double cX);
141  void set_Y(double cY);
142  void set_Z(double cZ);
143  void set_W(double cW);
144  void set_oX(double oX);
145  void set_oY(double oY);
146  void set_oZ(double oZ);
147  void set_oW(double oW);
148  void set_x(double x);
149  void set_y(double y);
150  void set_w(double w);
151 
152  void setWorldCoordinates(double oX, double oY, double oZ);
153  void setWorldCoordinates(const vpColVector &oP);
154  void setWorldCoordinates(const std::vector<double> &oP);
155 
156 protected:
158  void init();
159 };
160 
161 #endif
virtual void changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &cP) const =0
vpTracker & operator=(const vpTracker &tracker)
Copy operator.
Definition: vpTracker.cpp:53
virtual void display(const vpImage< unsigned char > &I, const vpCameraParameters &cam, const vpColor &color=vpColor::green, unsigned int thickness=1)=0
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
virtual void init()=0
static const vpColor green
Definition: vpColor.h:220
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
Definition: vpPoint.h:81
virtual void projection()=0
virtual ~vpPoint()
Destructor.
Definition: vpPoint.h:91
Class that defines what is a generic geometric feature.
virtual void setWorldCoordinates(const vpColVector &oP)=0
Generic class defining intrinsic camera parameters.
Implementation of column vector and the associated operations.
Definition: vpColVector.h:130
virtual vpForwardProjection * duplicate() const =0