title: Point Cloud Library - How to assign a single RGB value to an entire point cloud?
body: <p>I would like to assign a single RGB value to all of the points in a point cloud dataset of type:</p>
  
  <pre><code>pcl::PointCloud&lt;pcl::PointXYZRGB&gt;
  </code></pre>
  
  <p>I'm guessing you could iterate through the points and change each value? Using something like this:</p>
  
  <pre><code>uint32_t rgb = (static_cast&lt;uint32_t&gt;(r) &lt;&lt; 16 |
    static_cast&lt;uint32_t&gt;(g) &lt;&lt; 8 | static_cast&lt;uint32_t&gt;(b));
  point.rgb = *reinterpret_cast&lt;float*&gt;(&amp;rgb);
  </code></pre>
  
  <p>However, considering I would like to give all points the same value is there a better approach?</p>
  
  <p>The RGB value needs to be associated with each point or at least the collection of points so more than one point cloud can be combined in one output; each with their own distinct colour.</p>
  
  <p>As there are multiple point clouds I am unable to set the colour  through <a href="http://pointclouds.org/documentation/tutorials/pcl_visualizer.php" rel="nofollow noreferrer">PCLVisualizer</a> using:</p>
  
  <pre><code>pcl::visualization::PointCloudColorHandlerCustom&lt;pcl::PointXYZ&gt; 
  </code></pre>
  
  <p>One idea I had was to just make a high level association with the point cloud:</p>
  
  <pre><code>std::tie(rgb, pointcloud) = std::make_tuple(
                                  uint32_t, pcl::PointCloud&lt;pcl::PointXYZ&gt;);
  </code></pre>
  
  <p>Then maybe I could use <code>PointCloudColorHandlerCustom</code> multiple times to display the different coloured point clouds on the same PCLVisualizer instance? Not sure if this is possible.</p>
  
  <p><strong>Any help is much appreciated!</strong></p>