A point structure representing Euclidean xyz coordinates, and the RGB color, together with normal coordinates and the surface curvature estimate. 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: More...
#include <point_types.hpp>
Public Attributes | |
union { | |
struct { | |
union { | |
struct { | |
uint8_t a | |
uint8_t b | |
uint8_t g | |
uint8_t r | |
} | |
float rgb | |
uint32_t rgba | |
} | |
float curvature | |
} | |
float data_c [4] | |
}; | |
PCL_ADD_NORMAL4D | |
PCL_ADD_POINT4D |
A point structure representing Euclidean xyz coordinates, and the RGB color, together with normal coordinates and the surface curvature estimate. 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 694 of file point_types.hpp.
union { ... } |
uint8_t pcl::_PointXYZRGBNormal::a |
Definition at line 710 of file point_types.hpp.
uint8_t pcl::_PointXYZRGBNormal::b |
Definition at line 707 of file point_types.hpp.
Definition at line 715 of file point_types.hpp.
float pcl::_PointXYZRGBNormal::data_c[4] |
Definition at line 717 of file point_types.hpp.
uint8_t pcl::_PointXYZRGBNormal::g |
Definition at line 708 of file point_types.hpp.
Definition at line 697 of file point_types.hpp.
Definition at line 696 of file point_types.hpp.
uint8_t pcl::_PointXYZRGBNormal::r |
Definition at line 709 of file point_types.hpp.
Definition at line 712 of file point_types.hpp.
uint32_t pcl::_PointXYZRGBNormal::rgba |
Definition at line 713 of file point_types.hpp.