@@ -342,7 +342,7 @@ namespace pcl
342
342
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const RGB& p);
343
343
/* * \brief A structure representing RGB color information.
344
344
*
345
- * The RGBA information is available either as separate r, g, b, or as a
345
+ * The RGB information is available either as separate r, g, b or as a
346
346
* packed std::uint32_t rgba value. To pack it, use:
347
347
*
348
348
* \code
@@ -355,7 +355,7 @@ namespace pcl
355
355
* int rgb = ...;
356
356
* std::uint8_t r = (rgb >> 16) & 0x0000ff;
357
357
* std::uint8_t g = (rgb >> 8) & 0x0000ff;
358
- * std::uint8_t b = (rgb) & 0x0000ff;
358
+ * std::uint8_t b = (rgb) & 0x0000ff;
359
359
* \endcode
360
360
*
361
361
*/
@@ -506,20 +506,22 @@ namespace pcl
506
506
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGBA& p);
507
507
/* * \brief A point structure representing Euclidean xyz coordinates, and the RGBA color.
508
508
*
509
- * The RGBA information is available either as separate r, g, b, or as a
510
- * packed std::uint32_t rgba value. To pack it, use:
509
+ * The RGBA information is available either as separate r, g, b and a uint8_t values,
510
+ * or as a packed std::uint32_t rgba value. To pack it, use:
511
511
*
512
512
* \code
513
- * int rgb = ((int)r) << 16 | ((int)g) << 8 | ((int)b) ;
513
+ * std::uint32_t rgba = (a << 24 | (r << 16 | (g << 8) | b ;
514
514
* \endcode
515
515
*
516
516
* To unpack it use:
517
517
*
518
518
* \code
519
- * int rgb = ...;
519
+ * // unpack rgb into r/g/b
520
+ * std::uint32_t rgb = p.rgba;
521
+ * std::uint8_t a = (rgb >> 24) & 0x0000ff;
520
522
* std::uint8_t r = (rgb >> 16) & 0x0000ff;
521
523
* std::uint8_t g = (rgb >> 8) & 0x0000ff;
522
- * std::uint8_t b = (rgb) & 0x0000ff;
524
+ * std::uint8_t b = (rgb) & 0x0000ff;
523
525
* \endcode
524
526
*
525
527
* \ingroup common
0 commit comments