How to use Realsense's Python wrapper PyRealsense with Jetson Nano

realsense_align_depth.png

What is PyRealsense (pyrealsense2)?

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.

Build Librealsense from source

When using PyRealsense with Jetson Nano, you need to build the Realsense driver, Librealsense, from source.

Installation of required libraries

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

Build and install Librealsense

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

Udev settings

Use the following command to set up udev to recognize Realsense via USB.

$ cd ~/librealsense
$ ./scripts/setup_udev_rules.sh

Path setting

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.

Operation check

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.

realsense_align_depth.png

If you look at the source code, you can understand how to use it to some extent. The document is as follows.

PyRealSense’s documentation

reference

Related article

Jetson Nano related tips

How to use Intel Realsense D435 with Jetson Nano (ROS compatible)

Recommended Posts

How to use Realsense's Python wrapper PyRealsense with Jetson Nano
Python: How to use async with
How to use FTP with Python
How to install OpenCV on Jetson Nano Python
How to use tkinter with python in pyenv
python3: How to use bottle (2)
[Python] How to use list 1
How to use Python argparse
Python: How to use pydub
[Python] How to use checkio
[Python] How to use input ()
How to use Python lambda
[Python] How to use virtualenv
python3: How to use bottle (3)
python3: How to use bottle
How to use Python bytes
How to use python interactive mode with git bash
[Python] How to use Pandas Series
How to use Requests (Python Library)
How to use SQLite in Python
How to use virtualenv with PowerShell
How to get started with Python
[Python] How to use list 3 Added
How to use Mysql in python
How to use OpenPose's Python API
How to use ChemSpider in Python
Python: How to use pydub (playback)
How to use PubChem in Python
How to calculate date with python
How to use python zip function
[Python] How to use Typetalk API
How to use python put in pyenv on macOS with PyCall
[Python] Explains how to use the format function with an example
How to use an external editor for Python development with Grasshopper
How to use Python with Jw_cad (Part 2 Command explanation and operation)
[Python] Summary of how to use pandas
[Introduction to Python] How to use class in Python?
How to install and use pandas_datareader [Python]
How to use ManyToManyField with Django's Admin
How to use OpenVPN with Ubuntu 18.04.3 LTS
How to use Cmder with PyCharm (Windows)
[python] How to use __command__, function explanation
How to work with BigQuery in Python
[Introduction to Python] Let's use foreach with Python
[Python] How to use import sys sys.argv
How to use Ass / Alembic with HtoA
How to use Japanese with NLTK plot
How to do portmanteau test with python
[Python] Organizing how to use for statements
Memorandum on how to use gremlin python
How to display python Japanese with lolipop
[Python2.7] Summary of how to use unittest
How to use jupyter notebook with ABCI
python: How to use locals () and globals ()
How to use __slots__ in Python class
How to use CUT command (with sample)
How to use "deque" for Python data
How to enter Japanese with Python curses
How to use Python zip and enumerate
[Python] Understand how to use recursive functions
Summary of how to use Python list