How to use python get distance in depth image using realsense D435?

  • 0
  • Pump00:00

Camera: realsense D435

Operating system: Ubuntu 16.04

Language: python

I want to get the distance of a point in image. If I use the aligned image that provided in github, there are many holds and the converted depth pixel to metric value will become 0, 0, 0.

What my idea is:

  1. depth image inpainting

  2. get depth value from depth image

  3. using depth value to calculate distance

Following get distance example in GitHub, the code is:

depth = get_depth_at_pixel(depth_frame, pixel_x, pixel_y)
x, y, z = convert_depth_pixel_to_metric_coordinate(depth, pixel_x, pixel_y, camera_intrinsics)

I found that the output depth is float.

Now, I can get value from depth image, which is in numpy.uint16.(e.g. depth_image[200][100] is 300)

  1. Can I convert depth image to double/float, so that I can get the distance?

  2. If yes, How can I convert depth image to double/float value?

Default Asked on February 7, 2020 in Programming,   Python.
Add Comment
  • 0 Answer(s)
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.