Monday, September 1, 2014

RGB to Depth conversion

Basic information

Depth information captured from Kinect is stored in 16-bit data structure as shown below:




D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1













U3 U2 U1
Real depth information 
(13 bits)
User indicators (3 bits for 7 users)
User indicators: 3 lower value bits that indicate the users
Real depth information:13 lower bit indicate the distance between detected object and the Kinect depth sensor. 

The accuracy of the IR sensor is 7 mm, therefore the first 3 lower bit are always zero
0
0 0 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 0 0 0

Real depth information (13 bits)

RGB to depth conversion

In the sample video, the depth value is converted to 24-bit RGB value using Nui_ShortToQuad_Depth() from Kinect SDK, the following equations are used:
BYTE red= s;
BYTE green= s>>3 & 224;
BYTE blue3= s>>5 & 192;

Blue
Green Red
D13 D12 0 0 0 0 0 0 D11 D10 D9 0 0 0 0 0 D8 D7 D6 D5 D4 0 0 0

In order to extract real value from the RGB representation, we need to do following mappings:

$Depth\;in\;mm=2^5 blue + 2^3 green + red$



No comments:

Post a Comment