<?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 Hi Ravish, in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Mapping-RGB-points-to-Depth-using-PXCProjection/m-p/1039030#M45256</link>
    <description>&lt;P&gt;Hi Ravish,&lt;/P&gt;

&lt;P&gt;I've been trying to get this working myself but haven't had much luck. Where have you defined depthImage?&lt;/P&gt;

&lt;P&gt;Side point, and not much use if you can't get the projection working, but I noticed though on line 7 of your first block of code, I think &lt;SPAN style="color: rgb(0, 0, 0); font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13.008px; line-height: 14.3088px;"&gt;[...].x * cInfo.height;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;should be&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13.008px; line-height: 14.3088px;"&gt;[...].&lt;STRONG&gt;y&lt;/STRONG&gt; * cInfo.height;&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;Also, I've used&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: Consolas; font-size: 1em; line-height: 1.5;"&gt;projection.MapColorToDepth &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;(and vice-versa)&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;quite a lot and found them useful for mapping a small number of points at a time, but if you want to map a large section of the image it takes a long time to process (&amp;gt;1 minute for 640*480 image).&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="line-height: 19.512px;"&gt;My problem is with the InvUVMap in C#. Every point in the map comes out as either (-1,-1) or (0,0), so when I loop through and multiply the coordinates by depth.width or depth.height I end up with an array of points which are either (-640,-480) or (0,0).&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE class="brush:csharp;"&gt;private PXCMPoint3DF32[] MapAllColourPointsToDepthByUV()
        {
            PXCMPoint3DF32[] dp = new PXCMPoint3DF32[cwidth * cheight];

            PXCMPointF32[] invUVMap = new PXCMPointF32[cwidth * cheight];
            pxcmStatus st = projection.QueryInvUVMap(depth, invUVMap);
            for (int y = 0, k = 0; y &amp;lt; cheight; y++)
            {
                for (int x = 0; x &amp;lt; cwidth; x++, k++)
                {
                    dp&lt;K&gt; = UVtoDepthPoint(invUVMap[y*cwidth + x]);
                }
            }
            return dp;
        }
        private PXCMPoint3DF32 UVtoDepthPoint(PXCMPointF32 uv)
        {
            try
            {
                int u = (int)uv.x * dwidth;
                int v = (int)uv.y * dheight;
                int z;
                if (u &amp;gt; 0 &amp;amp;&amp;amp; v &amp;gt; 0)
                    z = dpixels[(int)(v * dwidth + u)];
                else 
                    z = -1;
                return new PXCMPoint3DF32(u,v,z);
            }
            catch(Exception e)
            {
                logger.Error(e.ToString());
            }
            return new PXCMPoint3DF32();
        }
&lt;/K&gt;&lt;/PRE&gt;

&lt;P&gt;I should note that parallel to this I'm using QueryVertices and MapColorToDepth which are working as expected so I don't think there's anything wrong with the projection unless you have to do something special to use the UVMap.&lt;/P&gt;

&lt;P&gt;Has anyone gotten this working with C#? Then only SDK example I can find is C++.&lt;/P&gt;</description>
    <pubDate>Wed, 25 Nov 2015 11:38:02 GMT</pubDate>
    <dc:creator>jb455</dc:creator>
    <dc:date>2015-11-25T11:38:02Z</dc:date>
    <item>
      <title>Mapping RGB points to Depth using PXCProjection</title>
      <link>https://community.intel.com/t5/Software-Archive/Mapping-RGB-points-to-Depth-using-PXCProjection/m-p/1039028#M45254</link>
      <description>&lt;P&gt;I am trying to map color points to depth points, and vice versa. To do this, I create instance of PXCProjection from device, and multiply each point with the transformation value in uvmap.&lt;/P&gt;

&lt;P&gt;My code is&amp;nbsp;based on the sample on the API docs. When I run this, I get a null value for the PXCProjection variable, which should be a valid interface because the session has been initialized, and both the depth and color streams are enabled.&lt;/P&gt;

&lt;P&gt;Here, I am calling the method translateDepthToColor by passing in defined projection, and ImageInfo arguments. points is a vector of struct Point, which has integer values x and y.&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;void translateDepthToColor(PXCProjection *projection, PXCImage::ImageInfo dInfo, PXCImage::ImageInfo cInfo) {
&amp;nbsp;PXCPointF32 *uvmap = new PXCPointF32[dInfo.width*dInfo.height];
&amp;nbsp;projection-&amp;gt;QueryUVMap(depthImage, uvmap);

&amp;nbsp;for (int i = 0; i &amp;lt; points.size(); i++) {
&amp;nbsp;&amp;nbsp;points&lt;I&gt;.x = uvmap[(int)points&lt;I&gt;.y * dInfo.width + (int)points&lt;I&gt;.x].x * cInfo.width;
&amp;nbsp;&amp;nbsp;points&lt;I&gt;.y = uvmap[(int)points&lt;I&gt;.y * dInfo.width + (int)points&lt;I&gt;.x].x * cInfo.height;
&amp;nbsp;}

&amp;nbsp;delete[] uvmap;
&amp;nbsp;return;
}

void translatePoints(Feed type)
&amp;nbsp;PXCProjection *projection = device-&amp;gt;CreateProjection();
&amp;nbsp;

&amp;nbsp;PXCImage::ImageInfo dInfo = depthImage-&amp;gt;QueryInfo();
&amp;nbsp;PXCImage::ImageInfo cInfo = colorImage-&amp;gt;QueryInfo();

&amp;nbsp;if (type == COLOR1) {
&amp;nbsp;&amp;nbsp;translateDepthToColor(projection, dInfo, cInfo);
&amp;nbsp;}
&amp;nbsp;else if (type == DEPTH1) {
&amp;nbsp;&amp;nbsp;translateColorToDepth(projection, dInfo, cInfo);
&amp;nbsp;}
}
&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;

&lt;P&gt;I see two possible approaches, one using uvmap, and the other my calling the corresponding mapColorToDepth and mapDepthToColor methods. I haven't tried the latter methods, so am unsure if they are a better fit for my program. I do not see why projection would return a null value, other than if session was not initialized, which it is&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;&amp;nbsp;//in main
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; session = PXCSenseManager::CreateInstance();
&amp;nbsp;session-&amp;gt;Init();
&amp;nbsp;device = session-&amp;gt;QueryCaptureManager()-&amp;gt;QueryDevice();
&amp;nbsp;std::cout &amp;lt;&amp;lt; "device initiated " &amp;lt;&amp;lt; device-&amp;gt;CUID &amp;lt;&amp;lt; std::endl;
&amp;nbsp;PXCVideoModule::DataDesc streams = {};
&amp;nbsp;if (session-&amp;gt;QueryCaptureManager()-&amp;gt;QueryCapture()) {
&amp;nbsp;&amp;nbsp;session-&amp;gt;QueryCaptureManager()-&amp;gt;QueryCapture()-&amp;gt;QueryDeviceInfo(0, &amp;amp;streams.deviceInfo);
&amp;nbsp;}
&amp;nbsp;else {
&amp;nbsp;&amp;nbsp;streams.deviceInfo.streams = PXCCapture::STREAM_TYPE_COLOR | PXCCapture::STREAM_TYPE_DEPTH;
&amp;nbsp;}

&amp;nbsp;session-&amp;gt;EnableStreams(&amp;amp;streams);
&lt;/PRE&gt;

&lt;P&gt;Both depth and color streams are rendered properly, which means that session was able to query both streams. Is there another part of the camera initialization process I am missing here, or an error I am making in querying the uvmap?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2015 02:30:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Mapping-RGB-points-to-Depth-using-PXCProjection/m-p/1039028#M45254</guid>
      <dc:creator>Ravish_C_</dc:creator>
      <dc:date>2015-10-29T02:30:56Z</dc:date>
    </item>
    <item>
      <title>Please provided more detail</title>
      <link>https://community.intel.com/t5/Software-Archive/Mapping-RGB-points-to-Depth-using-PXCProjection/m-p/1039029#M45255</link>
      <description>&lt;P&gt;Please provided more detail code so I can help you. Where did you define the device and where did you call&amp;nbsp;translatePoints? You can find our sample codes how to use projection and uvmap C:\Program Files (x86)\Intel\RSSDK\sample\DF_RawStreams. Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2015 15:21:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Mapping-RGB-points-to-Depth-using-PXCProjection/m-p/1039029#M45255</guid>
      <dc:creator>Xusheng_L_Intel</dc:creator>
      <dc:date>2015-10-29T15:21:49Z</dc:date>
    </item>
    <item>
      <title>Hi Ravish,</title>
      <link>https://community.intel.com/t5/Software-Archive/Mapping-RGB-points-to-Depth-using-PXCProjection/m-p/1039030#M45256</link>
      <description>&lt;P&gt;Hi Ravish,&lt;/P&gt;

&lt;P&gt;I've been trying to get this working myself but haven't had much luck. Where have you defined depthImage?&lt;/P&gt;

&lt;P&gt;Side point, and not much use if you can't get the projection working, but I noticed though on line 7 of your first block of code, I think &lt;SPAN style="color: rgb(0, 0, 0); font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13.008px; line-height: 14.3088px;"&gt;[...].x * cInfo.height;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;should be&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 13.008px; line-height: 14.3088px;"&gt;[...].&lt;STRONG&gt;y&lt;/STRONG&gt; * cInfo.height;&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;Also, I've used&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: black; font-family: Consolas; font-size: 1em; line-height: 1.5;"&gt;projection.MapColorToDepth &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;(and vice-versa)&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;quite a lot and found them useful for mapping a small number of points at a time, but if you want to map a large section of the image it takes a long time to process (&amp;gt;1 minute for 640*480 image).&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="line-height: 19.512px;"&gt;My problem is with the InvUVMap in C#. Every point in the map comes out as either (-1,-1) or (0,0), so when I loop through and multiply the coordinates by depth.width or depth.height I end up with an array of points which are either (-640,-480) or (0,0).&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE class="brush:csharp;"&gt;private PXCMPoint3DF32[] MapAllColourPointsToDepthByUV()
        {
            PXCMPoint3DF32[] dp = new PXCMPoint3DF32[cwidth * cheight];

            PXCMPointF32[] invUVMap = new PXCMPointF32[cwidth * cheight];
            pxcmStatus st = projection.QueryInvUVMap(depth, invUVMap);
            for (int y = 0, k = 0; y &amp;lt; cheight; y++)
            {
                for (int x = 0; x &amp;lt; cwidth; x++, k++)
                {
                    dp&lt;K&gt; = UVtoDepthPoint(invUVMap[y*cwidth + x]);
                }
            }
            return dp;
        }
        private PXCMPoint3DF32 UVtoDepthPoint(PXCMPointF32 uv)
        {
            try
            {
                int u = (int)uv.x * dwidth;
                int v = (int)uv.y * dheight;
                int z;
                if (u &amp;gt; 0 &amp;amp;&amp;amp; v &amp;gt; 0)
                    z = dpixels[(int)(v * dwidth + u)];
                else 
                    z = -1;
                return new PXCMPoint3DF32(u,v,z);
            }
            catch(Exception e)
            {
                logger.Error(e.ToString());
            }
            return new PXCMPoint3DF32();
        }
&lt;/K&gt;&lt;/PRE&gt;

&lt;P&gt;I should note that parallel to this I'm using QueryVertices and MapColorToDepth which are working as expected so I don't think there's anything wrong with the projection unless you have to do something special to use the UVMap.&lt;/P&gt;

&lt;P&gt;Has anyone gotten this working with C#? Then only SDK example I can find is C++.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2015 11:38:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Mapping-RGB-points-to-Depth-using-PXCProjection/m-p/1039030#M45256</guid>
      <dc:creator>jb455</dc:creator>
      <dc:date>2015-11-25T11:38:02Z</dc:date>
    </item>
  </channel>
</rss>

