<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to iterate over pointcloud for color data in Items with no label</title>
    <link>https://community.intel.com/t5/Items-with-no-label/How-to-iterate-over-pointcloud-for-color-data/m-p/598350#M11883</link>
    <description>&lt;P&gt;The RealSense GitHub has a couple of discussions about getting RGB values from a colorized point cloud.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/IntelRealSense/librealsense/issues/1601"&gt;https://github.com/IntelRealSense/librealsense/issues/1601&lt;/A&gt; Obtaining RGB values fora colorised PCL point cloud. · Issue # 1601 · IntelRealSense/librealsense · GitHub &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/IntelRealSense/librealsense/issues/1429"&gt;https://github.com/IntelRealSense/librealsense/issues/1429&lt;/A&gt; Can't get color of point · Issue # 1429 · IntelRealSense/librealsense · GitHub &lt;/P&gt;</description>
    <pubDate>Sun, 14 Oct 2018 07:08:57 GMT</pubDate>
    <dc:creator>MartyG</dc:creator>
    <dc:date>2018-10-14T07:08:57Z</dc:date>
    <item>
      <title>How to iterate over pointcloud for color data</title>
      <link>https://community.intel.com/t5/Items-with-no-label/How-to-iterate-over-pointcloud-for-color-data/m-p/598347#M11880</link>
      <description>&lt;P&gt;I am attempting to access the color values of pixels from the RGB sensor with the goal of storing a few frames as "snapshots" in a bitmap format. Because there is no native .getColor() method available in the SDK like there is for depth, my reading has lead me to create a PCL pointcloud from aligned frames from which to extract RGB values point by point. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do not understand how to iterate over the pointcloud so that a bitmap in (x,y) could be "colored in" with matching values from cloud-&amp;gt;points[i] . How should I approach this next step?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, if there is an easier way to access pixel (x,y) from the RGB sensor, please let me know!&lt;/P&gt;</description>
      <pubDate>Sat, 13 Oct 2018 22:11:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Items-with-no-label/How-to-iterate-over-pointcloud-for-color-data/m-p/598347#M11880</guid>
      <dc:creator>Andrew_Carluccio</dc:creator>
      <dc:date>2018-10-13T22:11:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to iterate over pointcloud for color data</title>
      <link>https://community.intel.com/t5/Items-with-no-label/How-to-iterate-over-pointcloud-for-color-data/m-p/598348#M11881</link>
      <description>&lt;P&gt;It is probably a good idea to show exactly how I am creating the pointcloud:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pcl::PointCloud *points_to_pcl(const rs2::points&amp;amp; points, const rs2::video_frame&amp;amp; color){&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pcl::PointCloud *cloud(new pcl::PointCloud);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;auto sp = points.get_profile().as();&lt;/P&gt;&lt;P&gt;cloud-&amp;gt;width = sp.width();&lt;/P&gt;&lt;P&gt;cloud-&amp;gt;height = sp.height();&lt;/P&gt;&lt;P&gt;cloud-&amp;gt;is_dense = false;&lt;/P&gt;&lt;P&gt;cloud-&amp;gt;points.resize(points.size());&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;auto tex_coords = points.get_texture_coordinates();&lt;/P&gt;&lt;P&gt;auto vertices = points.get_vertices();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for (int i = 0; i &amp;lt; points.size(); ++i)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;cloud-&amp;gt;points[i].x = vertices[i].x;&lt;/P&gt;&lt;P&gt;cloud-&amp;gt;points[i].y = vertices[i].y;&lt;/P&gt;&lt;P&gt;cloud-&amp;gt;points[i].z = vertices[i].z;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;std::tuple current_color;&lt;/P&gt;&lt;P&gt;current_color = get_texcolor(color, tex_coords[i]);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cloud-&amp;gt;points[i].r = std::get&amp;lt;0&amp;gt;(current_color);&lt;/P&gt;&lt;P&gt;cloud-&amp;gt;points[i].g = std::get&amp;lt;1&amp;gt;(current_color);&lt;/P&gt;&lt;P&gt;cloud-&amp;gt;points[i].b = std::get&amp;lt;2&amp;gt;(current_color);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;return cloud;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is adapted from Yonatan-Sade's solution...&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/IntelRealSense/librealsense/issues/1601#"&gt;https://github.com/IntelRealSense/librealsense/issues/1601#&lt;/A&gt; issuecomment-387512731 &lt;A href="https://github.com/IntelRealSense/librealsense/issues/1601#"&gt;https://github.com/IntelRealSense/librealsense/issues/1601#&lt;/A&gt; issuecomment-387512731&lt;/P&gt;</description>
      <pubDate>Sat, 13 Oct 2018 22:15:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Items-with-no-label/How-to-iterate-over-pointcloud-for-color-data/m-p/598348#M11881</guid>
      <dc:creator>Andrew_Carluccio</dc:creator>
      <dc:date>2018-10-13T22:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to iterate over pointcloud for color data</title>
      <link>https://community.intel.com/t5/Items-with-no-label/How-to-iterate-over-pointcloud-for-color-data/m-p/598349#M11882</link>
      <description>&lt;P&gt;So I realized in looking at that code more closely that I could skip the PCL entirely, so I am now running this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//for reference, myFrame is an EasyBMP bitmap&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void rsFrameManager::makeBitmap(const rs2::points&amp;amp; points, const rs2::video_frame&amp;amp; color){&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;auto sp = points.get_profile().as();&lt;/P&gt;&lt;P&gt;auto tex_coords = points.get_texture_coordinates();&lt;/P&gt;&lt;P&gt;auto vertices = points.get_vertices();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for (int i = 0; i &amp;lt; points.size(); ++i)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;std::tuple current_color;&lt;/P&gt;&lt;P&gt;current_color = get_texcolor(color, tex_coords[i]);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int w = (tex_coords[i].u)*width;&lt;/P&gt;&lt;P&gt;int h = (tex_coords[i].v)*height;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;myFrame(w, h)-&amp;gt;Red = std::get&amp;lt;0&amp;gt;(current_color);&lt;/P&gt;&lt;P&gt;myFrame(w, h)-&amp;gt;Green = std::get&amp;lt;1&amp;gt;(current_color);&lt;/P&gt;&lt;P&gt;myFrame(w, h)-&amp;gt;Blue = std::get&amp;lt;2&amp;gt;(current_color);&lt;/P&gt;&lt;P&gt;myFrame(w, h)-&amp;gt;Alpha = 0;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, when I print the resulting bitmap, it is just a white frame, so this still does not work, but I suspect this is a step towards my solution.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Oct 2018 22:58:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Items-with-no-label/How-to-iterate-over-pointcloud-for-color-data/m-p/598349#M11882</guid>
      <dc:creator>Andrew_Carluccio</dc:creator>
      <dc:date>2018-10-13T22:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to iterate over pointcloud for color data</title>
      <link>https://community.intel.com/t5/Items-with-no-label/How-to-iterate-over-pointcloud-for-color-data/m-p/598350#M11883</link>
      <description>&lt;P&gt;The RealSense GitHub has a couple of discussions about getting RGB values from a colorized point cloud.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/IntelRealSense/librealsense/issues/1601"&gt;https://github.com/IntelRealSense/librealsense/issues/1601&lt;/A&gt; Obtaining RGB values fora colorised PCL point cloud. · Issue # 1601 · IntelRealSense/librealsense · GitHub &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/IntelRealSense/librealsense/issues/1429"&gt;https://github.com/IntelRealSense/librealsense/issues/1429&lt;/A&gt; Can't get color of point · Issue # 1429 · IntelRealSense/librealsense · GitHub &lt;/P&gt;</description>
      <pubDate>Sun, 14 Oct 2018 07:08:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Items-with-no-label/How-to-iterate-over-pointcloud-for-color-data/m-p/598350#M11883</guid>
      <dc:creator>MartyG</dc:creator>
      <dc:date>2018-10-14T07:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to iterate over pointcloud for color data</title>
      <link>https://community.intel.com/t5/Items-with-no-label/How-to-iterate-over-pointcloud-for-color-data/m-p/598351#M11884</link>
      <description>&lt;P&gt;Thank you for the reply!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was familiar with the first link you mentioned but not the second. I think I understand the solution used in the second link but am confused as to what color_intrinsic , used to calculate colorLocation, is and how I should calculate it on my end. How does color_intrinsic work?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have defined color_intrinsic as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rs2_intrinsics color_intrinsic = colorFrame.get_profile().as().get_intrinsics();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which I believe is proper. Now I am just trying to figure out how to map the verticies to pixels in a BMP and set the colors accordingly. Suggestions?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2018 05:08:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Items-with-no-label/How-to-iterate-over-pointcloud-for-color-data/m-p/598351#M11884</guid>
      <dc:creator>Andrew_Carluccio</dc:creator>
      <dc:date>2018-10-15T05:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to iterate over pointcloud for color data</title>
      <link>https://community.intel.com/t5/Items-with-no-label/How-to-iterate-over-pointcloud-for-color-data/m-p/598352#M11885</link>
      <description>&lt;P&gt;If you are mapping 3D XYZ vertices to 2D pixels, I believe that the appropriate instruction is &lt;B&gt;rs2_&lt;/B&gt;&lt;B&gt;project_point_to_pixel&lt;/B&gt;.  There is a detailed discussion about it in the link below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 15 Oct 2018 06:24:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Items-with-no-label/How-to-iterate-over-pointcloud-for-color-data/m-p/598352#M11885</guid>
      <dc:creator>MartyG</dc:creator>
      <dc:date>2018-10-15T06:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to iterate over pointcloud for color data</title>
      <link>https://community.intel.com/t5/Items-with-no-label/How-to-iterate-over-pointcloud-for-color-data/m-p/598353#M11886</link>
      <description>&lt;P&gt;Interesting. I was in a time crunch so I used writing to a .png and then converting to .bmp as a bandaid solution to get me up and running for my deadline, but obviously I want to replace that mechanism for performance reasons soon. I will take a look at &lt;B&gt;rs2_&lt;/B&gt;&lt;B&gt;project_point_to_pixel &lt;/B&gt;this weekend with hopes that it can resolve my current issue on the pointcloud side, where the resulting bitmap only consists of white pixels. I will update once I've gotten to play with this instruction. &lt;/P&gt;</description>
      <pubDate>Tue, 16 Oct 2018 04:27:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Items-with-no-label/How-to-iterate-over-pointcloud-for-color-data/m-p/598353#M11886</guid>
      <dc:creator>Andrew_Carluccio</dc:creator>
      <dc:date>2018-10-16T04:27:07Z</dc:date>
    </item>
  </channel>
</rss>

