Point Cloud Library (PCL) 1.15.1-dev
Loading...
Searching...
No Matches
point_types.hpp
1/*
2 * Software License Agreement (BSD License)
3 *
4 * Point Cloud Library (PCL) - www.pointclouds.org
5 * Copyright (c) 2010, Willow Garage, Inc.
6 * Copyright (c) 2012-, Open Perception, Inc.
7 *
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 *
14 * * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * * Redistributions in binary form must reproduce the above
17 * copyright notice, this list of conditions and the following
18 * disclaimer in the documentation and/or other materials provided
19 * with the distribution.
20 * * Neither the name of the copyright holder(s) nor the names of its
21 * contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 *
37 */
38
39#pragma once
40
41#include <pcl/memory.h> // for PCL_MAKE_ALIGNED_OPERATOR_NEW
42#include <pcl/pcl_config.h> // for PCL_XYZ_POINT_TYPES, PCL_NORMAL_POINT_TYPES
43#include <pcl/pcl_macros.h> // for PCL_EXPORTS
44#include <pcl/PCLPointField.h> // for PCLPointField
45#include <pcl/point_types.h> // implementee
46#include <pcl/feature_types.h> // for feature types
47#include <pcl/register_point_struct.h> // for POINT_CLOUD_REGISTER_POINT_STRUCT, POINT_CLOUD_REGISTER_POINT_WRAPPER
48
49#include <Eigen/Core> // for MatrixMap
50
51#include <algorithm> // for copy_n, fill_n
52#include <cstdint> // for uint8_t, uint32_t
53#include <ostream> // for ostream, operator<<
54
55// Define all PCL point types
56#define PCL_POINT_TYPES \
57 (pcl::PointXYZ) \
58 (pcl::PointXYZI) \
59 (pcl::PointXYZL) \
60 (pcl::Label) \
61 (pcl::PointXYZRGBA) \
62 (pcl::PointXYZRGB) \
63 (pcl::PointXYZRGBL) \
64 (pcl::PointXYZLAB) \
65 (pcl::PointXYZHSV) \
66 (pcl::PointXY) \
67 (pcl::InterestPoint) \
68 (pcl::Axis) \
69 (pcl::Normal) \
70 (pcl::PointNormal) \
71 (pcl::PointXYZRGBNormal) \
72 (pcl::PointXYZINormal) \
73 (pcl::PointXYZLNormal) \
74 (pcl::PointWithRange) \
75 (pcl::PointWithViewpoint) \
76 (pcl::MomentInvariants) \
77 (pcl::PrincipalRadiiRSD) \
78 (pcl::Boundary) \
79 (pcl::PrincipalCurvatures) \
80 (pcl::PFHSignature125) \
81 (pcl::PFHRGBSignature250) \
82 (pcl::PPFSignature) \
83 (pcl::CPPFSignature) \
84 (pcl::PPFRGBSignature) \
85 (pcl::NormalBasedSignature12) \
86 (pcl::FPFHSignature33) \
87 (pcl::VFHSignature308) \
88 (pcl::GASDSignature512) \
89 (pcl::GASDSignature984) \
90 (pcl::GASDSignature7992) \
91 (pcl::GRSDSignature21) \
92 (pcl::ESFSignature640) \
93 (pcl::BRISKSignature512) \
94 (pcl::Narf36) \
95 (pcl::IntensityGradient) \
96 (pcl::PointWithScale) \
97 (pcl::PointSurfel) \
98 (pcl::ShapeContext1980) \
99 (pcl::UniqueShapeContext1960) \
100 (pcl::SHOT352) \
101 (pcl::SHOT1344) \
102 (pcl::PointUV) \
103 (pcl::ReferenceFrame) \
104 (pcl::PointDEM)
105
106// Define all point types that include RGB data
107#define PCL_RGB_POINT_TYPES \
108 (pcl::PointXYZRGBA) \
109 (pcl::PointXYZRGB) \
110 (pcl::PointXYZRGBL) \
111 (pcl::PointXYZRGBNormal) \
112 (pcl::PointSurfel) \
113
114// Define all point types with XYZ and label
115#define PCL_XYZL_POINT_TYPES \
116 (pcl::PointXYZL) \
117 (pcl::PointXYZRGBL) \
118 (pcl::PointXYZLNormal)
119
120// Define all point types that represent features
121#define PCL_FEATURE_POINT_TYPES \
122 (pcl::PFHSignature125) \
123 (pcl::PFHRGBSignature250) \
124 (pcl::PPFSignature) \
125 (pcl::CPPFSignature) \
126 (pcl::PPFRGBSignature) \
127 (pcl::NormalBasedSignature12) \
128 (pcl::FPFHSignature33) \
129 (pcl::VFHSignature308) \
130 (pcl::GASDSignature512) \
131 (pcl::GASDSignature984) \
132 (pcl::GASDSignature7992) \
133 (pcl::GRSDSignature21) \
134 (pcl::ESFSignature640) \
135 (pcl::BRISKSignature512) \
136 (pcl::Narf36)
137
138// Define all point types that have descriptorSize() member function
139#define PCL_DESCRIPTOR_FEATURE_POINT_TYPES \
140 (pcl::PFHSignature125) \
141 (pcl::PFHRGBSignature250) \
142 (pcl::FPFHSignature33) \
143 (pcl::VFHSignature308) \
144 (pcl::GASDSignature512) \
145 (pcl::GASDSignature984) \
146 (pcl::GASDSignature7992) \
147 (pcl::GRSDSignature21) \
148 (pcl::ESFSignature640) \
149 (pcl::BRISKSignature512) \
150 (pcl::Narf36)
151
152
153namespace pcl
154{
155 using Vector2fMap = Eigen::Map<Eigen::Vector2f>;
156 using Vector2fMapConst = const Eigen::Map<const Eigen::Vector2f>;
157 using Array3fMap = Eigen::Map<Eigen::Array3f>;
158 using Array3fMapConst = const Eigen::Map<const Eigen::Array3f>;
159 using Array4fMap = Eigen::Map<Eigen::Array4f, Eigen::Aligned>;
160 using Array4fMapConst = const Eigen::Map<const Eigen::Array4f, Eigen::Aligned>;
161 using Vector3fMap = Eigen::Map<Eigen::Vector3f>;
162 using Vector3fMapConst = const Eigen::Map<const Eigen::Vector3f>;
163 using Vector4fMap = Eigen::Map<Eigen::Vector4f, Eigen::Aligned>;
164 using Vector4fMapConst = const Eigen::Map<const Eigen::Vector4f, Eigen::Aligned>;
165
166 using Vector3c = Eigen::Matrix<std::uint8_t, 3, 1>;
167 using Vector3cMap = Eigen::Map<Vector3c>;
168 using Vector3cMapConst = const Eigen::Map<const Vector3c>;
169 using Vector4c = Eigen::Matrix<std::uint8_t, 4, 1>;
170 using Vector4cMap = Eigen::Map<Vector4c, Eigen::Aligned>;
171 using Vector4cMapConst = const Eigen::Map<const Vector4c, Eigen::Aligned>;
172
173// note: 4th homogeneous coordinate is uninitialized, has to be set to 1
174// explicitly if needed for matrix operations.
175#define PCL_ADD_UNION_POINT4D \
176 union EIGEN_ALIGN16 { \
177 float data[4]; \
178 struct { \
179 float x; \
180 float y; \
181 float z; \
182 }; \
183 };
184
185#define PCL_ADD_EIGEN_MAPS_POINT4D \
186 inline pcl::Vector2fMap getVector2fMap () { return (pcl::Vector2fMap (data)); } \
187 inline pcl::Vector2fMapConst getVector2fMap () const { return (pcl::Vector2fMapConst (data)); } \
188 inline pcl::Vector3fMap getVector3fMap () { return (pcl::Vector3fMap (data)); } \
189 inline pcl::Vector3fMapConst getVector3fMap () const { return (pcl::Vector3fMapConst (data)); } \
190 inline pcl::Vector4fMap getVector4fMap () { return (pcl::Vector4fMap (data)); } \
191 inline pcl::Vector4fMapConst getVector4fMap () const { return (pcl::Vector4fMapConst (data)); } \
192 inline pcl::Array3fMap getArray3fMap () { return (pcl::Array3fMap (data)); } \
193 inline pcl::Array3fMapConst getArray3fMap () const { return (pcl::Array3fMapConst (data)); } \
194 inline pcl::Array4fMap getArray4fMap () { return (pcl::Array4fMap (data)); } \
195 inline pcl::Array4fMapConst getArray4fMap () const { return (pcl::Array4fMapConst (data)); }
196
197#define PCL_ADD_POINT4D \
198 PCL_ADD_UNION_POINT4D \
199 PCL_ADD_EIGEN_MAPS_POINT4D
200
201#define PCL_ADD_UNION_NORMAL4D \
202 union EIGEN_ALIGN16 { \
203 float data_n[4]; \
204 float normal[3]; \
205 struct { \
206 float normal_x; \
207 float normal_y; \
208 float normal_z; \
209 }; \
210 };
211
212#define PCL_ADD_EIGEN_MAPS_NORMAL4D \
213 inline pcl::Vector3fMap getNormalVector3fMap () { return (pcl::Vector3fMap (data_n)); } \
214 inline pcl::Vector3fMapConst getNormalVector3fMap () const { return (pcl::Vector3fMapConst (data_n)); } \
215 inline pcl::Vector4fMap getNormalVector4fMap () { return (pcl::Vector4fMap (data_n)); } \
216 inline pcl::Vector4fMapConst getNormalVector4fMap () const { return (pcl::Vector4fMapConst (data_n)); }
217
218#define PCL_ADD_NORMAL4D \
219 PCL_ADD_UNION_NORMAL4D \
220 PCL_ADD_EIGEN_MAPS_NORMAL4D
221
222#define PCL_ADD_UNION_RGB \
223 union \
224 { \
225 union \
226 { \
227 struct \
228 { \
229 std::uint8_t b; \
230 std::uint8_t g; \
231 std::uint8_t r; \
232 std::uint8_t a; \
233 }; \
234 float rgb; \
235 }; \
236 std::uint32_t rgba; \
237 };
238
239#define PCL_ADD_EIGEN_MAPS_RGB \
240 inline Eigen::Vector3i getRGBVector3i () { return (Eigen::Vector3i (r, g, b)); } \
241 inline const Eigen::Vector3i getRGBVector3i () const { return (Eigen::Vector3i (r, g, b)); } \
242 inline Eigen::Vector4i getRGBVector4i () { return (Eigen::Vector4i (r, g, b, a)); } \
243 inline const Eigen::Vector4i getRGBVector4i () const { return (Eigen::Vector4i (r, g, b, a)); } \
244 inline Eigen::Vector4i getRGBAVector4i () { return (Eigen::Vector4i (r, g, b, a)); } \
245 inline const Eigen::Vector4i getRGBAVector4i () const { return (Eigen::Vector4i (r, g, b, a)); } \
246 inline pcl::Vector3cMap getBGRVector3cMap () { return (pcl::Vector3cMap (reinterpret_cast<std::uint8_t*> (&rgba))); } \
247 inline pcl::Vector3cMapConst getBGRVector3cMap () const { return (pcl::Vector3cMapConst (reinterpret_cast<const std::uint8_t*> (&rgba))); } \
248 inline pcl::Vector4cMap getBGRAVector4cMap () { return (pcl::Vector4cMap (reinterpret_cast<std::uint8_t*> (&rgba))); } \
249 inline pcl::Vector4cMapConst getBGRAVector4cMap () const { return (pcl::Vector4cMapConst (reinterpret_cast<const std::uint8_t*> (&rgba))); }
250
251#define PCL_ADD_RGB \
252 PCL_ADD_UNION_RGB \
253 PCL_ADD_EIGEN_MAPS_RGB
254
255#define PCL_ADD_INTENSITY \
256 struct \
257 { \
258 float intensity; \
259 }; \
260
261#define PCL_ADD_INTENSITY_8U \
262 struct \
263 { \
264 std::uint8_t intensity; \
265 }; \
266
267#define PCL_ADD_INTENSITY_32U \
268 struct \
269 { \
270 std::uint32_t intensity; \
271 }; \
272
273
275 {
276 PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
277
279 };
280
281 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZ& p);
282 /** \brief A point structure representing Euclidean xyz coordinates. (SSE friendly)
283 * \ingroup common
284 */
285 struct EIGEN_ALIGN16 PointXYZ : public _PointXYZ
286 {
287 inline constexpr PointXYZ (const _PointXYZ &p): PointXYZ(p.x, p.y, p.z) {}
288
289 inline constexpr PointXYZ (): PointXYZ(0.f, 0.f, 0.f) {}
290
291 inline constexpr PointXYZ (float _x, float _y, float _z) : _PointXYZ{{{_x, _y, _z, 1.f}}} {}
292
293 friend std::ostream& operator << (std::ostream& os, const PointXYZ& p);
295 };
296
297
298#ifdef RGB
299#undef RGB
300#endif
301 struct _RGB
302 {
303 PCL_ADD_RGB
304 };
305
306 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const RGB& p);
307 /** \brief A structure representing RGB color information.
308 *
309 * The RGBA information is available either as separate r, g, b, or as a
310 * packed std::uint32_t rgba value. To pack it, use:
311 *
312 * \code
313 * int rgb = ((int)r) << 16 | ((int)g) << 8 | ((int)b);
314 * \endcode
315 *
316 * To unpack it use:
317 *
318 * \code
319 * int rgb = ...;
320 * std::uint8_t r = (rgb >> 16) & 0x0000ff;
321 * std::uint8_t g = (rgb >> 8) & 0x0000ff;
322 * std::uint8_t b = (rgb) & 0x0000ff;
323 * \endcode
324 *
325 */
326 struct RGB: public _RGB
327 {
328 inline constexpr RGB (const _RGB &p) : RGB{p.r, p.g, p.b, p.a} {}
329
330 inline constexpr RGB (): RGB(0, 0, 0) {}
331
332 inline constexpr RGB (std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint8_t _a = 255) : _RGB{{{{_b, _g, _r, _a}}}} {}
333
334 friend std::ostream& operator << (std::ostream& os, const RGB& p);
335 };
336
338 {
339 PCL_ADD_INTENSITY
340 };
341
342 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Intensity& p);
343 /** \brief A point structure representing the grayscale intensity in single-channel images.
344 * Intensity is represented as a float value.
345 * \ingroup common
346 */
347 struct Intensity: public _Intensity
348 {
349 inline constexpr Intensity (const _Intensity &p) : Intensity{p.intensity} {}
350
351 inline constexpr Intensity (float _intensity = 0.f) : _Intensity{_intensity} {}
352
353 friend std::ostream& operator << (std::ostream& os, const Intensity& p);
354 };
355
356
361
362 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Intensity8u& p);
363 /** \brief A point structure representing the grayscale intensity in single-channel images.
364 * Intensity is represented as a std::uint8_t value.
365 * \ingroup common
366 */
368 {
369 inline constexpr Intensity8u (const _Intensity8u &p) : Intensity8u{p.intensity} {}
370
371 inline constexpr Intensity8u (std::uint8_t _intensity = 0) : _Intensity8u{_intensity} {}
372
373#if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION <= 1101
374 inline constexpr operator unsigned char() const
375 {
376 return intensity;
377 }
378#endif
379
380 friend std::ostream& operator << (std::ostream& os, const Intensity8u& p);
381 };
382
387
388 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Intensity32u& p);
389 /** \brief A point structure representing the grayscale intensity in single-channel images.
390 * Intensity is represented as a std::uint32_t value.
391 * \ingroup common
392 */
394 {
395 inline constexpr Intensity32u (const _Intensity32u &p) : Intensity32u{p.intensity} {}
396
397 inline constexpr Intensity32u (std::uint32_t _intensity = 0) : _Intensity32u{_intensity} {}
398
399 friend std::ostream& operator << (std::ostream& os, const Intensity32u& p);
400 };
401
402 /** \brief A point structure representing Euclidean xyz coordinates, and the intensity value.
403 * \ingroup common
404 */
405 struct EIGEN_ALIGN16 _PointXYZI
406 {
407 PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
408 union
409 {
410 struct
411 {
413 };
414 float data_c[4];
415 };
417 };
418
419 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZI& p);
420 struct PointXYZI : public _PointXYZI
421 {
422 inline constexpr PointXYZI (const _PointXYZI &p) : PointXYZI{p.x, p.y, p.z, p.intensity} {}
423
424 inline constexpr PointXYZI (float _intensity = 0.f) : PointXYZI(0.f, 0.f, 0.f, _intensity) {}
425
426 inline constexpr PointXYZI (float _x, float _y, float _z, float _intensity = 0.f) : _PointXYZI{{{_x, _y, _z, 1.0f}}, {{_intensity}}} {}
427
428 friend std::ostream& operator << (std::ostream& os, const PointXYZI& p);
429 };
430
431
432 struct EIGEN_ALIGN16 _PointXYZL
433 {
434 PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
435 std::uint32_t label;
437 };
438
439 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZL& p);
440 struct PointXYZL : public _PointXYZL
441 {
442 inline constexpr PointXYZL (const _PointXYZL &p) : PointXYZL{p.x, p.y, p.z, p.label} {}
443
444 inline constexpr PointXYZL (std::uint32_t _label = 0) : PointXYZL(0.f, 0.f, 0.f, _label) {}
445
446 inline constexpr PointXYZL (float _x, float _y, float _z, std::uint32_t _label = 0) : _PointXYZL{{{_x, _y, _z, 1.0f}}, _label} {}
447
448 friend std::ostream& operator << (std::ostream& os, const PointXYZL& p);
449 };
450
451
452 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Label& p);
453 struct Label
454 {
455 std::uint32_t label = 0;
456
457 inline constexpr Label (std::uint32_t _label = 0): label(_label) {}
458
459 friend std::ostream& operator << (std::ostream& os, const Label& p);
460 };
461
462
463 struct EIGEN_ALIGN16 _PointXYZRGBA
464 {
465 PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
466 PCL_ADD_RGB
468 };
469
470 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGBA& p);
471 /** \brief A point structure representing Euclidean xyz coordinates, and the RGBA color.
472 *
473 * The RGBA information is available either as separate r, g, b, or as a
474 * packed std::uint32_t rgba value. To pack it, use:
475 *
476 * \code
477 * int rgb = ((int)r) << 16 | ((int)g) << 8 | ((int)b);
478 * \endcode
479 *
480 * To unpack it use:
481 *
482 * \code
483 * int rgb = ...;
484 * std::uint8_t r = (rgb >> 16) & 0x0000ff;
485 * std::uint8_t g = (rgb >> 8) & 0x0000ff;
486 * std::uint8_t b = (rgb) & 0x0000ff;
487 * \endcode
488 *
489 * \ingroup common
490 */
491 struct EIGEN_ALIGN16 PointXYZRGBA : public _PointXYZRGBA
492 {
493 inline constexpr PointXYZRGBA (const _PointXYZRGBA &p) : PointXYZRGBA{p.x, p.y, p.z, p.r, p.g, p.b, p.a} {}
494
495 inline constexpr PointXYZRGBA (): PointXYZRGBA (0, 0, 0, 255) {}
496
497 inline constexpr PointXYZRGBA (std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint8_t _a):
498 PointXYZRGBA (0.f, 0.f, 0.f, _r, _g, _b, _a) {}
499
500 inline constexpr PointXYZRGBA (float _x, float _y, float _z):
501 PointXYZRGBA (_x, _y, _z, 0, 0, 0, 255) {}
502
503 inline constexpr PointXYZRGBA (float _x, float _y, float _z, std::uint8_t _r,
504 std::uint8_t _g, std::uint8_t _b, std::uint8_t _a) : _PointXYZRGBA{{{_x, _y, _z, 1.0f}}, {{{_b, _g, _r, _a}}}} {}
505
506 friend std::ostream& operator << (std::ostream& os, const PointXYZRGBA& p);
507 };
508
509
510 struct EIGEN_ALIGN16 _PointXYZRGB
511 {
512 PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
513 PCL_ADD_RGB
515 };
516
517 struct EIGEN_ALIGN16 _PointXYZRGBL
518 {
519 PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
520 PCL_ADD_RGB
521 std::uint32_t label;
523 };
524
525 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGB& p);
526 /** \brief A point structure representing Euclidean xyz coordinates, and the RGB color.
527 *
528 * Due to historical reasons (PCL was first developed as a ROS package), the
529 * RGB information is packed into an integer and casted to a float. This is
530 * something we wish to remove in the near future, but in the meantime, the
531 * following code snippet should help you pack and unpack RGB colors in your
532 * PointXYZRGB structure:
533 *
534 * \code
535 * // pack r/g/b into rgb
536 * std::uint8_t r = 255, g = 0, b = 0; // Example: Red color
537 * std::uint32_t rgb = ((std::uint32_t)r << 16 | (std::uint32_t)g << 8 | (std::uint32_t)b);
538 * p.rgb = *reinterpret_cast<float*>(&rgb);
539 * \endcode
540 *
541 * To unpack the data into separate values, use:
542 *
543 * \code
544 * PointXYZRGB p;
545 * // unpack rgb into r/g/b
546 * std::uint32_t rgb = *reinterpret_cast<int*>(&p.rgb);
547 * std::uint8_t r = (rgb >> 16) & 0x0000ff;
548 * std::uint8_t g = (rgb >> 8) & 0x0000ff;
549 * std::uint8_t b = (rgb) & 0x0000ff;
550 * \endcode
551 *
552 *
553 * Alternatively, from 1.1.0 onwards, you can use p.r, p.g, and p.b directly.
554 *
555 * \ingroup common
556 */
557 struct EIGEN_ALIGN16 PointXYZRGB : public _PointXYZRGB
558 {
559 inline constexpr PointXYZRGB (const _PointXYZRGB &p) : PointXYZRGB{p.x, p.y, p.z, p.r, p.g, p.b} {}
560
561 inline constexpr PointXYZRGB (): PointXYZRGB (0.f, 0.f, 0.f) {}
562
563 inline constexpr PointXYZRGB (std::uint8_t _r, std::uint8_t _g, std::uint8_t _b):
564 PointXYZRGB (0.f, 0.f, 0.f, _r, _g, _b) {}
565
566 inline constexpr PointXYZRGB (float _x, float _y, float _z):
567 PointXYZRGB (_x, _y, _z, 0, 0, 0) {}
568
569 inline constexpr PointXYZRGB (float _x, float _y, float _z,
570 std::uint8_t _r, std::uint8_t _g, std::uint8_t _b):
571 _PointXYZRGB{{{_x, _y, _z, 1.0f}}, {{{_b, _g, _r, 255}}}} {}
572
573 friend std::ostream& operator << (std::ostream& os, const PointXYZRGB& p);
575 };
576
577
578 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGBL& p);
579 struct EIGEN_ALIGN16 PointXYZRGBL : public _PointXYZRGBL
580 {
581 inline constexpr PointXYZRGBL (const _PointXYZRGBL &p) : PointXYZRGBL{p.x, p.y, p.z, p.r, p.g, p.b, p.label, p.a} {}
582
583 inline constexpr PointXYZRGBL (std::uint32_t _label = 0):
584 PointXYZRGBL (0.f, 0.f, 0.f, 0, 0, 0, _label) {}
585
586 inline constexpr PointXYZRGBL (std::uint8_t _r, std::uint8_t _g, std::uint8_t _b):
587 PointXYZRGBL (0.f, 0.f, 0.f, _r, _g, _b) {}
588
589 inline constexpr PointXYZRGBL (float _x, float _y, float _z):
590 PointXYZRGBL (_x, _y, _z, 0, 0, 0) {}
591
592 inline constexpr PointXYZRGBL (float _x, float _y, float _z,
593 std::uint8_t _r, std::uint8_t _g, std::uint8_t _b,
594 std::uint32_t _label = 0, std::uint8_t _a = 255) :
595 _PointXYZRGBL{{{_x, _y, _z, 1.0f}}, {{{_b, _g, _r, _a}}}, _label} {}
596
597 friend std::ostream& operator << (std::ostream& os, const PointXYZRGBL& p);
599 };
600
601
602 struct EIGEN_ALIGN16 _PointXYZLAB
603 {
604 PCL_ADD_POINT4D // this adds the members x,y,z
605 union
606 {
607 struct
608 {
609 float L;
610 float a;
611 float b;
612 };
613 float data_lab[4];
614 };
616 };
617
618 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZLAB& p);
619 /** \brief A point structure representing Euclidean xyz coordinates, and the CIELAB color.
620 * \ingroup common
621 */
622 struct PointXYZLAB : public _PointXYZLAB
623 {
624 inline constexpr PointXYZLAB (const _PointXYZLAB &p) : PointXYZLAB{p.x, p.y, p.z, p.L, p.a, p.b} {}
625
626 inline constexpr PointXYZLAB() : PointXYZLAB{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f} {}
627
628 inline constexpr PointXYZLAB (float _x, float _y, float _z,
629 float _l, float _a, float _b) :
630 _PointXYZLAB{ {{_x, _y, _z, 1.0f}}, {{_l, _a, _b}} } {}
631
632 friend std::ostream& operator << (std::ostream& os, const PointXYZLAB& p);
634 };
635
636
637 struct EIGEN_ALIGN16 _PointXYZHSV
638 {
639 PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
640 union
641 {
642 struct
643 {
644 float h;
645 float s;
646 float v;
647 };
648 float data_c[4];
649 };
651 };
652
653 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZHSV& p);
654 struct EIGEN_ALIGN16 PointXYZHSV : public _PointXYZHSV
655 {
656 inline constexpr PointXYZHSV (const _PointXYZHSV &p) :
657 PointXYZHSV{p.x, p.y, p.z, p.h, p.s, p.v} {}
658
659 inline constexpr PointXYZHSV (): PointXYZHSV (0.f, 0.f, 0.f) {}
660
661 // @TODO: Use strong types??
662 // This is a dangerous type, doesn't behave like others
663 inline constexpr PointXYZHSV (float _h, float _s, float _v):
664 PointXYZHSV (0.f, 0.f, 0.f, _h, _s, _v) {}
665
666 inline constexpr PointXYZHSV (float _x, float _y, float _z,
667 float _h, float _s, float _v) :
668 _PointXYZHSV{{{_x, _y, _z, 1.0f}}, {{_h, _s, _v}}} {}
669
670 friend std::ostream& operator << (std::ostream& os, const PointXYZHSV& p);
672 };
673
674 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXY& p);
675 /** \brief A 2D point structure representing Euclidean xy coordinates.
676 * \ingroup common
677 */
678 // NOLINTBEGIN(modernize-use-default-member-init)
679 struct PointXY
680 {
681 union
682 {
683 float data[2];
684 struct
685 {
686 float x;
687 float y;
688 };
689 };
690
691 inline constexpr PointXY(float _x, float _y): x(_x), y(_y) {}
692 inline constexpr PointXY(): x(0.0f), y(0.0f) {}
693
694 inline pcl::Vector2fMap getVector2fMap () { return (pcl::Vector2fMap (data)); }
695 inline pcl::Vector2fMapConst getVector2fMap () const { return (pcl::Vector2fMapConst (data)); }
696
697 friend std::ostream& operator << (std::ostream& os, const PointXY& p);
698 };
699 // NOLINTEND(modernize-use-default-member-init)
700
701 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointUV& p);
702 /** \brief A 2D point structure representing pixel image coordinates.
703 * \note We use float to be able to represent subpixels.
704 * \ingroup common
705 */
706 struct PointUV
707 {
708 float u = 0.f;
709 float v = 0.f;
710
711 inline constexpr PointUV() = default;
712
713 inline constexpr PointUV(float _u, float _v): u(_u), v(_v) {}
714
715 friend std::ostream& operator << (std::ostream& os, const PointUV& p);
716 };
717
718 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const InterestPoint& p);
719 /** \brief A point structure representing an interest point with Euclidean xyz coordinates, and an interest value.
720 * \ingroup common
721 */
722 // @TODO: inheritance trick like on other PointTypes
723 struct EIGEN_ALIGN16 InterestPoint
724 {
725 PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
726 union
727 {
728 struct
729 {
730 float strength;
731 };
732 float data_c[4];
733 };
735
736 friend std::ostream& operator << (std::ostream& os, const InterestPoint& p);
737 };
738
739 struct EIGEN_ALIGN16 _Normal
740 {
741 PCL_ADD_NORMAL4D // This adds the member normal[3] which can also be accessed using the point (which is float[4])
742 union
743 {
744 struct
745 {
747 };
748 float data_c[4];
749 };
751 };
752
753 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Normal& p);
754 /** \brief A point structure representing normal coordinates and the surface curvature estimate. (SSE friendly)
755 * \ingroup common
756 */
757 struct Normal : public _Normal
758 {
759 inline constexpr Normal (const _Normal &p) : Normal {p.normal_x, p.normal_y, p.normal_z, p.curvature} {}
760
761 inline constexpr Normal (float _curvature = 0.f): Normal (0.f, 0.f, 0.f, _curvature) {}
762
763 inline constexpr Normal (float n_x, float n_y, float n_z, float _curvature = 0.f) :
764 _Normal{{{n_x, n_y, n_z, 0.0f}}, {{_curvature}}} {}
765
766 friend std::ostream& operator << (std::ostream& os, const Normal& p);
768 };
769
770
771 struct EIGEN_ALIGN16 _Axis
772 {
773 PCL_ADD_NORMAL4D
775 };
776
777 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Axis& p);
778 /** \brief A point structure representing an Axis using its normal coordinates. (SSE friendly)
779 * \ingroup common
780 */
781 struct EIGEN_ALIGN16 Axis : public _Axis
782 {
783 inline constexpr Axis (const _Axis &p) : Axis{p.normal_x, p.normal_y, p.normal_z} {}
784
785 inline constexpr Axis (): Axis (0.f, 0.f, 0.f) {}
786
787 inline constexpr Axis (float n_x, float n_y, float n_z) : _Axis{{{n_x, n_y, n_z, 0.0f}}} {}
788
789 friend std::ostream& operator << (std::ostream& os, const Axis& p);
791 };
792
793
794 struct EIGEN_ALIGN16 _PointNormal
795 {
796 PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
797 PCL_ADD_NORMAL4D // This adds the member normal[3] which can also be accessed using the point (which is float[4])
798 union
799 {
800 struct
801 {
803 };
804 float data_c[4];
805 };
807 };
808
809 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointNormal& p);
810 /** \brief A point structure representing Euclidean xyz coordinates, together with normal coordinates and the surface curvature estimate. (SSE friendly)
811 * \ingroup common
812 */
813 struct PointNormal : public _PointNormal
814 {
815 inline constexpr PointNormal (const _PointNormal &p) : PointNormal{p.x, p.y, p.z, p.normal_x, p.normal_y, p.normal_z, p.curvature} {}
816
817 inline constexpr PointNormal (float _curvature = 0.f): PointNormal (0.f, 0.f, 0.f, 0.f, 0.f, 0.f, _curvature) {}
818
819 inline constexpr PointNormal (float _x, float _y, float _z):
820 PointNormal (_x, _y, _z, 0.f, 0.f, 0.f, 0.f) {}
821
822 inline constexpr PointNormal (float _x, float _y, float _z, float n_x, float n_y, float n_z, float _curvature = 0.f) :
823 _PointNormal{{{_x, _y, _z, 1.0f}}, {{n_x, n_y, n_z, 0.0f}}, {{_curvature}}} {}
824
825 friend std::ostream& operator << (std::ostream& os, const PointNormal& p);
826 };
827
828
829 struct EIGEN_ALIGN16 _PointXYZRGBNormal
830 {
831 PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
832 PCL_ADD_NORMAL4D // This adds the member normal[3] which can also be accessed using the point (which is float[4])
833 union
834 {
835 struct
836 {
837 PCL_ADD_UNION_RGB
839 };
840 float data_c[4];
841 };
842 PCL_ADD_EIGEN_MAPS_RGB
844 };
845
846 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGBNormal& p);
847 /** \brief A point structure representing Euclidean xyz coordinates, and the RGB color, together with normal coordinates and the surface curvature estimate.
848 * Due to historical reasons (PCL was first developed as a ROS package), the
849 * RGB information is packed into an integer and casted to a float. This is
850 * something we wish to remove in the near future, but in the meantime, the
851 * following code snippet should help you pack and unpack RGB colors in your
852 * PointXYZRGB structure:
853 *
854 * \code
855 * // pack r/g/b into rgb
856 * std::uint8_t r = 255, g = 0, b = 0; // Example: Red color
857 * std::uint32_t rgb = ((std::uint32_t)r << 16 | (std::uint32_t)g << 8 | (std::uint32_t)b);
858 * p.rgb = *reinterpret_cast<float*>(&rgb);
859 * \endcode
860 *
861 * To unpack the data into separate values, use:
862 *
863 * \code
864 * PointXYZRGB p;
865 * // unpack rgb into r/g/b
866 * std::uint32_t rgb = *reinterpret_cast<int*>(&p.rgb);
867 * std::uint8_t r = (rgb >> 16) & 0x0000ff;
868 * std::uint8_t g = (rgb >> 8) & 0x0000ff;
869 * std::uint8_t b = (rgb) & 0x0000ff;
870 * \endcode
871 *
872 *
873 * Alternatively, from 1.1.0 onwards, you can use p.r, p.g, and p.b directly.
874 * \ingroup common
875 */
877 {
878 inline constexpr PointXYZRGBNormal (const _PointXYZRGBNormal &p) :
879 PointXYZRGBNormal {p.x, p.y, p.z, p.r, p.g, p.b, p.a, p.normal_x, p.normal_y, p.normal_z, p.curvature} {}
880
881 inline constexpr PointXYZRGBNormal (float _curvature = 0.f):
882 PointXYZRGBNormal (0.f, 0.f, 0.f, 0, 0, 0, 0.f, 0.f, 0.f, _curvature) {}
883
884 inline constexpr PointXYZRGBNormal (float _x, float _y, float _z):
885 PointXYZRGBNormal (_x, _y, _z, 0, 0, 0) {}
886
887 inline constexpr PointXYZRGBNormal (std::uint8_t _r, std::uint8_t _g, std::uint8_t _b):
888 PointXYZRGBNormal (0.f, 0.f, 0.f, _r, _g, _b) {}
889
890 inline constexpr PointXYZRGBNormal (float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b):
891 PointXYZRGBNormal (_x, _y, _z, _r, _g, _b, 0.f, 0.f, 0.f) {}
892
893 inline constexpr PointXYZRGBNormal (float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b,
894 float n_x, float n_y, float n_z, float _curvature = 0.f) :
896 {{_x, _y, _z, 1.0f}},
897 {{n_x, n_y, n_z, 0.0f}},
898 {{ {{{_b, _g, _r, 255u}}}, _curvature }}
899 }
900 {}
901
902 inline constexpr PointXYZRGBNormal (float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b,
903 std::uint8_t _a, float n_x, float n_y, float n_z, float _curvature = 0.f) :
905 {{_x, _y, _z, 1.0f}},
906 {{n_x, n_y, n_z, 0.0f}},
907 {{ {{{_b, _g, _r, _a}}}, _curvature }}
908 }
909 {}
910
911
912 friend std::ostream& operator << (std::ostream& os, const PointXYZRGBNormal& p);
913 };
914
915 struct EIGEN_ALIGN16 _PointXYZINormal
916 {
917 PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
918 PCL_ADD_NORMAL4D // This adds the member normal[3] which can also be accessed using the point (which is float[4])
919 union
920 {
921 struct
922 {
925 };
926 float data_c[4];
927 };
929 };
930
931 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZINormal& p);
932 /** \brief A point structure representing Euclidean xyz coordinates, intensity, together with normal coordinates and the surface curvature estimate.
933 * \ingroup common
934 */
936 {
937 inline constexpr PointXYZINormal (const _PointXYZINormal &p) :
938 PointXYZINormal {p.x, p.y, p.z, p.intensity, p.normal_x, p.normal_y, p.normal_z, p.curvature} {}
939
940 inline constexpr PointXYZINormal (float _intensity = 0.f): PointXYZINormal (0.f, 0.f, 0.f, _intensity) {}
941
942 inline constexpr PointXYZINormal (float _x, float _y, float _z, float _intensity = 0.f):
943 PointXYZINormal (_x, _y, _z, _intensity, 0.f, 0.f, 0.f) {}
944
945 inline constexpr PointXYZINormal (float _x, float _y, float _z, float _intensity,
946 float n_x, float n_y, float n_z, float _curvature = 0.f) :
948 {{_x, _y, _z, 1.0f}},
949 {{n_x, n_y, n_z, 0.0f}},
950 {{_intensity, _curvature}}
951 }
952 {}
953
954 friend std::ostream& operator << (std::ostream& os, const PointXYZINormal& p);
955 };
956
957//----
958 struct EIGEN_ALIGN16 _PointXYZLNormal
959 {
960 PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
961 PCL_ADD_NORMAL4D // This adds the member normal[3] which can also be accessed using the point (which is float[4])
962 union
963 {
964 struct
965 {
966 std::uint32_t label;
968 };
969 float data_c[4];
970 };
972 };
973
974 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZLNormal& p);
975 /** \brief A point structure representing Euclidean xyz coordinates, a label, together with normal coordinates and the surface curvature estimate.
976 * \ingroup common
977 */
979 {
980 inline constexpr PointXYZLNormal (const _PointXYZLNormal &p) :
981 PointXYZLNormal {p.x, p.y, p.z, p.label, p.normal_x, p.normal_y, p.normal_z, p.curvature} {}
982
983 inline constexpr PointXYZLNormal (std::uint32_t _label = 0u): PointXYZLNormal (0.f, 0.f, 0.f, _label) {}
984
985 inline constexpr PointXYZLNormal (float _x, float _y, float _z, std::uint32_t _label = 0u) :
986 PointXYZLNormal (_x, _y, _z, _label, 0.f, 0.f, 0.f) {}
987
988 inline constexpr PointXYZLNormal (float _x, float _y, float _z, std::uint32_t _label,
989 float n_x, float n_y, float n_z, float _curvature = 0.f) :
991 {{_x, _y, _z, 1.0f}},
992 {{n_x, n_y, n_z, 0.0f}},
993 {{_label, _curvature}}
994 }
995 {}
996
997 friend std::ostream& operator << (std::ostream& os, const PointXYZLNormal& p);
998 };
999
1000// ---
1001
1002
1003 struct EIGEN_ALIGN16 _PointWithRange
1004 {
1005 PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1006 union
1007 {
1008 struct
1009 {
1010 float range;
1011 };
1012 float data_c[4];
1013 };
1015 };
1016
1017 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointWithRange& p);
1018 /** \brief A point structure representing Euclidean xyz coordinates, padded with an extra range float.
1019 * \ingroup common
1020 */
1022 {
1023 inline constexpr PointWithRange (const _PointWithRange &p) : PointWithRange{p.x, p.y, p.z, p.range} {}
1024
1025 inline constexpr PointWithRange (float _range = 0.f): PointWithRange (0.f, 0.f, 0.f, _range) {}
1026
1027 inline constexpr PointWithRange (float _x, float _y, float _z, float _range = 0.f) :
1028 _PointWithRange{{{_x, _y, _z, 1.0f}}, {{_range}}} {}
1029
1030 friend std::ostream& operator << (std::ostream& os, const PointWithRange& p);
1031 };
1032
1033
1034 struct EIGEN_ALIGN16 _PointWithViewpoint
1035 {
1036 PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1037 union
1038 {
1039 struct
1040 {
1041 float vp_x;
1042 float vp_y;
1043 float vp_z;
1044 };
1045 float data_c[4];
1046 };
1048 };
1049
1050 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointWithViewpoint& p);
1051 /** \brief A point structure representing Euclidean xyz coordinates together with the viewpoint from which it was seen.
1052 * \ingroup common
1053 */
1054 struct EIGEN_ALIGN16 PointWithViewpoint : public _PointWithViewpoint
1055 {
1056 inline constexpr PointWithViewpoint (const _PointWithViewpoint &p) : PointWithViewpoint{p.x, p.y, p.z, p.vp_x, p.vp_y, p.vp_z} {}
1057
1058 inline constexpr PointWithViewpoint (): PointWithViewpoint (0.f, 0.f, 0.f) {}
1059
1060 inline constexpr PointWithViewpoint (float _x, float _y, float _z): PointWithViewpoint (_x, _y, _z, 0.f, 0.f, 0.f) {}
1061
1062 inline constexpr PointWithViewpoint (float _x, float _y, float _z, float _vp_x, float _vp_y, float _vp_z) :
1063 _PointWithViewpoint{{{_x, _y, _z, 1.0f}}, {{_vp_x, _vp_y, _vp_z}}} {}
1064
1065 friend std::ostream& operator << (std::ostream& os, const PointWithViewpoint& p);
1066 };
1067
1068 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const BorderDescription& p);
1069 /** \brief A structure to store if a point in a range image lies on a border between an obstacle and the background.
1070 * \ingroup common
1071 */
1073 {
1074 int x = 0, y = 0;
1076 //std::vector<const BorderDescription*> neighbors;
1077
1078 inline constexpr BorderDescription () = default;
1079
1080 inline constexpr BorderDescription (int _x, int _y) : x(_x), y(_y) {}
1081
1082 friend std::ostream& operator << (std::ostream& os, const BorderDescription& p);
1083 };
1084
1085
1086 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const IntensityGradient& p);
1087 /** \brief A point structure representing the intensity gradient of an XYZI point cloud.
1088 * \ingroup common
1089 */
1091 {
1092 union
1093 {
1094 float gradient[3];
1095 struct
1096 {
1100 };
1101 };
1102
1103 inline constexpr IntensityGradient (): IntensityGradient (0.f, 0.f, 0.f) {}
1104
1105 inline constexpr IntensityGradient (float _x, float _y, float _z): gradient_x (_x), gradient_y (_y), gradient_z (_z) {}
1106 friend std::ostream& operator << (std::ostream& os, const IntensityGradient& p);
1107 };
1108
1109 struct EIGEN_ALIGN16 _PointWithScale
1110 {
1111 PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1112
1113 union
1114 {
1115 /** \brief Diameter of the meaningful keypoint neighborhood. */
1116 float scale;
1117 float size;
1118 };
1119
1120 /** \brief Computed orientation of the keypoint (-1 if not applicable). */
1121 float angle;
1122 /** \brief The response by which the most strong keypoints have been selected. */
1124 /** \brief octave (pyramid layer) from which the keypoint has been extracted. */
1126
1128 };
1129
1130 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointWithScale& p);
1131 /** \brief A point structure representing a 3-D position and scale.
1132 * \ingroup common
1133 */
1135 {
1136 inline constexpr PointWithScale (const _PointWithScale &p) :
1137 PointWithScale{p.x, p.y, p.z, p.scale, p.angle, p.response, p.octave} {}
1138
1139 inline constexpr PointWithScale (): PointWithScale (0.f, 0.f, 0.f) {}
1140
1141 inline constexpr PointWithScale (float _x, float _y, float _z, float _scale = 1.f,
1142 float _angle = -1.f, float _response = 0.f, int _octave = 0) :
1143 _PointWithScale{{{_x, _y, _z, 1.0f}}, {_scale}, _angle, _response, _octave } {}
1144
1145 friend std::ostream& operator << (std::ostream& os, const PointWithScale& p);
1146 };
1147
1148
1149 struct EIGEN_ALIGN16 _PointSurfel
1150 {
1151 PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1152 PCL_ADD_NORMAL4D // This adds the member normal[3] which can also be accessed using the point (which is float[4])
1153 union
1154 {
1155 struct
1156 {
1157 PCL_ADD_UNION_RGB
1158 float radius;
1161 };
1162 float data_c[4];
1163 };
1164 PCL_ADD_EIGEN_MAPS_RGB
1166 };
1167
1168 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointSurfel& p);
1169 /** \brief A surfel, that is, a point structure representing Euclidean xyz coordinates, together with normal coordinates, a RGBA color, a radius, a confidence value and the surface curvature estimate.
1170 * \ingroup common
1171 */
1173 {
1174 inline constexpr PointSurfel (const _PointSurfel &p) :
1175 PointSurfel{p.x, p.y, p.z, p.normal_x, p.normal_y, p.normal_z, p.r, p.g, p.b, p.a, p.radius, p.confidence, p.curvature} {}
1176
1177 inline constexpr PointSurfel () :
1178 PointSurfel{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0u, 0u, 0u, 0u, 0.0f, 0.0f, 0.0f} {}
1179
1180 inline constexpr PointSurfel (float _x, float _y, float _z, float _nx,
1181 float _ny, float _nz, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint8_t _a,
1182 float _radius, float _confidence, float _curvature) :
1184 {{_x, _y, _z, 1.0f}},
1185 {{_nx, _ny, _nz, 0.0f}},
1186 {{{{{_b, _g, _r, _a}}}, _radius, _confidence, _curvature}}
1187 } {}
1188
1189
1190 friend std::ostream& operator << (std::ostream& os, const PointSurfel& p);
1191 };
1192
1193 struct EIGEN_ALIGN16 _PointDEM
1194 {
1195 PCL_ADD_POINT4D
1200 };
1201
1202 PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointDEM& p);
1203 /** \brief A point structure representing Digital Elevation Map.
1204 * \ingroup common
1205 */
1206 struct PointDEM : public _PointDEM
1207 {
1208 inline constexpr PointDEM (const _PointDEM &p) :
1209 PointDEM{p.x, p.y, p.z, p.intensity, p.intensity_variance, p.height_variance} {}
1210
1211 inline constexpr PointDEM (): PointDEM (0.f, 0.f, 0.f) {}
1212
1213 inline constexpr PointDEM (float _x, float _y, float _z): PointDEM (_x, _y, _z, 0.f, 0.f, 0.f) {}
1214
1215 inline constexpr PointDEM (float _x, float _y, float _z, float _intensity,
1216 float _intensity_variance, float _height_variance) :
1217 _PointDEM{{{_x, _y, _z, 1.0f}}, _intensity, _intensity_variance, _height_variance} {}
1218
1219 friend std::ostream& operator << (std::ostream& os, const PointDEM& p);
1220 };
1221} // namespace pcl
1222
1223// Register point structs and wrappers
1224POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_RGB,
1225 (std::uint32_t, rgba, rgba)
1226)
1227POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::RGB, pcl::_RGB)
1228
1229POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Intensity,
1230 (float, intensity, intensity)
1231)
1232POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Intensity, pcl::_Intensity)
1233
1234POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Intensity8u,
1235 (std::uint8_t, intensity, intensity)
1236)
1237POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Intensity8u, pcl::_Intensity8u)
1238
1239POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Intensity32u,
1240 (std::uint32_t, intensity, intensity)
1241)
1242POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Intensity32u, pcl::_Intensity32u)
1243
1244POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZ,
1245 (float, x, x)
1246 (float, y, y)
1247 (float, z, z)
1248)
1249POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZ, pcl::_PointXYZ)
1250
1251POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGBA,
1252 (float, x, x)
1253 (float, y, y)
1254 (float, z, z)
1255 (std::uint32_t, rgba, rgba)
1256)
1257POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBA, pcl::_PointXYZRGBA)
1258
1259POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGB,
1260 (float, x, x)
1261 (float, y, y)
1262 (float, z, z)
1263 (float, rgb, rgb)
1264)
1265POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGB, pcl::_PointXYZRGB)
1266
1267POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGBL,
1268 (float, x, x)
1269 (float, y, y)
1270 (float, z, z)
1271 (std::uint32_t, rgba, rgba)
1272 (std::uint32_t, label, label)
1273)
1274POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBL, pcl::_PointXYZRGBL)
1275
1276POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZLAB,
1277 (float, x, x)
1278 (float, y, y)
1279 (float, z, z)
1280 (float, L, L)
1281 (float, a, a)
1282 (float, b, b)
1283)
1284POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZLAB, pcl::_PointXYZLAB)
1285
1286POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZHSV,
1287 (float, x, x)
1288 (float, y, y)
1289 (float, z, z)
1290 (float, h, h)
1291 (float, s, s)
1292 (float, v, v)
1293)
1294POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZHSV, pcl::_PointXYZHSV)
1295
1296POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXY,
1297 (float, x, x)
1298 (float, y, y)
1299)
1300
1301POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointUV,
1302 (float, u, u)
1303 (float, v, v)
1304)
1305
1306POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::InterestPoint,
1307 (float, x, x)
1308 (float, y, y)
1309 (float, z, z)
1310 (float, strength, strength)
1311)
1312
1313POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZI,
1314 (float, x, x)
1315 (float, y, y)
1316 (float, z, z)
1317 (float, intensity, intensity)
1318)
1319POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZI, pcl::_PointXYZI)
1320
1321POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZL,
1322 (float, x, x)
1323 (float, y, y)
1324 (float, z, z)
1325 (std::uint32_t, label, label)
1326)
1327
1328POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::Label,
1329 (std::uint32_t, label, label)
1330)
1331
1332POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Normal,
1333 (float, normal_x, normal_x)
1334 (float, normal_y, normal_y)
1335 (float, normal_z, normal_z)
1336 (float, curvature, curvature)
1337)
1338POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Normal, pcl::_Normal)
1339
1340POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Axis,
1341 (float, normal_x, normal_x)
1342 (float, normal_y, normal_y)
1343 (float, normal_z, normal_z)
1344)
1345POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Axis, pcl::_Axis)
1346
1347POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointNormal,
1348 (float, x, x)
1349 (float, y, y)
1350 (float, z, z)
1351 (float, normal_x, normal_x)
1352 (float, normal_y, normal_y)
1353 (float, normal_z, normal_z)
1354 (float, curvature, curvature)
1355)
1356POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGBNormal,
1357 (float, x, x)
1358 (float, y, y)
1359 (float, z, z)
1360 (float, normal_x, normal_x)
1361 (float, normal_y, normal_y)
1362 (float, normal_z, normal_z)
1363 (float, rgb, rgb)
1364 (float, curvature, curvature)
1365)
1366POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBNormal, pcl::_PointXYZRGBNormal)
1367POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZINormal,
1368 (float, x, x)
1369 (float, y, y)
1370 (float, z, z)
1371 (float, normal_x, normal_x)
1372 (float, normal_y, normal_y)
1373 (float, normal_z, normal_z)
1374 (float, intensity, intensity)
1375 (float, curvature, curvature)
1376)
1377POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZLNormal,
1378 (float, x, x)
1379 (float, y, y)
1380 (float, z, z)
1381 (float, normal_x, normal_x)
1382 (float, normal_y, normal_y)
1383 (float, normal_z, normal_z)
1384 (std::uint32_t, label, label)
1385 (float, curvature, curvature)
1386)
1387POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointWithRange,
1388 (float, x, x)
1389 (float, y, y)
1390 (float, z, z)
1391 (float, range, range)
1392)
1393
1394POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointWithViewpoint,
1395 (float, x, x)
1396 (float, y, y)
1397 (float, z, z)
1398 (float, vp_x, vp_x)
1399 (float, vp_y, vp_y)
1400 (float, vp_z, vp_z)
1401)
1402POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointWithViewpoint, pcl::_PointWithViewpoint)
1403
1404POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::IntensityGradient,
1405 (float, gradient_x, gradient_x)
1406 (float, gradient_y, gradient_y)
1407 (float, gradient_z, gradient_z)
1408)
1409
1410POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointWithScale,
1411 (float, x, x)
1412 (float, y, y)
1413 (float, z, z)
1414 (float, scale, scale)
1415)
1416
1417POINT_CLOUD_REGISTER_POINT_STRUCT(pcl::PointSurfel,
1418 (float, x, x)
1419 (float, y, y)
1420 (float, z, z)
1421 (float, normal_x, normal_x)
1422 (float, normal_y, normal_y)
1423 (float, normal_z, normal_z)
1424 (std::uint32_t, rgba, rgba)
1425 (float, radius, radius)
1426 (float, confidence, confidence)
1427 (float, curvature, curvature)
1428)
1429
1430POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointDEM,
1431 (float, x, x)
1432 (float, y, y)
1433 (float, z, z)
1434 (float, intensity, intensity)
1435 (float, intensity_variance, intensity_variance)
1436 (float, height_variance, height_variance)
1437)
1438POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointDEM, pcl::_PointDEM)
1439
1440namespace pcl
1441{
1442
1443// Allow float 'rgb' data to match to the newer uint32 'rgba' tag. This is so
1444// you can load old 'rgb' PCD files into e.g. a PointCloud<PointXYZRGBA>.
1445template<typename PointT>
1446struct FieldMatches<PointT, ::pcl::fields::rgba>
1447{
1448 bool operator() (const pcl::PCLPointField& field)
1449 {
1450 if (field.name == "rgb")
1451 {
1452 // For fixing the alpha value bug #1141, the rgb field can also match
1453 // uint32.
1454 return ((field.datatype == pcl::PCLPointField::FLOAT32 ||
1456 field.count == 1);
1457 }
1458 else
1459 {
1460 return (field.name == traits::name<PointT, fields::rgba>::value &&
1461 field.datatype == traits::datatype<PointT, fields::rgba>::value &&
1462 field.count == traits::datatype<PointT, fields::rgba>::size);
1463 }
1464 }
1465};
1466template<typename PointT>
1467struct FieldMatches<PointT, fields::rgb>
1468{
1469 bool operator() (const pcl::PCLPointField& field)
1470 {
1471 if (field.name == "rgba")
1472 {
1473 return (field.datatype == pcl::PCLPointField::UINT32 &&
1474 field.count == 1);
1475 }
1476 else
1477 {
1478 // For fixing the alpha value bug #1141, rgb can also match uint32
1479 return (field.name == traits::name<PointT, fields::rgb>::value &&
1480 (field.datatype == traits::datatype<PointT, fields::rgb>::value ||
1482 field.count == traits::datatype<PointT, fields::rgb>::size);
1483 }
1484 }
1485};
1486
1487} // namespace pcl
Defines all the PCL implemented PointT point type structures.
Defines all the PCL implemented PointT feature type structures.
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Definition memory.h:86
std::bitset< 32 > BorderTraits
Data type to store extended information about a transition from foreground to backgroundSpecification...
Defines functions, macros and traits for allocating and using memory.
Eigen::Map< Eigen::Vector2f > Vector2fMap
Eigen::Map< Eigen::Vector4f, Eigen::Aligned > Vector4fMap
const Eigen::Map< const Vector4c, Eigen::Aligned > Vector4cMapConst
const Eigen::Map< const Eigen::Vector2f > Vector2fMapConst
Eigen::Map< Vector4c, Eigen::Aligned > Vector4cMap
std::ostream & operator<<(std::ostream &os, const BivariatePolynomialT< real > &p)
const Eigen::Map< const Eigen::Vector3f > Vector3fMapConst
const Eigen::Map< const Vector3c > Vector3cMapConst
Eigen::Map< Eigen::Vector3f > Vector3fMap
Eigen::Matrix< std::uint8_t, 4, 1 > Vector4c
const Eigen::Map< const Eigen::Vector4f, Eigen::Aligned > Vector4fMapConst
const Eigen::Map< const Eigen::Array4f, Eigen::Aligned > Array4fMapConst
Eigen::Matrix< std::uint8_t, 3, 1 > Vector3c
Eigen::Map< Eigen::Array4f, Eigen::Aligned > Array4fMap
const Eigen::Map< const Eigen::Array3f > Array3fMapConst
Eigen::Map< Vector3c > Vector3cMap
Eigen::Map< Eigen::Array3f > Array3fMap
Defines all the PCL and non-PCL macros used.
PCL_ADD_POINT4D float intensity
PCL_ADD_UNION_RGB float radius
float angle
Computed orientation of the keypoint (-1 if not applicable).
float response
The response by which the most strong keypoints have been selected.
int octave
octave (pyramid layer) from which the keypoint has been extracted.
float scale
Diameter of the meaningful keypoint neighborhood.
A point structure representing Euclidean xyz coordinates, and the intensity value.
PCL_ADD_POINT4D std::uint32_t label
PCL_ADD_POINT4D PCL_ADD_RGB std::uint32_t label
PCL_ADD_UNION_RGB float curvature
A point structure representing an Axis using its normal coordinates.
constexpr Axis(float n_x, float n_y, float n_z)
constexpr Axis()
constexpr Axis(const _Axis &p)
A structure to store if a point in a range image lies on a border between an obstacle and the backgro...
constexpr BorderDescription(int _x, int _y)
constexpr BorderDescription()=default
bool operator()(const PCLPointField &field)
A point structure representing the grayscale intensity in single-channel images.
constexpr Intensity32u(const _Intensity32u &p)
constexpr Intensity32u(std::uint32_t _intensity=0)
A point structure representing the grayscale intensity in single-channel images.
constexpr Intensity8u(std::uint8_t _intensity=0)
constexpr Intensity8u(const _Intensity8u &p)
A point structure representing the intensity gradient of an XYZI point cloud.
constexpr IntensityGradient(float _x, float _y, float _z)
A point structure representing the grayscale intensity in single-channel images.
constexpr Intensity(const _Intensity &p)
constexpr Intensity(float _intensity=0.f)
A point structure representing an interest point with Euclidean xyz coordinates, and an interest valu...
constexpr Label(std::uint32_t _label=0)
A point structure representing normal coordinates and the surface curvature estimate.
constexpr Normal(const _Normal &p)
constexpr Normal(float _curvature=0.f)
constexpr Normal(float n_x, float n_y, float n_z, float _curvature=0.f)
std::uint8_t datatype
A point structure representing Digital Elevation Map.
constexpr PointDEM(const _PointDEM &p)
constexpr PointDEM(float _x, float _y, float _z, float _intensity, float _intensity_variance, float _height_variance)
constexpr PointDEM(float _x, float _y, float _z)
constexpr PointDEM()
A point structure representing Euclidean xyz coordinates, together with normal coordinates and the su...
constexpr PointNormal(float _curvature=0.f)
constexpr PointNormal(float _x, float _y, float _z)
constexpr PointNormal(const _PointNormal &p)
constexpr PointNormal(float _x, float _y, float _z, float n_x, float n_y, float n_z, float _curvature=0.f)
A surfel, that is, a point structure representing Euclidean xyz coordinates, together with normal coo...
constexpr PointSurfel(const _PointSurfel &p)
constexpr PointSurfel()
constexpr PointSurfel(float _x, float _y, float _z, float _nx, float _ny, float _nz, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint8_t _a, float _radius, float _confidence, float _curvature)
A 2D point structure representing pixel image coordinates.
constexpr PointUV(float _u, float _v)
constexpr PointUV()=default
A point structure representing Euclidean xyz coordinates, padded with an extra range float.
constexpr PointWithRange(float _range=0.f)
constexpr PointWithRange(float _x, float _y, float _z, float _range=0.f)
constexpr PointWithRange(const _PointWithRange &p)
A point structure representing a 3-D position and scale.
constexpr PointWithScale()
constexpr PointWithScale(const _PointWithScale &p)
constexpr PointWithScale(float _x, float _y, float _z, float _scale=1.f, float _angle=-1.f, float _response=0.f, int _octave=0)
A point structure representing Euclidean xyz coordinates together with the viewpoint from which it wa...
constexpr PointWithViewpoint(float _x, float _y, float _z)
constexpr PointWithViewpoint(float _x, float _y, float _z, float _vp_x, float _vp_y, float _vp_z)
constexpr PointWithViewpoint(const _PointWithViewpoint &p)
A 2D point structure representing Euclidean xy coordinates.
constexpr PointXY()
pcl::Vector2fMap getVector2fMap()
constexpr PointXY(float _x, float _y)
pcl::Vector2fMapConst getVector2fMap() const
constexpr PointXYZHSV()
constexpr PointXYZHSV(const _PointXYZHSV &p)
constexpr PointXYZHSV(float _h, float _s, float _v)
constexpr PointXYZHSV(float _x, float _y, float _z, float _h, float _s, float _v)
A point structure representing Euclidean xyz coordinates.
constexpr PointXYZ(float _x, float _y, float _z)
constexpr PointXYZ(const _PointXYZ &p)
constexpr PointXYZ()
constexpr PointXYZI(float _x, float _y, float _z, float _intensity=0.f)
constexpr PointXYZI(float _intensity=0.f)
constexpr PointXYZI(const _PointXYZI &p)
A point structure representing Euclidean xyz coordinates, intensity, together with normal coordinates...
constexpr PointXYZINormal(float _intensity=0.f)
constexpr PointXYZINormal(const _PointXYZINormal &p)
constexpr PointXYZINormal(float _x, float _y, float _z, float _intensity, float n_x, float n_y, float n_z, float _curvature=0.f)
constexpr PointXYZINormal(float _x, float _y, float _z, float _intensity=0.f)
A point structure representing Euclidean xyz coordinates, and the CIELAB color.
constexpr PointXYZLAB()
constexpr PointXYZLAB(float _x, float _y, float _z, float _l, float _a, float _b)
constexpr PointXYZLAB(const _PointXYZLAB &p)
constexpr PointXYZL(std::uint32_t _label=0)
constexpr PointXYZL(const _PointXYZL &p)
constexpr PointXYZL(float _x, float _y, float _z, std::uint32_t _label=0)
A point structure representing Euclidean xyz coordinates, a label, together with normal coordinates a...
constexpr PointXYZLNormal(const _PointXYZLNormal &p)
constexpr PointXYZLNormal(float _x, float _y, float _z, std::uint32_t _label=0u)
constexpr PointXYZLNormal(std::uint32_t _label=0u)
constexpr PointXYZLNormal(float _x, float _y, float _z, std::uint32_t _label, float n_x, float n_y, float n_z, float _curvature=0.f)
A point structure representing Euclidean xyz coordinates, and the RGBA color.
constexpr PointXYZRGBA(const _PointXYZRGBA &p)
constexpr PointXYZRGBA()
constexpr PointXYZRGBA(float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint8_t _a)
constexpr PointXYZRGBA(float _x, float _y, float _z)
constexpr PointXYZRGBA(std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint8_t _a)
A point structure representing Euclidean xyz coordinates, and the RGB color.
constexpr PointXYZRGB(float _x, float _y, float _z)
constexpr PointXYZRGB()
constexpr PointXYZRGB(const _PointXYZRGB &p)
constexpr PointXYZRGB(float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b)
constexpr PointXYZRGB(std::uint8_t _r, std::uint8_t _g, std::uint8_t _b)
constexpr PointXYZRGBL(std::uint32_t _label=0)
constexpr PointXYZRGBL(float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint32_t _label=0, std::uint8_t _a=255)
constexpr PointXYZRGBL(float _x, float _y, float _z)
constexpr PointXYZRGBL(std::uint8_t _r, std::uint8_t _g, std::uint8_t _b)
constexpr PointXYZRGBL(const _PointXYZRGBL &p)
A point structure representing Euclidean xyz coordinates, and the RGB color, together with normal coo...
constexpr PointXYZRGBNormal(float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, float n_x, float n_y, float n_z, float _curvature=0.f)
constexpr PointXYZRGBNormal(float _x, float _y, float _z)
constexpr PointXYZRGBNormal(std::uint8_t _r, std::uint8_t _g, std::uint8_t _b)
constexpr PointXYZRGBNormal(float _curvature=0.f)
constexpr PointXYZRGBNormal(const _PointXYZRGBNormal &p)
constexpr PointXYZRGBNormal(float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint8_t _a, float n_x, float n_y, float n_z, float _curvature=0.f)
constexpr PointXYZRGBNormal(float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b)
A structure representing RGB color information.
constexpr RGB(std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint8_t _a=255)
constexpr RGB()
constexpr RGB(const _RGB &p)