# Kinect 3D to 2D World

• ### Question

• Hello,

OK so here is my issue at a basic level. I understand that the Kinect can return x,y,z values of a joint.

However I have noticed that if I move my leg further away from the Kinect therefore increasing the Z value, it seems to decrease the Y value making my foot for example appear higher up on screen. Now this is where my problem lies, I am trying to convert this 3D information to 2D information, so I would like my feet to remain on the same plane (y value) all the time, unless of course I actually raise my foot in the air.

Any idea's as to how I would go about achieving this? I understand this is quite a vague question but if you could maybe point me in the right direction that would be great!

Feel free to ask for more info if you don't feel as though I have provided enough info.

Cheers

Friday, March 23, 2012 7:43 PM

### All replies

• Hi Smithys!

Take a look at the Skeleton Viewer example to see drawing the skeleton in 2D.

Friday, March 23, 2012 7:45 PM
• Hi David,

Thanks for the quick response.

Do you mean the Sample Skeletal Viewer? If so I have looked at this, and again as you move your feet further backward or forwards on the Z axis the Y screen coordinates increase and decrease respectively. I would like so no matter how far away your feet are in Z space they remain the same on the Y axis.

Cheers

• Edited by Friday, March 23, 2012 7:52 PM
Friday, March 23, 2012 7:50 PM
• Are you moving your feet along the Kinect's Z axis, or along what you belive to be the "world"'s Z axis?

If the Kinect isn't parallel to the floor, these may not be the same thing.

Friday, March 23, 2012 7:56 PM
• What's the difference between the world Z axis and Kinect's Z axis, is this not the same direction?

Currently the Kinect is not parallel to the floor, it is approximately 1 meter off the floor and at a slight angle point downwards. How would this make a difference?

Thanks

Friday, March 23, 2012 8:31 PM
• What the Kinect considers Z is coming directly out of the front of the camera, at the angle you have it pointed.

What you consider Z is coming directly out of the front of your eyes, at the angle you're looking.  Or parallel to the floor.

It's relative not only to the angle in which your eyes (or the camera) are looking, but what you consider forward to be.

Reading about 3D camera tranformations will help explain it better I think.

Friday, March 23, 2012 8:52 PM
• Hi David,

I tried putting the camera parallel to the floor, meaning the angle was set to 0. I am still having the same issue in that the Y value will change depending on the depth of the joint.

What I would like is that no matter how far back or forward your joint is it should maintain the same Y value as it is on the floor.

What does the Kinect actually return in terms of X,Y,Z coordinates. They aren't exactly 3D coordinates as I wouldn't be having this issue, I am guessing it is just screen coordinates + how far away the joint is from the Kinect?

Any ideas?

Saturday, March 24, 2012 3:17 PM
• Apologies for coming back to this question, but I really am struggling with this.

I just cant get my head around why the Kinect changes the Y value if the depth changes.

I have researched this a fair bit and it seems as though people think the Kinect is returning real world 3D information.

From what I can see it isn't but instead it is returning pixel information as demonstrated by this change in the Y as depth changes. From my point of view the Y should always stay the same while a users feet are on the floor, is this not correct?

I feel like I am missing something here and I am probably just being an idiot.

Help please! :-(

Monday, March 26, 2012 11:42 AM
• Are you looking only at the SkeletonPoint values returned by Joint.Position? If so, you should not be seeing changes (other than minor fluctuations due to noise, of course) in the Y position of your foot when you slide it around on the floor - provided that the camera is aimed exactly parallel to the floor.

If instead you are using DepthImageFrame.MapFromSkeletonPoint to translate the skeleton coordinates into screen coordinates, then you should expect the foot's Y value in the resulting DepthImagePoint to increase as you move away from the camera. If you think about the perspective transformation that MapFromSkeletonPoint performs, this should make sense: As you move away from the camera, your skeleton fills less of the total area of the camera image. (Objects further away appear smaller than objects that are near.) From the pont of view of the camera image, your joints move closer to each other as you move away. The lower joints move "up" and upper joints move "down".

If you want true world coordinates, just keep your calculations in the SkeletonPoint space, and ignore DepthImagePoint.

John
K4W Dev

Monday, March 26, 2012 5:43 PM
• Hi John,

In a way I am doing both, I am calling the SkeletonToDepthImage method to display the skeleton over the RGB video. However I am actually storing the information of the skeleton in a txt file, the information I am simply saving here is the joint.Position.Y etc. Unless the SkeletonToDepthImage actually changes the joint position in some way by call by reference or something I don't see where I am going wrong.

In any case there will be cases where the Kinect will not be parallel to the floor, BUT I have maybe found a way to get the results I want.

I found this from another post:

`dist = floorplane.x*head.x+floorplane.y*head.y+floorplane.z*head.z+floorplane.wThis calculates the distance of a joint from the floor (in this case the users head), this is essentially what I want as no matter where the joint is in the Z axis the users feet should remain at 0 (roughly) when on the floor. I have done a quick test and it seems to work, will test again properly tomorrow as I don't have much room in here :-) The post was here btw: http://social.msdn.microsoft.com/Forums/en-US/kinectsdknuiapi/thread/b2d5e98c-8f43-450d-8b31-05c65a45e481`

Monday, March 26, 2012 8:12 PM