PyKinect2-Mapper-Functions icon indicating copy to clipboard operation
PyKinect2-Mapper-Functions copied to clipboard

when using function depth_point_2_world_point(), a problem will occur.

Open jdyjjj opened this issue 3 years ago • 3 comments

Hello. When I use the function depth_point_2_world_point(), I find there may be a bug. As you can see in these picture, no matter what the input coordinates are, the output X and y change all the time, but the Z value remains unchanged at 20.48. 49d2da68841a70d762ae0f4d8e15aae a012e2e4721148707a82862be6f7036 image

I really want to know why this problem occurs. Thanks very much.

jdyjjj avatar May 29 '22 03:05 jdyjjj

I cannot say for sure what is going on, as when calling the depth_point_2_world_point function I just call the Kinect's transformation function MapDepthPointToCameraSpace and return the values, so I cannot know for sure what this function does internally.

But what I know is that the depth point is actually the z (distance from the Kinect Sensor) so you can actually get the z value like this:

if (int(depth_y) * 512 + int(depth_x)) < 512 * 424: world_z = float(depth[int(depth_y) * 512 + int(depth_x)]) # mm

where depth is just:

depth = kinect.get_last_depth_frame()

KonstantinosAng avatar May 29 '22 09:05 KonstantinosAng

image

I happened to get the same problem, if i just get the depth_z it can be more accurate but it also isnt that accurate as you can see below

image

the image above is the output of color x,y and depth_z, noted that the object is a person's face mask and it's not moving that much considering the change in the depth_z is huge, and one more thing the object that's detected isnt 5 or 6 meters away, instead it's just about 1,5 meters away from the kinect.

Yudh0B avatar Oct 13 '22 13:10 Yudh0B

The Kinect's sensor is very sensible, you cannot simply trust the raw data of Kinect, you have to apply a filter (most of the time Kalman filters) to smooth and reduce the Kinect's noise.

KonstantinosAng avatar Oct 14 '22 17:10 KonstantinosAng