A wrapper program for handling Intel's Depth camera Realsense in Python. With Python, you can easily get Realsense images and depth information.
It is very convenient when you want to acquire depth information after image recognition by deep learning using Python with Realsense.
For X86 PCs, you can easily install it with pip install pyrealsense
, but with Jetson Nano on Arm, you need to devise something, so I will briefly introduce the setup method and how to use it.
In this article, Realsense assumes D435.
When using PyRealsense with Jetson Nano, you need to build the Realsense driver, Librealsense, from source.
Install the required libraries.
$ sudo apt-get update
$ sudo apt-get install -y cmake
Note: I haven't set it up from scratch, so maybe there are other libraries I need. I will add it as soon as it becomes clear.
If you would like to carry out deep learning, please refer to the following article.
Deep learning with Jetson Nano
Download (git clone) Librealsense with the following command, build and install it.
$ cd && git clone https://github.com/IntelRealSense/librealsense.git
$ cd librealsense
$ mkdir build
$ cd build
$ cmake ../ -DBUILD_PYTHON_BINDINGS:bool=true
$ make -j4
$ sudo make install
Use the following command to set up udev to recognize Realsense via USB.
$ cd ~/librealsense
$ ./scripts/setup_udev_rules.sh
Add a path.
$ export PYTHONPATH=$PYTHONPATH:/usr/local/lib
You must add the pass every time. If it is troublesome, add the above command to ~ / .bashrc
.
Let's run the sample program.
$ cd ~/librealsense/wrappers/python/examples
$ python3 align-depth2color.py
As shown below, I was able to get the color image and depth information of Realsense with Python.
If you look at the source code, you can understand how to use it to some extent. The document is as follows.
How to use Intel Realsense D435 with Jetson Nano (ROS compatible)
Recommended Posts