Loading...
Searching...
No Matches
pcl::PointXYZRGB Struct Reference
Module common

A point structure representing Euclidean xyz coordinates, and the RGB color. More...

`#include <pcl/impl/point_types.hpp>`

Inheritance diagram for pcl::PointXYZRGB:

## Public Member Functions

constexpr | PointXYZRGB (const _PointXYZRGB &p)
constexpr | PointXYZRGB ()
constexpr | PointXYZRGB (std::uint8_t _r, std::uint8_t _g, std::uint8_t _b)
constexpr | PointXYZRGB (float _x, float _y, float _z)
constexpr | PointXYZRGB (float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b)

## Friends

std::ostream & | operator<< (std::ostream &os, const PointXYZRGB &p)

## Detailed Description

A point structure representing Euclidean xyz coordinates, and the RGB color.

Due to historical reasons (PCL was first developed as a ROS package), the RGB information is packed into an integer and casted to a float. This is something we wish to remove in the near future, but in the meantime, the following code snippet should help you pack and unpack RGB colors in your PointXYZRGB structure:

// pack r/g/b into rgb
std::uint8_t r = 255, g = 0, b = 0; // Example: Red color
std::uint32_t rgb = ((std::uint32_t)r << 16 | (std::uint32_t)g << 8 | (std::uint32_t)b);
p.rgb = *reinterpret_cast<float*>(&rgb);

To unpack the data into separate values, use:

PointXYZRGB p;
// unpack rgb into r/g/b
std::uint32_t rgb = *reinterpret_cast<int*>(&p.rgb);
std::uint8_t r = (rgb >> 16) & 0x0000ff;
std::uint8_t g = (rgb >> 8) & 0x0000ff;
std::uint8_t b = (rgb) & 0x0000ff;
pcl::PointXYZRGB
A point structure representing Euclidean xyz coordinates, and the RGB color.
Definition point_types.hpp:623

Alternatively, from 1.1.0 onwards, you can use p.r, p.g, and p.b directly.

Definition at line 622 of file point_types.hpp.

## Constructor & Destructor Documentation

## PointXYZRGB() [1/5]

constexpr pcl::PointXYZRGB::PointXYZRGB | ( | const _PointXYZRGB & | p | ) |

inline constexpr

Definition at line 624 of file point_types.hpp.

## PointXYZRGB() [2/5]

constexpr pcl::PointXYZRGB::PointXYZRGB | ( |  | ) |

inline constexpr

Definition at line 626 of file point_types.hpp.

## PointXYZRGB() [3/5]

constexpr pcl::PointXYZRGB::PointXYZRGB | ( | std::uint8_t | _r,
|  | std::uint8_t | _g,
|  | std::uint8_t | _b
| ) |  |

inline constexpr

Definition at line 628 of file point_types.hpp.

## PointXYZRGB() [4/5]

constexpr pcl::PointXYZRGB::PointXYZRGB | ( | float | _x,
|  | float | _y,
|  | float | _z
| ) |  |

inline constexpr

Definition at line 631 of file point_types.hpp.

## PointXYZRGB() [5/5]

constexpr pcl::PointXYZRGB::PointXYZRGB | ( | float | _x,
|  | float | _y,
|  | float | _z,
|  | std::uint8_t | _r,
|  | std::uint8_t | _g,
|  | std::uint8_t | _b
| ) |  |

inline constexpr

Definition at line 634 of file point_types.hpp.

## Friends And Related Symbol Documentation

## operator<<

std::ostream & operator<< | ( | std::ostream & | os,
|  | const PointXYZRGB & | p
| ) |  |

friend

The documentation for this struct was generated from the following file:

- pcl/impl/point_types.hpp