none
Kinect uses 12 bits or 13 bits for depth data? RRS feed

  • Question

  • Hi,

    I was trying to understand the depth format of the kinect device when I came across the below FAQ

    Each pixel is represented by 2 bytes arranged in little endian order. The detailed layout of the 16-bit data depends on the kind of depth stream being used, but in all cases 12 bits will be used to represent distance from camera (in millimeters) to object perceived at pixel.
      8.1. RuntimeOptions.UseDepth (managed) or NUI_INITIALIZE_FLAG_USES_DEPTH (C++)
      Least significant 12 bits will contain distance from camera (in millimeters). Remaining bits are unused.
      8.2. RuntimeOptions.UseDpethAndPlayerIndex (managed) or NUI_INITIALIZE_FLAG_USES_DEPTH_AND_PLAYER_INDEX (C++)
      Least significant 3 bits will contain index of player detected at pixel , most significant bit is unused and remaining 12 bits contain distance from camera.

    In few other queries posted on the same forum, I see that kinect depth data is mentioned as 13 bits (and 3 bits for player index) with the piece of code similiar to the one shown below to get the accurate depth

    depth = ((*pBufferRun) & 0xfff8)>>3; ---> shifting 3 bits right to get the uppermost 13 bits for depth data

    But I see that as per the FAQ  quoted above, in either cases (UseDepth and UseDpethAndPlayerIndex) only 12 bits of depth data is used.

    If it is only 12 bits depth data and 3 bits for player index, what is the remaining 1 bit for?

    I was also looking at the open source kinect driver (from primesense) as well which says only 11 bits of depth data is used which adds to further confusion.

    So someone please clarify and confirm the depth data bits being used to avoid my ambiguity. I would appreciate a very quick response as
    I have to respond to someone by end of today!

    Thanks so much in advance,

    Sriram


    • Edited by msaichaitanya Thursday, June 7, 2012 6:16 AM Question Edited
    Thursday, June 7, 2012 5:55 AM

Answers

  • This appears to be a documentation error.  The Depth data is always 13 bits of distance information (including sentinel values), 3 bits of player information.  If the player index isn't requested, the 3 bits will be 0.

    -Adam Smith [MSFT]

    • Marked as answer by msaichaitanya Monday, June 11, 2012 11:55 AM
    Thursday, June 7, 2012 6:11 PM
  • The sentinel values are "too near", "too far", and "unknown."

    The actual sentinel values are:

    • Too near: 0x0000
    • Too far: 0x7ff8
    • Unknown: 0xfff8

    John
    K4W Dev

    • Marked as answer by msaichaitanya Monday, June 11, 2012 11:55 AM
    Thursday, June 7, 2012 9:33 PM
  • As you quote, the behavior described was for Beta 2. In 1.0 and 1.5, if you choose to pass NUI_IMAGE_STREAM_FLAG_DISTINCT_OVERFLOW_DEPTH_VALUES to NuiImageStreamOpen, then the sentinel values will be returned, otherwise they'll be 0. In managed, this flag is always on.

    -Adam Smith [MSFT]

    • Marked as answer by msaichaitanya Monday, June 11, 2012 11:55 AM
    Friday, June 8, 2012 6:16 PM

All replies

  • This appears to be a documentation error.  The Depth data is always 13 bits of distance information (including sentinel values), 3 bits of player information.  If the player index isn't requested, the 3 bits will be 0.

    -Adam Smith [MSFT]

    • Marked as answer by msaichaitanya Monday, June 11, 2012 11:55 AM
    Thursday, June 7, 2012 6:11 PM
  • What are the sentinel values and when are they used?

    Michael

    Thursday, June 7, 2012 9:21 PM
  • The sentinel values are "too near", "too far", and "unknown."

    The actual sentinel values are:

    • Too near: 0x0000
    • Too far: 0x7ff8
    • Unknown: 0xfff8

    John
    K4W Dev

    • Marked as answer by msaichaitanya Monday, June 11, 2012 11:55 AM
    Thursday, June 7, 2012 9:33 PM
  • Hi,

    13 Bits is correct, but the information relaevant bits are only 12 with respect to valid depth data.

    Kinect covers 4m = 4000 mm as biggest valid depth data.

    With 12 Bits, the kinect covers the top range of 2 power 12 = 4096 mm.
    This is helpfull if you do some further image processing like window/center operation.

    Than you can use 12 bit as raw data and recalculate it using the full 16 bit range of a short type to get

    better image quality.

    Regards

    Michael

    Friday, June 8, 2012 11:28 AM
  • Hi John,

    Thanks for the reply. But the information you have provided is quite contradictory to the information present in the documentation

    http://blogs.msdn.com/b/kinectforwindows/archive/2012/01/20/near-mode-what-it-is-and-isn-t.aspx

    Quoting the sentence from the link "In Beta 2, for an object 800-4000 millimeters from the sensor  the runtime would return the depth value, and the runtime returned a 0 regardless if the detected depth was unknown, too near or too far"

    Would you please let me know which of the two responses should be treated as accurate? Please let me know if my understanding is incorrect.

    Thanks

    Sriram

    Friday, June 8, 2012 11:36 AM
  • As you quote, the behavior described was for Beta 2. In 1.0 and 1.5, if you choose to pass NUI_IMAGE_STREAM_FLAG_DISTINCT_OVERFLOW_DEPTH_VALUES to NuiImageStreamOpen, then the sentinel values will be returned, otherwise they'll be 0. In managed, this flag is always on.

    -Adam Smith [MSFT]

    • Marked as answer by msaichaitanya Monday, June 11, 2012 11:55 AM
    Friday, June 8, 2012 6:16 PM