Items with no label
3338 Discussions

get_distance pyrealsense2 error!!

NeuroGalaxy
Beginner
3,818 Views

I am using pyrealsense2 library for Intel realsense camera d435. I was trying to get the distance to an object using the function depth.get_distance().

However I am getting this following error: "get_distance(): incompatible function arguments. The following argument types are supported:

  1. (self: pyrealsense2.pyrealsense2.depth_frame, x: int, y: int) -> float

Invoked with: <pyrealsense2.pyrealsense2.depth_frame object at 0x0000017D60EC4A08>, 640.0, 360.0"

 

Please help if you know why this is happening.

0 Kudos
1 Reply
MartyG
Honored Contributor III
2,847 Views

Are you using the example program on the bottom of the front page of the Python wrapper, please?

 

https://github.com/IntelRealSense/librealsense/tree/master/wrappers/python

 

An alternate approach to getting the distance to an object in Pyrealsense2 is with the 'distance_to-object' tutorial that Intel has published.

 

https://github.com/IntelRealSense/librealsense/blob/jupyter/notebooks/distance_to_object.ipynb

 

0 Kudos
Reply