### Google Colaboratoryのパワーで<br />点群可視化をワンストップ化(lasto3dtiles + Cesium)
Kunihiko MIYOSHI (@colspan)
[slide](https://hackmd.io/@colspan/one-stop-3dtiles-on-GoogleColab)
---
## About me
- 本業 [製造業向け外観検査ソリューション](https://preferred.jp/en/projects/visual-inspection/)の開発・法人営業
- データ可視化 https://colspan.github.io/seseki_viewer/
- 点群データの利活用に関する研究
<img src="https://colspan.github.io/seseki_viewer/img/sample_around_tokyo.png" width="30%">
<img src="https://colspan.github.io/seseki_viewer/img/sample_hokkaido.png" width="30%">
---
![](https://i.imgur.com/9uX24Ai.jpg)
---
## Summary
- 点群データが身近になった
- 点群データのデファクトスタンダード([3dtiles](https://github.com/AnalyticalGraphicsInc/3d-tiles))の簡易な変換ライブラリ([lasto3dtiles](https://github.com/colspan/lasto3dtiles))を公開した
- 無償のクラウド環境(Google Colaboratory)でも大規模な点群データの圧縮処理を行えることを確認した
- 点群可視化は感動する
---
## Agenda
- DEMO on Google Colaboratory
- オープンデータな点群データ
- 点群データ可視化の問題
- 妄想する理想郷を目指す
- 3dtiles変換ライブラリの自作
- Google Colaboratory上で動かす
- 残課題
---
## DEMO on Google Colaboratory
- [lasto3dtiles demo](https://colab.research.google.com/drive/1zekaXKdcGFl6mlwr0E-5Wa14U7_fcPAB)
---
## オープンデータな点群データ
- [My City Construction](https://mycityconstruction.jp/)
- [静岡ポイントクラウドデータベース](https://pointcloud.pref.shizuoka.jp/)
---
## 点群データ可視化の問題1 :fearful:
- データ形式自体のハードルが高い
- 容量がでかい
- 計算量がでかい
- 3次元データの取り扱いが大変
- 計算量的にワークステーション必須
---
## 点群データ可視化の問題2 :fearful:
- 閲覧方法の決定打がない
- 基本的に有償ソフトウェア以外に選択肢なし
- 無償ソフトウェアはインストールや操作が大変
- 開発言語がバラバラで不安定
- 地図と重畳表示しようにも緯度経度との対応がまちまち
---
## 妄想する理想郷を目指す :tada:
- Webブラウザでさくっとデータ指定から可視化まで終わる → やってみた
- 計算機 : クラウド(Google Colaboratory)
- データ : 静岡県のPCD
- 可視化 : Cesium
- データ変換 : 3dtilesライブラリを自作([lasto3dtiles](https://github.com/colspan/lasto3dtiles))
---
## 3dtiles変換ライブラリの自作<br /> lasto3dtiles
- 1つの言語(Python)かつインストールが容易
- 点群を読み込む : laspy
- 小さくする(間引く・サンプリングし直す) : Open3D
- 緯度経度との対応点をもとに変換行列を作成する(後述)
- 3dtiles形式で出力する(スクラッチ)
- luigiでワークフロー化&コマンド化
---
## LASファイルの座標
- 計測時のオレオレ座標
- X, Y, Z, R, G, B, I
- 右手系・左手系のどちらかは業者次第
---
## 3dtilesの座標
- [3dtiles specification](https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification)によるとWGS84
<img src="https://i.imgur.com/0784Aro.png" width="40%">
- 画像出典 : http://earth-info.nga.mil/GandG/publications/tr8350.2/TR8350.2-b/Sections%201-5.pdf
---
## 対応点作成
- Leafletで緯度経度Pickerを実装
<img src ="https://i.imgur.com/tK6L2le.jpg" width="50%">
- 対応点が3つ以上あれば変換行列を計算できる
- https://github.com/colspan/pcd-open-datasets にまとめてます
---
## Google Colaboratory上で動かす :cloud:
- `apt` / `pip` コマンドで必要な環境を構築する
- 点群データをダウンロードする
- 点群データをダウンサイジング&3dtiles変換する
- 3dtilesを配信するためにCORSサポートが可能なHTTPサーバを公開する(ngrok)
- Cesiumで表示する(cesiumpy)
---
## 残課題
- 対応点取得ツールの改善
- 起動・操作が大変 → Jupyter Widgetにしたい
- 変換行列の対応点に高さを考慮していない(座標系考慮重要)
- 点群データ配信側の料金がかさみそう
- Cesiumpyが最新のCesiumに追いついていない
- 今日のもくもくでPR出す
---
### Thank you! :sheep:
- [GitHub](https://github.com/colspan)
- [Twitter](https://twitter.com/colspan)
{"metaMigratedAt":"2023-06-15T01:00:54.742Z","metaMigratedFrom":"YAML","title":"Google Colaboratoryのパワーで点群可視化をワンストップ化(lasto3dtiles + Cesium)","breaks":"true","description":"View the slide with \"Slide Mode\".","contributors":"[{\"id\":\"dbd9ab05-8883-4393-af62-1d92f465ab6e\",\"add\":4438,\"del\":3686}]"}