|
Point Cloud Library (PCL)
1.5.1
|
A point structure representing Euclidean xyz coordinates, and the RGB color. More...
#include <pcl/impl/point_types.hpp>


Public Member Functions | |
| PointXYZRGB () | |
| PointXYZRGB (uint8_t _r, uint8_t _g, uint8_t _b) | |
| Eigen::Vector3i | getRGBVector3i () |
| const Eigen::Vector3i | getRGBVector3i () const |
| Eigen::Vector4i | getRGBVector4i () |
| const Eigen::Vector4i | getRGBVector4i () const |
Public Attributes | |
| PCL_ADD_POINT4D | |
| union { | |
| union { | |
| struct { | |
| uint8_t b | |
| uint8_t g | |
| uint8_t r | |
| uint8_t _unused | |
| } | |
| float rgb | |
| } | |
| uint32_t rgba | |
| }; | |
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 uint8_t r = 255, g = 0, b = 0; // Example: Red color uint32_t rgb = ((uint32_t)r << 16 | (uint32_t)g << 8 | (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 uint32_t rgb = *reinterpret_cast<int*>(&p.rgb); uint8_t r = (rgb >> 16) & 0x0000ff; uint8_t g = (rgb >> 8) & 0x0000ff; uint8_t b = (rgb) & 0x0000ff;
Alternatively, from 1.1.0 onwards, you can use p.r, p.g, and p.b directly.
Definition at line 425 of file point_types.hpp.
| pcl::PointXYZRGB::PointXYZRGB | ( | ) | [inline] |
Definition at line 427 of file point_types.hpp.
| pcl::PointXYZRGB::PointXYZRGB | ( | uint8_t | _r, |
| uint8_t | _g, | ||
| uint8_t | _b | ||
| ) | [inline] |
Definition at line 433 of file point_types.hpp.
| Eigen::Vector3i pcl::PointXYZRGB::getRGBVector3i | ( | ) | [inline] |
Definition at line 443 of file point_types.hpp.
| const Eigen::Vector3i pcl::PointXYZRGB::getRGBVector3i | ( | ) | const [inline] |
Definition at line 444 of file point_types.hpp.
| Eigen::Vector4i pcl::PointXYZRGB::getRGBVector4i | ( | ) | [inline] |
Definition at line 445 of file point_types.hpp.
| const Eigen::Vector4i pcl::PointXYZRGB::getRGBVector4i | ( | ) | const [inline] |
Definition at line 446 of file point_types.hpp.
union { ... } [inherited] |
uint8_t pcl::_PointXYZRGB::_unused [inherited] |
Definition at line 362 of file point_types.hpp.
uint8_t pcl::_PointXYZRGB::b [inherited] |
Definition at line 359 of file point_types.hpp.
uint8_t pcl::_PointXYZRGB::g [inherited] |
Definition at line 360 of file point_types.hpp.
pcl::_PointXYZRGB::PCL_ADD_POINT4D [inherited] |
Definition at line 352 of file point_types.hpp.
uint8_t pcl::_PointXYZRGB::r [inherited] |
Definition at line 361 of file point_types.hpp.
float pcl::_PointXYZRGB::rgb [inherited] |
Definition at line 364 of file point_types.hpp.
uint32_t pcl::_PointXYZRGB::rgba [inherited] |
Definition at line 366 of file point_types.hpp.
1.8.0