omnidirectional-viewer-sample-using-opencv icon indicating copy to clipboard operation
omnidirectional-viewer-sample-using-opencv copied to clipboard

OpenCVを利用した360度画像の簡易ビューア

omnidirectional-viewer-sample-using-opencv

OpenCVを利用した360度画像の簡易ビューアです。

https://user-images.githubusercontent.com/37477845/181903194-a6ce5e2f-faa5-47e8-a0e7-ab705e1bbec3.mp4

Requirement

  • opencv-python 4.5.3.56 or later

Demo

デモは2種類あります。

  1. コマンドライン操作で画像を変換し保存するデモ(01_simple_image_convert.py)
  2. マウス操作でピッチ・ヨー・ズームの視点を操作するデモ(02_omnidirectional_viewer.py)

1. コマンドライン操作で画像を変換し保存するデモ(01_simple_image_convert.py)

python 01_simple_image_convert.py
パラメータ
  • --roll
    ロール角の指定
    デフォルト:0
  • --pitch
    ピッチ角の指定
    デフォルト:0
  • --yaw
    ヨー角の指定
    デフォルト:0
  • --viewpoint
    半径1の球体に正規化した際のX軸視点位置
    デフォルト:-1.0
  • --imagepoint
    半径1の球体に正規化した際のX軸投影位置
    デフォルト:1.0
  • --sensor_size
    半径1の球体に正規化した際の投影幅
    デフォルト:0.561
  • --width
    出力画像の横幅
    デフォルト:640
  • --width
    出力画像の縦幅
    デフォルト:360
  • --image
    入力画像パス
    デフォルト:sample.png
  • --output
    出力画像パス
    デフォルト:output.png

2. マウス操作でピッチ・ヨー・ズームの視点を操作するデモ(02_omnidirectional_viewer.py)

ウィンドウ上でマウス左ドラッグでピッチ・ヨー操作、ホイールでズーム操作が出来ます。
※ロール操作には対応していません

python 02_omnidirectional_viewer.py
パラメータ
  • --viewpoint
    半径1の球体に正規化した際のX軸視点の初期位置
    デフォルト:-1.0
  • --imagepoint
    半径1の球体に正規化した際のX軸投影の初期位置
    デフォルト:1.0
  • --sensor_size
    半径1の球体に正規化した際の投影幅
    デフォルト:0.561
  • --width
    出力画像の横幅
    デフォルト:640
  • --width
    出力画像の縦幅
    デフォルト:360
  • --image
    入力画像パス
    デフォルト:sample.png
  • --movie
    入力動画パス ※指定時はimageオプションより優先
    デフォルト:指定なし

Author

高橋かずひと(https://twitter.com/KzhtTkhs)

License

omnidirectional-viewer-sample-using-opencv is under MIT License.

また、水中の360度動画は、360あーる・てぃー・しー様の
浅瀬の水中を色鮮やかな魚が泳ぐ沖縄県恩納村恩納 No.1」を利用しています。