2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

C++ でサクッと surface registration(global matching, non-rigid ICP) するライブラリやコードのメモ

Last updated at Posted at 2020-03-07

背景

  • メッシュの surface registration(e.g. 顔スキャン点群をマッチング, 多視点画像から三次元復元)をやりたい
    • 自前実装するにしても, リファレンスとなるものがほしい
  • Android, iOS などでも動かしたいので, cross platform のものがほしい
    • PCL や OpenCV とか使うのはビルド面倒でつらい

C++, Python あたりで顔メッシュ処理のメモ
https://qiita.com/syoyo/items/ddff2c6bdcec2e5c96a4

剛体系

Super4pcs

OpenCV off であれば, Eigen だけ(自動ダウンロード)でビルドできるはず.

に移行しました.

sparseicp

Eigen と nanoflann を使っています.
動きはするようですが, どうも結果が違う..?

non-rigid ICP 系

dlib は自前でコンパイルして, そのパスを find_package(dlib) に渡してあげるといいでしょう.

アルゴリズムが原因なのか, コードの書き方が原因なのかは不明ですが, マルチスレッドで処理すると効率がわるくなることがわかりました. どうも NonRigidICP が利用している trimesh2 の omp コードがよく無いのかもです.

TR 1950X でマルチスレッド処理させて, 10 iteration で 1363 秒(22 分ほど)かかりました(AtA and Atb 行列の生成でとても時間がかかっている).
OMP_NUM_THREADS=1 で 1 コアだと 215 秒くらいでした. 2 スレッドにしても性能かわりませんでした(1 スレッドより多少悪くなる).

とりあえずは OMP_NUM_THREADS=1 で実行させましょう.

イテレーションごとに .ply メッシュを生成してくれますので, 適当なタイミングで強制終了させるのも手です.

ply メッシュは meshlab などで確認できます.

その他参考

サクっとというわけには行かないが, 結果が良さげなもの.

https://github.com/YuePanEdward/GH-ICP
liblas + PCL 1.7+ 利用
(Ubuntu 18.04 なら apt で入る)

#include <pcl/Vertices.h> を追加する必要あり.

TODO

  • pl917/NonRigidICP のコードを参考にして自前 non-ridid ICP 実装する
  • Eigen を置き換えるライブラリを開発したい.
  • non-rigid pointset registration: Coherent Point Drift について調べる
2
0
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
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?