python-3.xkinect-v2

Kinect V2 vs PyKinect2 : difference between depth image


I'm currently working on the kinect V2 to have access to the depth image. I use the library in python PyKinect2 that help me to have this images.

My first problem is :

-> I run KinectStudio 2, and look for the depth image, i look for the implementation of the PyKinect2 and i have a different image. How that could be possible ?

-> To have access to the depth of specific point called X(x,y), I use the method MapColorFrameToDepthSpace, and i manage to have some coordinates that will help me to have the distance on the depth frame. Is this assertion is correct ?

to get the depth image :

 def draw_depth_frame(self, frame):
     depth_frame = frame.reshape((424, 512,-1)).astype(np.uint8)
     return depth_frame

the image from kinect 2 :

Kinect Image Depth from Kinect Studio

the image from kinect 2 with color ramp :

the image from kinect 2 with color ramp

the image from pyKinect 2

pyKinect 2

Sincerely,


Solution

  • I found my mistake about this,

    When i use this

    depth_frame = frame.reshape((424, 512,-1)).astype(np.uint8)
    

    This line is in fact wrong.

    The depth is not mapped on a uint8, but on a uint16.

    By performing the reshape, i have a "lost" of information about the distance, i have only value as 255, so not very useful.

    example: 1600 as a distance, was considered as 255, and because of this line, it gives me the third depth image on my previous post. SO the correction is simply something :

    depth_frame = frame.reshape((424, 512,-1)).astype(np.uint16)