2

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?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
shadow dk
  • 475
  • 1
  • 4
  • 15

1 Answers1

2
depth_float32 = depth.astype(np.float32)
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
fisakhan
  • 704
  • 1
  • 9
  • 27