<?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: Difference between PXCImage view and cv::Mat view for the depth stream in Items with no label</title>
    <link>https://community.intel.com/t5/Items-with-no-label/Difference-between-PXCImage-view-and-cv-Mat-view-for-the-depth/m-p/377405#M1827</link>
    <description>&lt;P&gt;Hi Sergio A,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for you answer  ,&lt;/P&gt;&lt;P&gt;Unfortunately, I already looked those two links and I am still blocked. It might be a format problem or I don't know..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my code (a mix of what I found on internet), if someone can help me  :&lt;/P&gt;&lt;P&gt;# include "opencv2/core.hpp"&lt;/P&gt;&lt;P&gt;# include "opencv2/highgui.hpp"&lt;/P&gt;&lt;P&gt;# include &lt;/P&gt;&lt;P&gt;# include "pxcsensemanager.h"&lt;/P&gt;&lt;P&gt;# include "pxcmetadata.h"&lt;/P&gt;&lt;P&gt;# include "util_cmdline.h"&lt;/P&gt;&lt;P&gt;# include "util_render.h"&lt;/P&gt;&lt;P&gt;# include &lt;/P&gt;&lt;P&gt;# include &lt;/P&gt;&lt;P&gt;using namespace std;&lt;/P&gt;&lt;P&gt;using namespace cv;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void RecordORPlayback(pxcCHAR *file, bool record) {&lt;/P&gt;&lt;P&gt;  // Create a SenseManager instance&lt;/P&gt;&lt;P&gt;  PXCSenseManager *sm = PXCSenseManager::CreateInstance();&lt;/P&gt;&lt;P&gt;  PXCSession *session;&lt;/P&gt;&lt;P&gt;  // Set file recording or playback&lt;/P&gt;&lt;P&gt;  sm-&amp;gt;QueryCaptureManager()-&amp;gt;SetFileName(file, record);&lt;/P&gt;&lt;P&gt;  // Select the color stream&lt;/P&gt;&lt;P&gt;  sm-&amp;gt;EnableStream(PXCCapture::STREAM_TYPE_DEPTH, 320, 240, 30);&lt;/P&gt;&lt;P&gt;  // Initialize and Record 300 frames&lt;/P&gt;&lt;P&gt;  sm-&amp;gt;Init();&lt;/P&gt;&lt;P&gt;  for (int i = 0; i&amp;lt;100; i++) {&lt;/P&gt;&lt;P&gt;  // This function blocks until a color sample is ready&lt;/P&gt;&lt;P&gt;  if (sm-&amp;gt;AcquireFrame(true)&lt;/P&gt;&lt;P&gt;  // Retrieve the sample&lt;/P&gt;&lt;P&gt;  PXCCapture::Sample *sample = sm-&amp;gt;QuerySample();&lt;/P&gt;&lt;P&gt;  // Go fetching the next sample&lt;/P&gt;&lt;P&gt;  sm-&amp;gt;ReleaseFrame();&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;  // close down&lt;/P&gt;&lt;P&gt;  sm-&amp;gt;Release();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cv::Mat PXCImage2CVMat(PXCImage *pxcImage, PXCImage::PixelFormat format)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;  PXCImage::ImageData data;&lt;/P&gt;&lt;P&gt;  pxcImage-&amp;gt;AcquireAccess(PXCImage::ACCESS_READ, format, &amp;amp;data);&lt;/P&gt;&lt;P&gt;  int width = pxcImage-&amp;gt;QueryInfo().width;&lt;/P&gt;&lt;P&gt;  int height = pxcImage-&amp;gt;QueryInfo().height;&lt;/P&gt;&lt;P&gt;  if (!format)&lt;/P&gt;&lt;P&gt;  format = pxcImage-&amp;gt;QueryInfo().format;&lt;/P&gt;&lt;P&gt;  int type;&lt;/P&gt;&lt;P&gt;  if (format == PXCImage::PIXEL_FORMAT_Y8)&lt;/P&gt;&lt;P&gt;  type = CV_8UC1;&lt;/P&gt;&lt;P&gt;  else if (format == PXCImage::PIXEL_FORMAT_RGB24)&lt;/P&gt;&lt;P&gt;  type = CV_8UC3;&lt;/P&gt;&lt;P&gt;  else if (format == PXCImage::PIXEL_FORMAT_DEPTH_F32)&lt;/P&gt;&lt;P&gt;  type = CV_32F;&lt;/P&gt;&lt;P&gt;  cv::Mat ocvImage = cv::Mat(cv::Size(width, height), type, data.planes[0], data.pitches[0]);&lt;/P&gt;&lt;P&gt;  pxcImage-&amp;gt;ReleaseAccess(&amp;amp;data);&lt;/P&gt;&lt;P&gt;  return ocvImage;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int main(int argc, WCHAR* argv[]) {&lt;/P&gt;&lt;P&gt;  //Define some parameters for the camera&lt;/P&gt;&lt;P&gt;  cv::Size frameSize = cv::Size(320, 240);&lt;/P&gt;&lt;P&gt;  float frameRate = 30;&lt;/P&gt;&lt;P&gt;  cv::Mat frameColor = cv::Mat::zeros(frameSize, CV_8UC3);&lt;/P&gt;&lt;P&gt;  cv::Mat frameDepth = cv::Mat::zeros(frameSize, CV_32F);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  /* Creates an instance of the PXCSenseManager */&lt;/P&gt;&lt;P&gt;  PXCSenseManager *pp = PXCSenseManager::CreateInstance();&lt;/P&gt;&lt;P&gt;  if (!pp) {&lt;/P&gt;&lt;P&gt;  wprintf_s(L"Unable to create the SenseManager\n");&lt;/P&gt;&lt;P&gt;  return 3;&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  /* Sets file recording or playback */&lt;/P&gt;&lt;P&gt;  PXCCaptureManager *cm = pp-&amp;gt;QueryCaptureManager();&lt;/P&gt;&lt;P&gt;  pxcCHAR *filename = (L"DEPTHRenderTEST");&lt;/P&gt;&lt;P&gt;  RecordORPlayback(filename, true);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  // Create stream renders&lt;/P&gt;&lt;P&gt;  UtilRender renderc(L"Color"), renderd(L"Depth"), renderi(L"IR"), renderr(L"Right"), renderl(L"Left");&lt;/P&gt;&lt;P&gt;  pxcStatus sts;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  do {&lt;/P&gt;&lt;P&gt;  /* Apply command line arguments */&lt;/P&gt;&lt;P&gt;  pxcBool revert = false;&lt;/P&gt;&lt;P&gt;  PXCVideoModule::DataDesc desc = {};&lt;/P&gt;&lt;P&gt;  desc.deviceInfo.streams = PXCCapture::STREAM_TYPE_COLOR | PXCCapture::STREAM_TYPE_DEPTH;&lt;/P&gt;&lt;P&gt;  revert = true;&lt;/P&gt;&lt;P&gt;  pp-&amp;gt;EnableStreams(&amp;amp;desc);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  /* Initializes the pipeline */&lt;/P&gt;&lt;P&gt;  sts = pp-&amp;gt;Init();&lt;/P&gt;&lt;P&gt;  if (sts&lt;/P&gt;&lt;P&gt;  if (revert) {&lt;/P&gt;&lt;P&gt;  /* Enable a single stream */&lt;/P&gt;&lt;P&gt;  pp-&amp;gt;Close();&lt;/P&gt;&lt;P&gt;  pp-&amp;gt;EnableStream(PXCCapture::STREAM_TYPE_DEPTH);&lt;/P&gt;&lt;P&gt;  sts = pp-&amp;gt;Init();&lt;/P&gt;&lt;P&gt;  if (sts&lt;/P&gt;&lt;P&gt;  pp-&amp;gt;Close();&lt;/P&gt;&lt;P&gt;  pp-&amp;gt;EnableStream(PXCCapture::STREAM_TYPE_COLOR);&lt;/P&gt;&lt;P&gt;  sts = pp-&amp;gt;Init();&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;  if (sts&lt;/P&gt;&lt;P&gt;  wprintf_s(L"Failed to locate any video stream(s)\n");&lt;/P&gt;&lt;P&gt;  pp-&amp;gt;Release();&lt;/P&gt;&lt;P&gt;  return sts;&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  /* Reset all properties */&lt;/P&gt;&lt;P&gt;  PXCCapture::Device *device = pp-&amp;gt;QueryCaptureManager()-&amp;gt;QueryDevice();&lt;/P&gt;&lt;P&gt;  device-&amp;gt;ResetProperties(PXCCapture::STREAM_TYPE_ANY);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  for (;;) {&lt;/P&gt;&lt;P&gt;  // for (int i=0;i&amp;lt;51;i++){&lt;/P&gt;&lt;P&gt;  /* Waits until new frame is available and locks it for application processing */&lt;/P&gt;&lt;P&gt;  sts = pp-&amp;gt;AcquireFrame(true);&lt;/P&gt;&lt;P&gt;  if (sts&lt;/P&gt;&lt;P&gt;  if (sts == PXC_STATUS_STREAM_CONFIG_CHANGED) {&lt;/P&gt;&lt;P&gt;  wprintf_s(L"Stream configuration was changed, re-initilizing\n");&lt;/P&gt;&lt;P&gt;  pp-&amp;gt;Close();&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;  break;&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  const PXCCapture::Sample *sample = pp-&amp;gt;QuerySample();&lt;/P&gt;&lt;P&gt;  if (sample) {&lt;/P&gt;&lt;P&gt;  if (sample-&amp;gt;depth &amp;amp;&amp;amp; !renderd.RenderFrame(sample-&amp;gt;depth)) break;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if (sample-&amp;gt;depth) {&lt;/P&gt;&lt;P&gt;  frameDepth = PXCImage2CVMat(sample-&amp;gt;depth, PXCImage::PIXEL_FORMAT_DEPTH_F32);&lt;/P&gt;&lt;P&gt;  /* string result_depthCV = "DepthOpenCV.png";&lt;/P&gt;&lt;P&gt;  imwrite(result_depthCV, frameDepth);*/&lt;/P&gt;&lt;P&gt;  namedWindow("Depth", CV_WINDOW_NORMAL);&lt;/P&gt;&lt;P&gt;  imshow("Depth", frameDepth);&lt;/P&gt;&lt;P&gt;  waitKey(1);&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if (sample-&amp;gt;color) {&lt;/P&gt;&lt;P&gt;  frameColor = PXCImage2CVMat(sample-&amp;gt;color, PXCImage::PIXEL_FORMAT_RGB24);&lt;/P&gt;&lt;P&gt;  namedWindow("Color", CV_WINDOW_NORMAL); //works without this line too&lt;/P&gt;&lt;P&gt;  imshow("Color", frameColor);&lt;/P&gt;&lt;P&gt;  waitKey(1);&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  /* Releases lock so pipeline can process next frame */&lt;/P&gt;&lt;P&gt;  pp-&amp;gt;ReleaseFrame();&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;  if (_kbhit()) { // Break loop&lt;/P&gt;&lt;P&gt;  int c = _getch() &amp;amp; 255;&lt;/P&gt;&lt;P&gt;  if (c == 27 || c == 'q' || c == 'Q') break; // ESC|q|Q for Exit&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;  } while (sts == PXC_STATUS_STREAM_CONFIG_CHANGED);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wprintf_s(L"Exiting\n");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  // Clean Up&lt;/P&gt;&lt;P&gt;  pp-&amp;gt;Release();&lt;/P&gt;&lt;P&gt;  system("Pause");&lt;/P&gt;&lt;P&gt;  return 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;Thanks,&lt;/P&gt;&lt;P&gt;Lucie&lt;/P&gt;</description>
    <pubDate>Thu, 27 Apr 2017 09:29:54 GMT</pubDate>
    <dc:creator>lluci1</dc:creator>
    <dc:date>2017-04-27T09:29:54Z</dc:date>
    <item>
      <title>Difference between PXCImage view and cv::Mat view for the depth stream</title>
      <link>https://community.intel.com/t5/Items-with-no-label/Difference-between-PXCImage-view-and-cv-Mat-view-for-the-depth/m-p/377403#M1825</link>
      <description>&lt;P&gt;Hello &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working with the RealSense R200 camera using Visual Studio &amp;amp; C++.&lt;/P&gt;&lt;P&gt;I need to use OpenCV to do image processing so I converted the PXCImage * into cv::Mat.&lt;/P&gt;&lt;P&gt;But, as you can see, the two images are different (like if I am loosing information).&lt;/P&gt;&lt;P&gt;Does anybody can help me?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                                                       Render display screenshot                                                                                                                                Imshow display screenshot&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Lucie&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 09:58:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Items-with-no-label/Difference-between-PXCImage-view-and-cv-Mat-view-for-the-depth/m-p/377403#M1825</guid>
      <dc:creator>lluci1</dc:creator>
      <dc:date>2017-04-26T09:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between PXCImage view and cv::Mat view for the depth stream</title>
      <link>https://community.intel.com/t5/Items-with-no-label/Difference-between-PXCImage-view-and-cv-Mat-view-for-the-depth/m-p/377404#M1826</link>
      <description>&lt;P&gt;Hi Lucie,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;Thank you for contacting us.&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;We've investigated about your case and found two useful links that relate to this case. The first one is a community thread where the user has a similar question and the second one is a guide to use LibRealSense and OpenCV to stream RGB and Depth Data. The latter has a complete example that explains how to use LibRealSense and OpenCV to display both an RGB stream as well as Depth stream into two separate OpenCV created windows.&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt; &lt;A href="https://software.intel.com/en-us/forums/realsense/topic/599415"&gt;https://software.intel.com/en-us/forums/realsense/topic/599415&lt;/A&gt; &lt;P&gt;&amp;nbsp;&lt;/P&gt; &lt;A href="https://software.intel.com/en-us/articles/using-librealsense-and-opencv-to-stream-rgb-and-depth-data"&gt;https://software.intel.com/en-us/articles/using-librealsense-and-opencv-to-stream-rgb-and-depth-data&lt;/A&gt; &lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;Let us know if you find this useful.&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;Regards,&lt;P&gt;&amp;nbsp;&lt;/P&gt;-Sergio A&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 20:14:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Items-with-no-label/Difference-between-PXCImage-view-and-cv-Mat-view-for-the-depth/m-p/377404#M1826</guid>
      <dc:creator>idata</dc:creator>
      <dc:date>2017-04-26T20:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between PXCImage view and cv::Mat view for the depth stream</title>
      <link>https://community.intel.com/t5/Items-with-no-label/Difference-between-PXCImage-view-and-cv-Mat-view-for-the-depth/m-p/377405#M1827</link>
      <description>&lt;P&gt;Hi Sergio A,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for you answer  ,&lt;/P&gt;&lt;P&gt;Unfortunately, I already looked those two links and I am still blocked. It might be a format problem or I don't know..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my code (a mix of what I found on internet), if someone can help me  :&lt;/P&gt;&lt;P&gt;# include "opencv2/core.hpp"&lt;/P&gt;&lt;P&gt;# include "opencv2/highgui.hpp"&lt;/P&gt;&lt;P&gt;# include &lt;/P&gt;&lt;P&gt;# include "pxcsensemanager.h"&lt;/P&gt;&lt;P&gt;# include "pxcmetadata.h"&lt;/P&gt;&lt;P&gt;# include "util_cmdline.h"&lt;/P&gt;&lt;P&gt;# include "util_render.h"&lt;/P&gt;&lt;P&gt;# include &lt;/P&gt;&lt;P&gt;# include &lt;/P&gt;&lt;P&gt;using namespace std;&lt;/P&gt;&lt;P&gt;using namespace cv;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void RecordORPlayback(pxcCHAR *file, bool record) {&lt;/P&gt;&lt;P&gt;  // Create a SenseManager instance&lt;/P&gt;&lt;P&gt;  PXCSenseManager *sm = PXCSenseManager::CreateInstance();&lt;/P&gt;&lt;P&gt;  PXCSession *session;&lt;/P&gt;&lt;P&gt;  // Set file recording or playback&lt;/P&gt;&lt;P&gt;  sm-&amp;gt;QueryCaptureManager()-&amp;gt;SetFileName(file, record);&lt;/P&gt;&lt;P&gt;  // Select the color stream&lt;/P&gt;&lt;P&gt;  sm-&amp;gt;EnableStream(PXCCapture::STREAM_TYPE_DEPTH, 320, 240, 30);&lt;/P&gt;&lt;P&gt;  // Initialize and Record 300 frames&lt;/P&gt;&lt;P&gt;  sm-&amp;gt;Init();&lt;/P&gt;&lt;P&gt;  for (int i = 0; i&amp;lt;100; i++) {&lt;/P&gt;&lt;P&gt;  // This function blocks until a color sample is ready&lt;/P&gt;&lt;P&gt;  if (sm-&amp;gt;AcquireFrame(true)&lt;/P&gt;&lt;P&gt;  // Retrieve the sample&lt;/P&gt;&lt;P&gt;  PXCCapture::Sample *sample = sm-&amp;gt;QuerySample();&lt;/P&gt;&lt;P&gt;  // Go fetching the next sample&lt;/P&gt;&lt;P&gt;  sm-&amp;gt;ReleaseFrame();&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;  // close down&lt;/P&gt;&lt;P&gt;  sm-&amp;gt;Release();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cv::Mat PXCImage2CVMat(PXCImage *pxcImage, PXCImage::PixelFormat format)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;  PXCImage::ImageData data;&lt;/P&gt;&lt;P&gt;  pxcImage-&amp;gt;AcquireAccess(PXCImage::ACCESS_READ, format, &amp;amp;data);&lt;/P&gt;&lt;P&gt;  int width = pxcImage-&amp;gt;QueryInfo().width;&lt;/P&gt;&lt;P&gt;  int height = pxcImage-&amp;gt;QueryInfo().height;&lt;/P&gt;&lt;P&gt;  if (!format)&lt;/P&gt;&lt;P&gt;  format = pxcImage-&amp;gt;QueryInfo().format;&lt;/P&gt;&lt;P&gt;  int type;&lt;/P&gt;&lt;P&gt;  if (format == PXCImage::PIXEL_FORMAT_Y8)&lt;/P&gt;&lt;P&gt;  type = CV_8UC1;&lt;/P&gt;&lt;P&gt;  else if (format == PXCImage::PIXEL_FORMAT_RGB24)&lt;/P&gt;&lt;P&gt;  type = CV_8UC3;&lt;/P&gt;&lt;P&gt;  else if (format == PXCImage::PIXEL_FORMAT_DEPTH_F32)&lt;/P&gt;&lt;P&gt;  type = CV_32F;&lt;/P&gt;&lt;P&gt;  cv::Mat ocvImage = cv::Mat(cv::Size(width, height), type, data.planes[0], data.pitches[0]);&lt;/P&gt;&lt;P&gt;  pxcImage-&amp;gt;ReleaseAccess(&amp;amp;data);&lt;/P&gt;&lt;P&gt;  return ocvImage;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int main(int argc, WCHAR* argv[]) {&lt;/P&gt;&lt;P&gt;  //Define some parameters for the camera&lt;/P&gt;&lt;P&gt;  cv::Size frameSize = cv::Size(320, 240);&lt;/P&gt;&lt;P&gt;  float frameRate = 30;&lt;/P&gt;&lt;P&gt;  cv::Mat frameColor = cv::Mat::zeros(frameSize, CV_8UC3);&lt;/P&gt;&lt;P&gt;  cv::Mat frameDepth = cv::Mat::zeros(frameSize, CV_32F);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  /* Creates an instance of the PXCSenseManager */&lt;/P&gt;&lt;P&gt;  PXCSenseManager *pp = PXCSenseManager::CreateInstance();&lt;/P&gt;&lt;P&gt;  if (!pp) {&lt;/P&gt;&lt;P&gt;  wprintf_s(L"Unable to create the SenseManager\n");&lt;/P&gt;&lt;P&gt;  return 3;&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  /* Sets file recording or playback */&lt;/P&gt;&lt;P&gt;  PXCCaptureManager *cm = pp-&amp;gt;QueryCaptureManager();&lt;/P&gt;&lt;P&gt;  pxcCHAR *filename = (L"DEPTHRenderTEST");&lt;/P&gt;&lt;P&gt;  RecordORPlayback(filename, true);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  // Create stream renders&lt;/P&gt;&lt;P&gt;  UtilRender renderc(L"Color"), renderd(L"Depth"), renderi(L"IR"), renderr(L"Right"), renderl(L"Left");&lt;/P&gt;&lt;P&gt;  pxcStatus sts;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  do {&lt;/P&gt;&lt;P&gt;  /* Apply command line arguments */&lt;/P&gt;&lt;P&gt;  pxcBool revert = false;&lt;/P&gt;&lt;P&gt;  PXCVideoModule::DataDesc desc = {};&lt;/P&gt;&lt;P&gt;  desc.deviceInfo.streams = PXCCapture::STREAM_TYPE_COLOR | PXCCapture::STREAM_TYPE_DEPTH;&lt;/P&gt;&lt;P&gt;  revert = true;&lt;/P&gt;&lt;P&gt;  pp-&amp;gt;EnableStreams(&amp;amp;desc);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  /* Initializes the pipeline */&lt;/P&gt;&lt;P&gt;  sts = pp-&amp;gt;Init();&lt;/P&gt;&lt;P&gt;  if (sts&lt;/P&gt;&lt;P&gt;  if (revert) {&lt;/P&gt;&lt;P&gt;  /* Enable a single stream */&lt;/P&gt;&lt;P&gt;  pp-&amp;gt;Close();&lt;/P&gt;&lt;P&gt;  pp-&amp;gt;EnableStream(PXCCapture::STREAM_TYPE_DEPTH);&lt;/P&gt;&lt;P&gt;  sts = pp-&amp;gt;Init();&lt;/P&gt;&lt;P&gt;  if (sts&lt;/P&gt;&lt;P&gt;  pp-&amp;gt;Close();&lt;/P&gt;&lt;P&gt;  pp-&amp;gt;EnableStream(PXCCapture::STREAM_TYPE_COLOR);&lt;/P&gt;&lt;P&gt;  sts = pp-&amp;gt;Init();&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;  if (sts&lt;/P&gt;&lt;P&gt;  wprintf_s(L"Failed to locate any video stream(s)\n");&lt;/P&gt;&lt;P&gt;  pp-&amp;gt;Release();&lt;/P&gt;&lt;P&gt;  return sts;&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  /* Reset all properties */&lt;/P&gt;&lt;P&gt;  PXCCapture::Device *device = pp-&amp;gt;QueryCaptureManager()-&amp;gt;QueryDevice();&lt;/P&gt;&lt;P&gt;  device-&amp;gt;ResetProperties(PXCCapture::STREAM_TYPE_ANY);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  for (;;) {&lt;/P&gt;&lt;P&gt;  // for (int i=0;i&amp;lt;51;i++){&lt;/P&gt;&lt;P&gt;  /* Waits until new frame is available and locks it for application processing */&lt;/P&gt;&lt;P&gt;  sts = pp-&amp;gt;AcquireFrame(true);&lt;/P&gt;&lt;P&gt;  if (sts&lt;/P&gt;&lt;P&gt;  if (sts == PXC_STATUS_STREAM_CONFIG_CHANGED) {&lt;/P&gt;&lt;P&gt;  wprintf_s(L"Stream configuration was changed, re-initilizing\n");&lt;/P&gt;&lt;P&gt;  pp-&amp;gt;Close();&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;  break;&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  const PXCCapture::Sample *sample = pp-&amp;gt;QuerySample();&lt;/P&gt;&lt;P&gt;  if (sample) {&lt;/P&gt;&lt;P&gt;  if (sample-&amp;gt;depth &amp;amp;&amp;amp; !renderd.RenderFrame(sample-&amp;gt;depth)) break;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if (sample-&amp;gt;depth) {&lt;/P&gt;&lt;P&gt;  frameDepth = PXCImage2CVMat(sample-&amp;gt;depth, PXCImage::PIXEL_FORMAT_DEPTH_F32);&lt;/P&gt;&lt;P&gt;  /* string result_depthCV = "DepthOpenCV.png";&lt;/P&gt;&lt;P&gt;  imwrite(result_depthCV, frameDepth);*/&lt;/P&gt;&lt;P&gt;  namedWindow("Depth", CV_WINDOW_NORMAL);&lt;/P&gt;&lt;P&gt;  imshow("Depth", frameDepth);&lt;/P&gt;&lt;P&gt;  waitKey(1);&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if (sample-&amp;gt;color) {&lt;/P&gt;&lt;P&gt;  frameColor = PXCImage2CVMat(sample-&amp;gt;color, PXCImage::PIXEL_FORMAT_RGB24);&lt;/P&gt;&lt;P&gt;  namedWindow("Color", CV_WINDOW_NORMAL); //works without this line too&lt;/P&gt;&lt;P&gt;  imshow("Color", frameColor);&lt;/P&gt;&lt;P&gt;  waitKey(1);&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  /* Releases lock so pipeline can process next frame */&lt;/P&gt;&lt;P&gt;  pp-&amp;gt;ReleaseFrame();&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;  if (_kbhit()) { // Break loop&lt;/P&gt;&lt;P&gt;  int c = _getch() &amp;amp; 255;&lt;/P&gt;&lt;P&gt;  if (c == 27 || c == 'q' || c == 'Q') break; // ESC|q|Q for Exit&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;  } while (sts == PXC_STATUS_STREAM_CONFIG_CHANGED);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  wprintf_s(L"Exiting\n");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  // Clean Up&lt;/P&gt;&lt;P&gt;  pp-&amp;gt;Release();&lt;/P&gt;&lt;P&gt;  system("Pause");&lt;/P&gt;&lt;P&gt;  return 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;Thanks,&lt;/P&gt;&lt;P&gt;Lucie&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2017 09:29:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Items-with-no-label/Difference-between-PXCImage-view-and-cv-Mat-view-for-the-depth/m-p/377405#M1827</guid>
      <dc:creator>lluci1</dc:creator>
      <dc:date>2017-04-27T09:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between PXCImage view and cv::Mat view for the depth stream</title>
      <link>https://community.intel.com/t5/Items-with-no-label/Difference-between-PXCImage-view-and-cv-Mat-view-for-the-depth/m-p/377406#M1828</link>
      <description>&lt;P&gt;Hi Lucie,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;We looked online and even though we didn't find any official guides that might help you with the code, we did found a couple of links that may be helpful&lt;P&gt;&amp;nbsp;&lt;/P&gt; &lt;A href="https://software.intel.com/en-us/forums/realsense/topic/624897"&gt;https://software.intel.com/en-us/forums/realsense/topic/624897&lt;/A&gt; &lt;P&gt;&amp;nbsp;&lt;/P&gt; &lt;A href="http://stackoverflow.com/questions/37266390/how-to-convert-realsense-rgb-frame-to-cvmat-in-ubuntu-or-other-linux-env"&gt;http://stackoverflow.com/questions/37266390/how-to-convert-realsense-rgb-frame-to-cvmat-in-ubuntu-or-other-linux-env&lt;/A&gt; &lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;From the looks of both pictures, they're obviously different, but, the depth patterns don't seem to be so different from each other.&lt;P&gt;&amp;nbsp;&lt;/P&gt;It looks as if one of the images needs further calibration in order to look the same as the first image.&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;I looked at some examples and found that frameColor and frameDepth used this way solved the issue for some customers: &lt;P&gt;&amp;nbsp;&lt;/P&gt;cv::Mat frameColor = cv::Mat::zeros(resolutionColor.height, resolutionColor.width, CV_8UC3);&lt;P&gt;&amp;nbsp;&lt;/P&gt;cv::Mat frameDepth = cv::Mat::zeros(resolutionDepth.height, resolutionDepth.width, CV_32FC1);&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;Keep us updated.&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;-Sergio A&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2017 20:35:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Items-with-no-label/Difference-between-PXCImage-view-and-cv-Mat-view-for-the-depth/m-p/377406#M1828</guid>
      <dc:creator>idata</dc:creator>
      <dc:date>2017-04-27T20:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between PXCImage view and cv::Mat view for the depth stream</title>
      <link>https://community.intel.com/t5/Items-with-no-label/Difference-between-PXCImage-view-and-cv-Mat-view-for-the-depth/m-p/377407#M1829</link>
      <description>&lt;P&gt;Hi Lucie,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;Do you still need assistance with this case? We'll be waiting for your response.&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;-Sergio A&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2017 19:49:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Items-with-no-label/Difference-between-PXCImage-view-and-cv-Mat-view-for-the-depth/m-p/377407#M1829</guid>
      <dc:creator>idata</dc:creator>
      <dc:date>2017-05-02T19:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between PXCImage view and cv::Mat view for the depth stream</title>
      <link>https://community.intel.com/t5/Items-with-no-label/Difference-between-PXCImage-view-and-cv-Mat-view-for-the-depth/m-p/377408#M1830</link>
      <description>&lt;P&gt;Hi Sergio,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your interest in my issue.&lt;/P&gt;&lt;P&gt;I just solved it &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally, I used :&lt;/P&gt;&lt;P&gt;&lt;I&gt;cv::Mat frameDepth = cv::Mat::zeros(frameSize, CV_16U);&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;cv::Mat frameDepth8b = cv::Mat::zeros(frameSize, CV_8UC1); &lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;if (sample-&amp;gt;depth) {&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;  frameDepth = PXCImage2CVMat(sample-&amp;gt;depth, PXCImage::PIXEL_FORMAT_DEPTH);&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;  frameDepth.convertTo(frameDepth8b, CV_8UC1, 255.0 / 4096.0);&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;// imwrite&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;  string result_depthCV = "DepthOpenCV.png";&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;  imwrite(result_depthCV, frameDepth8b, { CV_IMWRITE_PNG_STRATEGY_DEFAULT });&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;// imshow&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;  namedWindow("Depth", CV_WINDOW_AUTOSIZE);&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;  imshow("Depth", frameDepth8b);&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;  waitKey(1);&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;}&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't really understand with I have to convert &lt;I&gt;frameDepth&lt;/I&gt; in CV_8UC1 because normally &lt;I&gt;imwrite&lt;/I&gt; can save an 16-bit image in PNG format. But it now at least, it works &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again ,&lt;/P&gt;&lt;P&gt;Lucie&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2017 10:18:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Items-with-no-label/Difference-between-PXCImage-view-and-cv-Mat-view-for-the-depth/m-p/377408#M1830</guid>
      <dc:creator>lluci1</dc:creator>
      <dc:date>2017-05-03T10:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between PXCImage view and cv::Mat view for the depth stream</title>
      <link>https://community.intel.com/t5/Items-with-no-label/Difference-between-PXCImage-view-and-cv-Mat-view-for-the-depth/m-p/377409#M1831</link>
      <description>&lt;P&gt;Hi Lucie,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;Thank you for confirming you've fixed the issue and sharing your results with the community. Don't hesitate to come back if help is needed, we'd be happy to assist you.&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;Regards,&lt;P&gt;&amp;nbsp;&lt;/P&gt;-Sergio A&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2017 19:48:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Items-with-no-label/Difference-between-PXCImage-view-and-cv-Mat-view-for-the-depth/m-p/377409#M1831</guid>
      <dc:creator>idata</dc:creator>
      <dc:date>2017-05-03T19:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between PXCImage view and cv::Mat view for the depth stream</title>
      <link>https://community.intel.com/t5/Items-with-no-label/Difference-between-PXCImage-view-and-cv-Mat-view-for-the-depth/m-p/377410#M1832</link>
      <description>&lt;P&gt;Hi Lucie&lt;/P&gt;&lt;P&gt;You said you have solved this problem, but when I used your method, it didn't work. As you can see:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is still different.&lt;/P&gt;&lt;P&gt;I hope I will receive your reply. &lt;/P&gt;</description>
      <pubDate>Wed, 02 Aug 2017 13:06:32 GMT</pubDate>
      <guid>https://community.intel.com/t5/Items-with-no-label/Difference-between-PXCImage-view-and-cv-Mat-view-for-the-depth/m-p/377410#M1832</guid>
      <dc:creator>秦文翔</dc:creator>
      <dc:date>2017-08-02T13:06:32Z</dc:date>
    </item>
  </channel>
</rss>

