Items with no label
3338 Discussions

How to use pyrealsense2

ycao6
Nouveau contributeur I
21 363 Visites

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 Compliments
1 Solution
MartyG
Contributeur émérite III
16 358 Visites

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

Voir la solution dans l'envoi d'origine

0 Compliments
8 Réponses
MartyG
Contributeur émérite III
16 359 Visites

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 Compliments
ycao6
Nouveau contributeur I
16 358 Visites

OK! Thank you for the recommendation !

0 Compliments
ycao6
Nouveau contributeur I
16 358 Visites

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

0 Compliments
MartyG
Contributeur émérite III
16 358 Visites

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 Compliments
ycao6
Nouveau contributeur I
16 358 Visites

Thank you for your help~!

0 Compliments
DMerc6
Débutant
16 358 Visites

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 Compliments
MartyG
Contributeur émérite III
16 358 Visites

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 Compliments
Répondre