kobot

3D処理とか

RealsenseをPythonで起動する

RealseneseをPythonで使用してみようと思いメモ。

環境構築

<使用環境>
OS: Ubuntu 16.04  
Realsense SDK version: 2.19.0  
Python version : 3.5.2  

既に取り組まれている方の情報を参考に環境構築を行った。 cmake-gui上で「BUILD PYTHON BINDINGS」の項目をONにしビルド後、make install.

公式githubよりPython wrapper https://github.com/IntelRealSense/librealsense/tree/master/wrappers/python

実行

参考URLをもとにPythonでRealsense起動できることを確認できた。C++で書かなくて良いのは楽ですね。 Pythonスクリプトと同じディレクトリなどにPython Wrapperビルド時に生成された.soファイルを準備する必要あり。自身の環境だと下記.soファイルが必要だった

f:id:kobot30:20191020131122p:plain

参考:Pythonではじめる3Dセンシング!!

http://mirai-tec.hatenablog.com/entry/2018/07/29/150902

Warning

とりあえず動くものの、実行時に下記の様な警告が出てくる…。pybindのバージョン関連?

/usr/lib/python3.5/importlib/_bootstrap.py:222: FutureWarning: pybind11-bound class 'pyrealsense2.processing_block' is using an old-style placement-new '__init__' which has been deprecated. See the upgrade guide in pybind11's docs. This message is only visible when compiled in debug mode.
  return f(*args, **kwds)
/usr/lib/python3.5/importlib/_bootstrap.py:222: FutureWarning: pybind11-bound class 'pyrealsense2.filter' is using an old-style placement-new '__init__' which has been deprecated. See the upgrade guide in pybind11's docs. This message is only visible when compiled in debug mode.