LoginSignup
8
9

More than 3 years have passed since last update.

OpenCV AI Kit (OAK-D) 試してみた@windows10

Last updated at Posted at 2021-01-04

初投稿です。

2020年8月にkickstarter OpenCV AI Kit でクラウドファウンディングされていたAIステレオカメラが届いたのでレポートです。

入手まで

2020年8月にkickstarter OpenCV AI Kit で$149+20(送料)でpledgeしました。
成立後に追加で、送料オーバ分16ドル税14.9ドルで、最終的に199.9ドルです。
今は、https://store.opencv.ai/で買えるようです。

image.png

構成物

写真の通り。
電源は5.0V-3.0Aで世界各国用のコネクタがついてます。
少なくともチュートリアルのデモレベルなら、電源なしのUSBバスパワーで動きます。

image.png

インストール作業

基本、同梱されたカードのURLに書かれたサイトのチュートリアルに従うのみです。
以下はwindows10のケースです。python3.9インストール済。

Depth AI Python API

  • PowerShellを管理者モードで開く

  • 実行ポリシーを設定する

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
  • chocoでまとめてインストール
choco install cmake git python pycharm-community -y
  • pipでdepthai入れる
python -m pip install depthai

depthAI デモの準備

  • depthaiを適当なフォルダにclone
git clone https://github.com/luxonis/depthai.git
cd depthai
  • 必要ライブラリのチェック用スクリプトを実行する ※公式だと仮想環境での実行を推奨
python install_requirements.py

depthAI デモの実行結果

  • demoスクリプトを実行する (要カメラ接続)
python depthai_demo.py

image.png

mobilenetの20class分類で検出した物体までの距離が表示されます。
Zが奥行方向でしょうか。

画像は50cm程度手前からの撮影です。
人形(person)までの距離はまあまあですが、画面上のバイクまでの距離は誤差大です。
近距離すぎて視差が取れていないのかも。

DEPTH画像

先程のdepthai_demo.pyにオプションを付与することでdepth画像の出力も可能です。

python .\depthai_demo.py -s metaout depth_raw -bb

image.png

  • 同画角の可視画像

image.png

視差は、一般的なステレオでよく見る感じで、まあまあ取れてそうです。

物体検出の精度は、スピーカーをテレビモニタと間違っているように割と微妙。
OpenVINOのその他のモデルを使うチュートリアルもあるので、差し替えれば簡単に良くなるとは思っています。

まとめ

動くところまでは簡単に確認できました。

測距離の誤差要因は、パッシブステレオの特性、アルゴリズム的なもの、キャリブレーション不足、など色々考えられます。
今後はチュートリアルを進めつつ、サンプルコードの中身も読んだ上で、性能を引き出せるようにしていきます。

参考文献

https://docs.luxonis.com/en/latest/pages/api/
https://docs.luxonis.com/en/latest/pages/tutorials/pretrained_openvino/

8
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
9