[PYTHON] Tips for using Realsense SR300 on MacBook in 2020

When I tried to run SR300, which is a slightly older version of Realsense, on a MacBook, I stumbled a little, so it's a memo.

The summary is as follows.

  1. Use librealsense of Latest Legacy Release
  2. install pyrealsense with different build flags in setup.py
  3. Use a USB power supply with sufficient power

1. Use librealsense of Latest Legacy Release

The latest version of the SDK may fail to connect to a Realsense device with the following error:

Could not open device command transfer failed to execute bulk transfer, error: RS2_USB_STATUS_TIMEOUT

Therefore, use the following old version SDK.

https://github.com/IntelRealSense/librealsense/tree/v1.12.1

After cloning, you can cmake like the latest version. Don't forget to open XCode after cmake, build with ʻinstall` target and have librealsense installed!

2. install pyrealsense with different build flags in setup.py

For Python integration, use this old version.

https://github.com/toinsson/pyrealsense

If you try to install with pip, the build will moss in the latest version of XCode environment. The cause is that the reference destination of stdlib of XCode has changed, so I will specify it again in setup.py.

setup.py


    module = cythonize(
        [Extension(
            name='pyrealsense.rsutilwrapper',
            sources=["pyrealsense/rsutilwrapper.pyx", "pyrealsense/rsutilwrapperc.cpp"],
            libraries=['realsense'],
            include_dirs=inc_dirs,
            library_dirs=lib_dirs,
            language="c++",
            extra_compile_args=["-O3", "-stdlib=libc++"], #Add here
            extra_link_args=["-stdlib=libc++"], #Add here
            )])

Once edited, you can install it with python setup.py install.

3. Use a USB power supply with sufficient power

Since the depth sensor consumes a lot of power, a cheap USB-C conversion connector may start up and drop immediately.

Make sure to use something with sufficient power, such as a genuine Apple conversion connector.

that's all. Hope it helps someone!

Recommended Posts

Tips for using Realsense SR300 on MacBook in 2020
Tips for using ElasticSearch in a good way
[TouchDesigner] Tips for for statements using python
Tips for using Selenium and Headless Chrome in a CUI environment
Notes for using OpenCV on Windows10 Python 3.8.3.
Notes on nfc.ContactlessFrontend () for nfcpy in python
Documents on approaches for embedding in ARM
Windows → linux Tips for bringing in data
Tips for dealing with binaries in Python
Precautions when using for statements in pandas
Tips for using python + caffe with TSUBAME
Tips for making interactive bots on LINE
Tips for building large applications in Flask
Notes for using python (pydev) in eclipse
Tips for making small tools in python
Notes on using code formatter in Python
Notes on using dict in python [Competition Pro]
Tips for hitting the ATND API in Python
Notes for using TensorFlow on Bash on Ubuntu on Windows
View images in OpenCV from Python using an external USB camera on your MacBook
Initial settings for using Python3.8 and pip on CentOS8
Directory structure for test-driven development using pytest in python
[Heroku] Memo for deploying Python apps using Heroku on Windows [Python]
Dry-run sql query using psycopg2 on Redshift in Python
Command line collection for using virtual environment in Anaconda