Kinect depth conversion from mm to pixels

2019-06-10 17:16发布

问题:

Does anybody knows how many pixels correspond for each millimeter of depth value in images taken from kinect for xbox360? I'm using the standard resolution and settings...

Thanks!

回答1:

1 pixel corresponds to a number of millimiters that depends on the depth value of that pixels (i.e. its level of gray).

The simplest way you can get the distance between two pixels in a depth image is to convert those pixels (which are expressed in Depth Space) in real world coordinates (i.e. in Skeleton Space)1. Then, you can calculate the distance between those points using a common euclidean distance formula.

So if you have two pixels P1 and P2, with depth values respectively equal to D1 and D2, you can proceed as follows:

DepthImagePoint dip1 = new DepthImagePoint();
dip1.X = P1.x;
dip1.Y = P1.y;
dip1.Depth = D1;
DepthImagePoint dip2 = new DepthImagePoint();
dip2.X = P2.x;
dip2.Y = P2.y;
dip2.Depth = D2;
SkeletonPoint sp1 = CoordinateMapper.MapDepthPointToSkeletonPoint(DepthImageFormat.Resolution640x480Fps30, dip1);
SkeletonPoint sp2 = CoordinateMapper.MapDepthPointToSkeletonPoint(DepthImageFormat.Resolution640x480Fps30, dip2);

double dist = euclideanDistance(sp1, sp2);


1 See Coordinate Spaces for more information.