title: get depth map from depth data kinect openni open cv
body: <p>I m beginning in programming with openni and open cv I m working with the kinect .
   here a part of the code that I m using to get de data depth map ( it s working )
  Now my question is :
  How could I get the depht map as an image in return ?
  my data is on DepthPixel* pDepth1 and I want to display the image of the depth map (because I want to save her ).
  Thank you </p>
  
  <pre><code>VideoFrameRef frame;
  
  DepthPixel* pDepth1 = NULL;
  DepthPixel* pDepth2 = NULL;
  for (int i = 0; i &lt; 2; i++)
  {
      int changedStreamDummy;
      VideoStream* pStream = &amp;depth;
      rc = OpenNI::waitForAnyStream(&amp;pStream, 1, &amp;changedStreamDummy, SAMPLE_READ_WAIT_TIMEOUT);
      if (rc != STATUS_OK)
      {
          printf("Wait failed! (timeout is %d ms)\n%s\n", SAMPLE_READ_WAIT_TIMEOUT, OpenNI::getExtendedError());
          continue;
      }
  
      rc = depth.readFrame(&amp;frame);
      if (rc != STATUS_OK)
      {
          printf("Read failed!\n%s\n", OpenNI::getExtendedError());
          continue;
      }
  
      if (frame.getVideoMode().getPixelFormat() != PIXEL_FORMAT_DEPTH_1_MM &amp;&amp; frame.getVideoMode().getPixelFormat() != PIXEL_FORMAT_DEPTH_100_UM)
      {
          printf("Unexpected frame format\n");
          continue;
      }
  
      if (i == 0){
          int dummy;
          cout &lt;&lt; "Press any key to take first pic: ";
          cin &gt;&gt; dummy;
          pDepth1 = (DepthPixel*)frame.getData();
      }
      else{
          int dummy;
          cout &lt;&lt; "Press any key to take second pic: ";
          cin &gt;&gt; dummy;
          pDepth2 = (DepthPixel*)frame.getData();
      }
  </code></pre>