none
how to calculate the distance of players [Kinect] RRS feed

  • Question

  • is there a way to determine the player distance?

    i'de like to determine the distance between kinect and players and tell them if they are too near or too far from the kinect...

    thanks


    • Edited by 03FTW Wednesday, June 13, 2012 3:56 PM
    Wednesday, June 13, 2012 3:42 PM

Answers

  • Each Skeleton has a Position property, which describes the X, Y and Z coordinates in real-world coordinates.

    -Adam Smith [MSFT]

    Wednesday, June 13, 2012 6:35 PM
  • have you tried

    private static short CalculateDistanceFromDepth(byte first, byte second)
            {
                return (short)(first | second << 8);
            }

    and then

    for (int depthColumnIndex = 0; depthColumnIndex < 640; depthColumnIndex += 2)  
                 {  
                     var depthIndex = depthColumnIndex + (depthRowIndex * 640);  
       
                     var index = depthIndex * 2;  
      
                     var distance = CalculateDistanceFromDepth(depthFrame[depthIndex], depthFrame[depthIndex + 1]);  
    }

    or something like this

    short[] rawDepthData = new short[depthFrame.PixelDataLength];
                depthFrame.CopyPixelDataTo(rawDepthData);
    int depth = rawDepthData[depthIndex] >> DepthImageFrame.PlayerIndexBitmaskWidth;

    Wednesday, June 13, 2012 6:11 PM

All replies

  • have you tried

    private static short CalculateDistanceFromDepth(byte first, byte second)
            {
                return (short)(first | second << 8);
            }

    and then

    for (int depthColumnIndex = 0; depthColumnIndex < 640; depthColumnIndex += 2)  
                 {  
                     var depthIndex = depthColumnIndex + (depthRowIndex * 640);  
       
                     var index = depthIndex * 2;  
      
                     var distance = CalculateDistanceFromDepth(depthFrame[depthIndex], depthFrame[depthIndex + 1]);  
    }

    or something like this

    short[] rawDepthData = new short[depthFrame.PixelDataLength];
                depthFrame.CopyPixelDataTo(rawDepthData);
    int depth = rawDepthData[depthIndex] >> DepthImageFrame.PlayerIndexBitmaskWidth;

    Wednesday, June 13, 2012 6:11 PM
  • Each Skeleton has a Position property, which describes the X, Y and Z coordinates in real-world coordinates.

    -Adam Smith [MSFT]

    Wednesday, June 13, 2012 6:35 PM
  • Each Skeleton has a Position property, which describes the X, Y and Z coordinates in real-world coordinates.

    -Adam Smith [MSFT]

    i thought x,y,z coordinates means something refering to the window and not real word...

    thanks, and also thanks to Thomasz

    Thursday, June 14, 2012 9:55 PM