<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[depth to color mapping]]></title><description><![CDATA[<p dir="auto">Hi Guys,</p>
<p dir="auto">I am developing an application what display depth datas from depth camera( 3D camera)..<br />
This camera put depth datas for each pixels of 320x240 image into the "unsigned short  *m_pCameraBuf[2]".</p>
<p dir="auto">if I draw this raw data without color mapping, I can see some pictures but I want to convert depth data to fantastic color data with a mapping table.</p>
<p dir="auto">this is my code to print raw depth data but it is just experimental.. please advice me what's the best code to draw depth data with QT5.</p>
<pre><code>QImage image( (uchar*) m_pCameraBuf[DATA_DEPTH], imageWidth, imageHeight, imageWidth * bytesPerPixel, QImage::Format_RGB16, Q_NULLPTR, Q_NULLPTR);
</code></pre>
<p dir="auto">Thanks a lot..</p>
]]></description><link>https://forum.qt.io/topic/68555/depth-to-color-mapping</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Apr 2026 01:37:20 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/68555.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 22 Jun 2016 07:56:46 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to depth to color mapping on Wed, 22 Jun 2016 11:41:17 GMT]]></title><description><![CDATA[<p dir="auto">Why don't you first try in some way what told you want to do. You only seem to have a possibly working call to construct a QImage. It will build a 16 bit color image, which seems funny - why not go to the 32 bit formats, which have 8 bits per color for eac channel (R,G, B). You should probably first create just the image without your data and fill it in the next step.</p>
<p dir="auto">Of course you need the mapping table or mapping function. That is the core of things - how to represent depth with an RGB pixel. Once you figure that out (and that is not a Qt issue), you can just loop through your image (for x = 0; x &lt; 320; x++ and so on) and create each pixel:<br />
QRgb myPixel = conversionFunctionToGetColorOfDepth(myDepth[x, y]);<br />
myImage.setPixel(QPoint(x, y), myPixel());</p>
<p dir="auto">SetPixel is slow, but you need to start with that to understand what you are doing and the code can be refactored later for efficiency, if needed.</p>
]]></description><link>https://forum.qt.io/post/334281</link><guid isPermaLink="true">https://forum.qt.io/post/334281</guid><dc:creator><![CDATA[mvuori]]></dc:creator><pubDate>Wed, 22 Jun 2016 11:41:17 GMT</pubDate></item></channel></rss>