none
different depth values in DepthImageFrame.CopyDepthImagePixelDataTo and DepthImageFrame.CopyPixelDataTo RRS feed

  • Question

  • I get totally different depth values when I retrieve depth data with <o:p></o:p>

    DepthImageFrame.CopyDepthImagePixelDataTo and   DepthImageFrame.CopyPixelDataTo. How come?<o:p></o:p>

    <o:p> </o:p>

    DepthImageFrame.CopyDepthImagePixelDataTo  shows me fairly accurate depth data, but DepthImageFrame.CopyPixelDataTo returns drastically different values (e.g., 735 millimeters in  CopyDepthImagePixelDataTo  is turned to 5880 in CopyPixelDataTo). Why?  Are they using two different units? In some pixels, I am getting negative values too when I use CopyPixelDataTo. 

    How can I fix this?  Thank you


    Monday, December 30, 2013 5:13 AM

Answers

  • If you convert 5880 and 735 in binary, you will respectively get:

    5880 => 1011011111000
    735 => 1011011111

    As you see there a 3 extra bits in the raw pixel data. Those bits correspond to the PlayerIndex data. You can use the following line to truncate and get the depth only:

    int depth = pixeldata[depthIndex] >> DepthImageFrame.PlayerIndexBitmaskWidth;
    Using CopyDepthImagePixelDataTo, Kinect SDK will do it for you.


    Vincent Guigui Innovative Technologies Expert at OCTO Technology Kinect For Windows MVP award

    • Proposed as answer by Vincent GUIGUIMVP Monday, December 30, 2013 10:02 PM
    • Marked as answer by takashiyyy Tuesday, December 31, 2013 12:37 PM
    Monday, December 30, 2013 10:02 PM

All replies

  • If you convert 5880 and 735 in binary, you will respectively get:

    5880 => 1011011111000
    735 => 1011011111

    As you see there a 3 extra bits in the raw pixel data. Those bits correspond to the PlayerIndex data. You can use the following line to truncate and get the depth only:

    int depth = pixeldata[depthIndex] >> DepthImageFrame.PlayerIndexBitmaskWidth;
    Using CopyDepthImagePixelDataTo, Kinect SDK will do it for you.


    Vincent Guigui Innovative Technologies Expert at OCTO Technology Kinect For Windows MVP award

    • Proposed as answer by Vincent GUIGUIMVP Monday, December 30, 2013 10:02 PM
    • Marked as answer by takashiyyy Tuesday, December 31, 2013 12:37 PM
    Monday, December 30, 2013 10:02 PM
  • Great!  Thank you!

    TY


    takashiyyy

    Tuesday, December 31, 2013 12:37 PM