Visual Servoing Platform  version 3.5.1 under development (2023-03-29)
vpFeatureBuilder.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  * Conversion between tracker and visual feature.
33  *
34  * Authors:
35  * Eric Marchand
36  * Fabien Spindler
37  *
38  *****************************************************************************/
39 
40 #ifndef vpFeatureBuilder_H
41 #define vpFeatureBuilder_H
42 
47 #include <visp3/core/vpConfig.h>
48 
49 // tracker
50 #ifdef VISP_HAVE_MODULE_BLOB
51 #include <visp3/blob/vpDot.h>
52 #include <visp3/blob/vpDot2.h>
53 #endif
54 
55 #ifdef VISP_HAVE_MODULE_ME
56 #include <visp3/me/vpMeEllipse.h>
57 #include <visp3/me/vpMeLine.h>
58 #endif
59 
60 // forward projection tracker
61 #include <visp3/core/vpCircle.h>
62 #include <visp3/core/vpCylinder.h>
63 #include <visp3/core/vpLine.h>
64 #include <visp3/core/vpPoint.h>
65 #include <visp3/core/vpSphere.h>
66 
67 // visual feature
68 #include <visp3/visual_features/vpFeatureEllipse.h>
69 #include <visp3/visual_features/vpFeatureLine.h>
70 #include <visp3/visual_features/vpFeaturePoint.h>
71 #include <visp3/visual_features/vpFeaturePoint3D.h>
72 #include <visp3/visual_features/vpFeaturePointPolar.h>
73 #include <visp3/visual_features/vpFeatureSegment.h>
74 #include <visp3/visual_features/vpFeatureThetaU.h>
75 #include <visp3/visual_features/vpFeatureTranslation.h>
76 #include <visp3/visual_features/vpFeatureVanishingPoint.h>
77 
78 // others
79 #include <visp3/core/vpImagePoint.h>
80 
81 // pixel / meter conversion
82 #include <visp3/core/vpCameraParameters.h>
83 #include <visp3/core/vpMeterPixelConversion.h>
84 #include <visp3/core/vpPixelMeterConversion.h>
85 
92 class VISP_EXPORT vpFeatureBuilder
93 {
94 public:
95 // create vpFeaturePoint feature
96 #ifdef VISP_HAVE_MODULE_BLOB
97  static void create(vpFeaturePoint &s, const vpCameraParameters &cam, const vpDot &d);
98  static void create(vpFeaturePoint &s, const vpCameraParameters &cam, const vpDot2 &d);
99 #endif
100  static void create(vpFeaturePoint &s, const vpCameraParameters &cam, const vpImagePoint &t);
101  static void create(vpFeaturePoint &s, const vpPoint &p);
102  static void create(vpFeaturePoint &s, const vpCameraParameters &goodCam, const vpCameraParameters &wrongCam,
103  const vpPoint &p);
104 
105 #ifdef VISP_HAVE_MODULE_BLOB
106  static void create(vpFeatureSegment &s, const vpCameraParameters &cam, const vpDot &d1, const vpDot &d2);
107  static void create(vpFeatureSegment &s, const vpCameraParameters &cam, const vpDot2 &d1, const vpDot2 &d2);
108 #endif
109  static void create(vpFeatureSegment &s, const vpCameraParameters &cam, const vpImagePoint &ip1,
110  const vpImagePoint &ip2);
111  static void create(vpFeatureSegment &s, vpPoint &P1, vpPoint &P2);
112 
113 // create vpFeaturePointPolar feature
114 #ifdef VISP_HAVE_MODULE_BLOB
115  static void create(vpFeaturePointPolar &s, const vpCameraParameters &cam, const vpDot &dot);
116  static void create(vpFeaturePointPolar &s, const vpCameraParameters &cam, const vpDot2 &dot);
117 #endif
118  static void create(vpFeaturePointPolar &s, const vpCameraParameters &cam, const vpImagePoint &iP);
119  static void create(vpFeaturePointPolar &s, const vpPoint &p);
120  static void create(vpFeaturePointPolar &s, const vpCameraParameters &goodCam, const vpCameraParameters &wrongCam,
121  const vpPoint &p);
122 
123  // create vpFeaturePoint3D feature
124  static void create(vpFeaturePoint3D &s, const vpPoint &p);
125 
126  // create vpFeatureLine feature
127  static void create(vpFeatureLine &s, const vpLine &l);
128  static void create(vpFeatureLine &s, const vpCylinder &c, int line);
129 
130 #ifdef VISP_HAVE_MODULE_ME
131  static void create(vpFeatureLine &s, const vpCameraParameters &cam, const vpMeLine &mel);
132 #endif
133 
135  static void create(vpFeatureEllipse &s, const vpCircle &c);
136  static void create(vpFeatureEllipse &s, const vpSphere &sphere);
137 #ifdef VISP_HAVE_MODULE_BLOB
138  static void create(vpFeatureEllipse &s, const vpCameraParameters &cam, const vpDot &blob);
139  static void create(vpFeatureEllipse &s, const vpCameraParameters &cam, const vpDot2 &blob);
140 #endif
141 
142 #ifdef VISP_HAVE_MODULE_ME
143  static void create(vpFeatureEllipse &s, const vpCameraParameters &cam, const vpMeEllipse &ellipse);
144 #endif
145 
146  // To keep compat with previous releases, we set cartesian coordinates as default initialising select var to selectX()
147  // or selectY()
148  static void create(vpFeatureVanishingPoint &s, const vpPoint &p,
150  static void create(vpFeatureVanishingPoint &s, const vpFeatureLine &l1, const vpFeatureLine &l2,
152  static void create(vpFeatureVanishingPoint &s, const vpLine &l1, const vpLine &l2,
154  // This function is new that's why select is not initialized
155  static void create(vpFeatureVanishingPoint &s, const vpCameraParameters &cam, const vpImagePoint &line1_ip1,
156  const vpImagePoint &line1_ip2, const vpImagePoint &line2_ip1, const vpImagePoint &line2_ip2,
157  unsigned int select);
158 };
159 #endif
Generic class defining intrinsic camera parameters.
Class that defines a 3D circle in the object frame and allows forward projection of a 3D circle in th...
Definition: vpCircle.h:92
Class that defines a 3D cylinder in the object frame and allows forward projection of a 3D cylinder i...
Definition: vpCylinder.h:103
This tracker is meant to track a blob (connex pixels with same gray level) on a vpImage.
Definition: vpDot2.h:127
This tracker is meant to track a dot (connected pixels with same gray level) on a vpImage.
Definition: vpDot.h:116
Class that defines conversion between trackers and visual features.
Class that defines 2D ellipse visual feature.
Class that defines a 2D line visual feature which is composed by two parameters that are and ,...
Class that defines the 3D point visual feature.
Class that defines 2D image point visual feature with polar coordinates described in .
Class that defines a 2D point visual feature which is composed by two parameters that are the cartes...
Class that defines a 2D segment visual features. This class allow to consider two sets of visual feat...
static unsigned int selectX()
Select visual feature .
static unsigned int selectY()
Select visual feature .
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:89
Class that defines a 3D line in the object frame and allows forward projection of the line in the cam...
Definition: vpLine.h:105
Class that tracks an ellipse using moving edges.
Definition: vpMeEllipse.h:98
Class that tracks in an image a line moving edges.
Definition: vpMeLine.h:152
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
Definition: vpPoint.h:82
Class that defines a 3D sphere in the object frame and allows forward projection of a 3D sphere in th...
Definition: vpSphere.h:83