@@ -342,20 +342,20 @@ 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
346
- * packed std::uint32_t rgba value. To pack it, use:
345
+ * The RGB information is available either as separate r, g, b or as a
346
+ * packed std::uint32_t rgb value. To pack it, use:
347
347
*
348
348
* \code
349
- * int rgb = ((int)r) << 16 | ((int)g) << 8 | ((int)b);
349
+ * std::uint32_t rgb = ((int)r) << 16 | ((int)g) << 8 | ((int)b);
350
350
* \endcode
351
351
*
352
352
* To unpack it use:
353
353
*
354
354
* \code
355
- * int rgb = ... ;
355
+ * std::uint32_t rgb = p.rgba ;
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 = ((std::uint32_t)a << 24 | ((std::uint32_t)r << 16 | ((std::uint32_t)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
@@ -579,7 +581,7 @@ namespace pcl
579
581
* \code
580
582
* PointXYZRGB p;
581
583
* // unpack rgb into r/g/b
582
- * std::uint32_t rgb = *reinterpret_cast<int*>(& p.rgb) ;
584
+ * std::uint32_t rgb = p.rgb;
583
585
* std::uint8_t r = (rgb >> 16) & 0x0000ff;
584
586
* std::uint8_t g = (rgb >> 8) & 0x0000ff;
585
587
* std::uint8_t b = (rgb) & 0x0000ff;
@@ -899,7 +901,7 @@ namespace pcl
899
901
* \code
900
902
* PointXYZRGB p;
901
903
* // unpack rgb into r/g/b
902
- * std::uint32_t rgb = *reinterpret_cast<int*>(&p.rgb) ;
904
+ * std::uint32_t rgb = p.rgba ;
903
905
* std::uint8_t r = (rgb >> 16) & 0x0000ff;
904
906
* std::uint8_t g = (rgb >> 8) & 0x0000ff;
905
907
* std::uint8_t b = (rgb) & 0x0000ff;
0 commit comments