Items with no label
3335 Discussions

How to use pyrealsense2

ycao6
New Contributor I
14,720 Views

I just figured out that "pip install pyrealsense2" can allow me to get the stream from my D415/435 camera in python code the day before yesterday. but actually I do not know how to use it.

There is only some examples in the Python wrapper of RealSense SDK 2.0 , but maybe it's not so comprehensive.

Is there a tutorial or something to guide me when I try to use pyrealsense2 in my own project? any idea?

https://pypi.org/project/pyrealsense2/# history pyrealsense2 · PyPI

0 Kudos
1 Solution
MartyG
Honored Contributor III
9,715 Views

Intel have been increasing their tutorial support for Python in the past month. You can find guides at the link below using Intel's new 'Jupyter' notebook system.

https://github.com/IntelRealSense/librealsense/tree/jupyter/notebooks librealsense/notebooks at jupyter · IntelRealSense/librealsense · GitHub

I would recommend starting with the 'distance to object' guide, which explains how to create RGB and depth streams and combine them together, as well as do object detection.

Also, here is a small sample script that can be used immediately after installation with $ pip install pyrealsense2

View solution in original post

0 Kudos
8 Replies
MartyG
Honored Contributor III
9,716 Views

Intel have been increasing their tutorial support for Python in the past month. You can find guides at the link below using Intel's new 'Jupyter' notebook system.

https://github.com/IntelRealSense/librealsense/tree/jupyter/notebooks librealsense/notebooks at jupyter · IntelRealSense/librealsense · GitHub

I would recommend starting with the 'distance to object' guide, which explains how to create RGB and depth streams and combine them together, as well as do object detection.

Also, here is a small sample script that can be used immediately after installation with $ pip install pyrealsense2

0 Kudos
ycao6
New Contributor I
9,715 Views

OK! Thank you for the recommendation !

0 Kudos
ycao6
New Contributor I
9,715 Views

emmmm... thank you~ but the link you send me is not vaild, I can not get the page ..

0 Kudos
MartyG
Honored Contributor III
9,715 Views

The provider of the broken link has changed the link in their original message to point to a different location. Here's the new link.

https://github.com/daavoo/pyntcloud GitHub - daavoo/pyntcloud: pyntcloud is a Python library for working with 3D point clouds.

0 Kudos
ycao6
New Contributor I
9,715 Views

Thank you for your help~!

0 Kudos
DMerc6
Beginner
9,715 Views

MartyG- I tried your example code here and it produces an error:

Exception has occurred: TypeError

get_distance(): incompatible function arguments. The following argument types are supported: 1. (self: pyrealsense2.pyrealsense2.depth_frame, x: int, y: int) -> float Invoked with: , 640.0, 360.0

File "/home/snuc/box/demo2.py", line 11, in dist = depth.get_distance(width / 2, height / 2)

0 Kudos
MartyG
Honored Contributor III
9,715 Views

I have not come across that error before, unfortunately. My first recommendation would be to check the instructions in the front page of the Python wrapper for SDK 2.0 to make sure that your Pyrealsense installation is set up correctly.

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

If that does not work, it would be best to post a help request to the RealSense GitHub, where the RealSense developers and engineers reside. You can do so by visiting the link below and clicking on the 'New Issue' button to post a question.

https://github.com/IntelRealSense/librealsense/issues Issues · IntelRealSense/librealsense · GitHub

0 Kudos
Reply