ssii2012 tutorial nonrigid registration and pcl
DESCRIPTION
広島大学玉木先生とわたくし林による、SSII2012チュートリアル「2D&3Dレジストレーション」の、わたしの担当分スライドです。TRANSCRIPT
![Page 1: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/1.jpg)
1
![Page 2: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/2.jpg)
非剛体変形を考慮した 「非剛体レジストレーション」
(剛体)スキャンデータのレジストーション
n 通常は剛体レジストレーションで済む。
(非剛体)変形を考慮する理由
n スキャナのキャリブレーション誤差:対象が大きいほど回避不可
n スキャン対象が可変性の形状:プラスチックや弾性の物体など
n 特に人体、動物:
• 複数回カメラ視点を変えてスキャンする必要(大きい対象ほど)。
• 撮影中に同じ姿勢を保つのが難しい(体動揺)。
2
![Page 3: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/3.jpg)
全身ボディスキャナー スペースビジョン社 製 ポータブルボディスキャナ(2秒で撮影)
3 http://www.space-vision.jp
![Page 4: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/4.jpg)
人体スキャンの 非剛体レジスレーション
× 人体をスキャンした3D point cloud データ: p データ欠落・視点の変化により飛び・重なり具合が不定。 p 各フレーム・カメラ間での非剛体変形(体動揺や姿勢の変化による変形)。
p Point cloudのサンプリング率が均一でない。
非剛体の人体データ間のレジストレーションは、 ICPアルゴリズムなどの剛体レジストレーションではうまく収束できない。
非剛体レジストレーション 4
![Page 5: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/5.jpg)
可変性スキャンの 非剛体レジストレーション
× 元データ(source)に非剛体変形が起こったデータ(target)への対応付け。
× 変形モデルによる非線形エネルギー最小化。
× データの性質ごとに2つの方法: ① 「データとデータ間」(複数視点 or 複数フレームの合体) ② 「データとモデル間」(モデルへのフィッティング)
× マーカーを拘束条件にするかどうかで2つの方法: ① 数10~数100のマーカー位置を初期値に実行 ② マーカー無しにPoint Cloud/Meshだけで直接実行
5
![Page 6: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/6.jpg)
ソース(Source) 青色のスキャン
ターゲット(Target) 白色のスキャン
非剛体レジスレーション[Hao Li ’08 ※]
問題:ソースとターゲットを対応付けしたい ※ “Global Correspondence Optimization for Non-Rigid Registration of Depth Scans” Hao Li et al. , Eurographics Symposium on Geometry Processing 2008. 6
![Page 7: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/7.jpg)
どう対応づける?
7
![Page 8: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/8.jpg)
茶色の部分:重なり無し(対応が作れない) それ以外:共通していて対応付けできる部分 (ただし非剛体変形を含んでいる:剛体ICPは収束しない)
重なり部分無し
8
![Page 9: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/9.jpg)
茶色の部分:重なり無し(対応が作れない) それ以外:共通していて対応付けできる部分 (ただし非剛体変形を含んでいる→剛体ICPでは収束しない)
重なり部分無し
対応部分
9
![Page 10: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/10.jpg)
非剛体レジストレーションの問題 ソース(Source)
10
![Page 11: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/11.jpg)
非剛体レジストレーションの問題
ターゲット(Target)
ソース(Source)
11
![Page 12: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/12.jpg)
非剛体レジストレーションの問題
ターゲット(Target)
ソース(Source)
12
![Page 13: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/13.jpg)
非剛体レジストレーションの問題
ターゲット(Target)
ソース(Source)
13
![Page 14: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/14.jpg)
非剛体レジストレーションの問題
ターゲット(Target)
ソース(Source)
14
![Page 15: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/15.jpg)
難しさ
非剛体変形
15
![Page 16: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/16.jpg)
難しさ
非剛体変形
データ欠落 16
![Page 17: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/17.jpg)
難しさ 対応の曖昧性
17
![Page 18: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/18.jpg)
難しさ 対応の曖昧性
対応度が 微妙
18
![Page 19: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/19.jpg)
非剛体レジストレーションの戦略
× 剛体ICPでは収束しない→非剛体変形による正則化項を導入。
× 正則化(変分法)によりエネルギー最小化によるパラメータ最適化(=剛体移動度(match)と、正則化項の非剛体変形度(deform)の最適化)を行う。
× 反復的に剛体ICPを行い、剛体ICPが一旦収束するごとに正則化エネルギーを変化(つまり変形モデルで非剛体変形)させることで、反復的に非線形エネルギー最小化を行う。
全体の形状対応度 :剛体ICP的エネルギー
E(f) = Ematch(f) + Ereg(f)
変形モデルによる正則化 :非剛体変形のエネルギー
19
![Page 20: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/20.jpg)
非剛体レジストレーションの最適化
ソースとターゲットを変形しながら剛体ICP的に近づけて行く
1:重なり部分検出
2:対応付け
正則化を解除
3:非剛体変形
ある値までエネルギーが収束したら正則化を一度緩める
↵reg ! 0
E(f) = ↵matchEmatch(f) + ↵regEreg(f)
20
※2つを同時に最適化する 戦略も当然ある。
![Page 21: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/21.jpg)
手順1 :重なり部分の検出
21
![Page 22: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/22.jpg)
手順2: 対応づけ(Closest Point)
22
![Page 23: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/23.jpg)
手順3: 非剛体変形
23
変形モデルに沿った 非剛体変形を実施
![Page 24: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/24.jpg)
手順1-3後:レジストレーション この「一時的レジストレーション」において、 • E(f)がまだ収束していない→手順1へ戻る • E(f)が収束→正則化項を一旦0にする→ 手順1へ戻る というのを繰り返す。
E(f) = ↵matchEmatch(f) + ↵regEreg(f)
24
![Page 25: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/25.jpg)
サーフェスの近似 (形状誤差の取り方)
誤差 で剛体的な形状誤差を観る際、以下のような戦略がとれる。
E(f) = Ematch(f) + Ereg(f)
Ematch(f)
① point-to-point (Closest Point による対応づけ)
② point-to-plane (K近傍法で各点を 平面に対応づけ)
③曲面・曲線フィッティング (②よりも高次の曲線へ対応づけ)
25
![Page 26: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/26.jpg)
(非剛体)変形モデル
誤差 を評価しながら変形モデルにより形状を変形。
ExtinsicとIntrinsicに、サーフェスの類似度を評価。
E(f) = Ematch(f) + Ereg(f) 26
Ereg(f)
Extrinsicエネルギー: 形状全体の体積を 保持するような正則化。
Intrinsic エネルギー : • 第Ⅰ基本形式(曲面上の長さを決める尺度) • 第Ⅱ基本形式(局所的な曲がり具合) を保持する正則化(通常線形近似)。 I
I
Ⅱ
Ⅱ
ff
V1
f(V1)
rf
S1
S2
S1
S2
![Page 27: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/27.jpg)
結果
27 http://www.youtube.com/watch?v=Cm4JjF6Y1SI
![Page 28: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/28.jpg)
統計的人体モデル
「人体らしい形状の変形の傾向」という事前情報(prior)は用いておらず、計算コストが高かった。
数十 ~ 数百人の大量の人体スキャンデータを、PCAなどにより低次元空間で形状変化を表した「統計的人体モデル」を作る。
低次元空間による主成分ベクトルによる形状変化を用いて
計算コストの少ないモデルフィッティングが可能になる。 28
非剛体レジストレーション(「データとデータ間」のフィッティング)
統計的人体モデル(「データとモデル間」のフィッティングの問題)
![Page 29: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/29.jpg)
3D Morphable Model of Face and (Head)
モデルの作成用3Dキャプチャ画像 (Face Scannerにより計測)
頭部形状の 統計的変化を 低次元で表現
PCA
3D Morpahable Model
John D Bustartd et al. “3D Morphable Model Construction for Robust Ear and Face Recognition” CVPR2010 .
29
![Page 30: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/30.jpg)
MORPHFACE: Basel Face Model
× スウェーデンのBasel大提供の3D Morphable Faceモデル
3D 形状 テクスチャ
http://faces.cs.unibas.ch/bfm/
30
![Page 31: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/31.jpg)
SCAPEモデル (Shape Completion and Animation of People )
• 統計的人体形状モデル(全身)のスタンダード。
• 大量のデータからPCAにより求めた主成分ベクトルで、形状の主要な変化を表現 (右図)
• SCAPEには姿勢のバリエーションも回帰されており、ある1人の体型に様々な姿勢を取らせることができる(左図)
D. Anguelov et al. SCAPE: Shape Completion and Animation of People. Proceedings of the SIGGRAPH Conference, 2005. 31
![Page 32: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/32.jpg)
スキャンデータの SCAPEモデルへのフィッティング
32
![Page 33: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/33.jpg)
Mocapからの SCAPEモデルアニメーション
33
![Page 34: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/34.jpg)
統計的形状空間 (Statistical Shape Spaces)
任意変形できる人間の形状モデル • 大量の個人形状(約100人、500スキャン)を学習 Ø 異なる姿勢(Pose) Ø 異なる人物(Shape) • 全てにおいて対応を計算 • 形状の統計(空間)を作成(PCA+非線形埋め込み)
“A Statistical Model of Human Pose and Body Shape” N.Hasler et al. Computer Graphics Forum (Proc. Eurographics 2009), Munich, Germany, March 2009.
34
![Page 35: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/35.jpg)
統計的形状空間 (Statistical Shape Spaces)
様々な応用 • 欠落や自己遮蔽がある曖昧なデータへフィッティング(事前知識で使用)
• モデルの拘束を用いたデータの編集。 • 統一空間を元にした比較、寸法の計測。 • 認識、識別、回帰など。
このようなモデルを作成するには 対応付け/レジストレーション
が必要
35
![Page 36: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/36.jpg)
Kinect 1台での3D ボディスキャン “Home 3D Body Scans from Noisy Image and Range Data“ ICCV 2011 , Weiss et al.
• 4方向から撮影した距離画像4枚 にシルエットとSCAPEモデルを 直接フィッティング
• 計算時間は65分/1スキャン
36
![Page 37: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/37.jpg)
複数台のKinectでの ボディスキャニング
16台のKinectを用いた3D ボディスキャナ「KX-16」(アメリカ「TC2社」)
37
![Page 38: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/38.jpg)
まとめ × 人体3Dスキャンは非剛体変形が伴うので、その位置合わせには「非剛体レジストレーション」が必要。
× 誤差エネルギーに「変形モデル分の正則化項」を加えたエネルギー関数で非線形最適化。
× 非剛体レジストレーションに関連する技術として、「ボディスキャナー」および「顔や全身の統計的人体モデル」を紹介。
38
![Page 39: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/39.jpg)
39
![Page 40: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/40.jpg)
Point Cloud
画像引用元: ICCV 2011 PCL tutorial 40
![Page 41: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/41.jpg)
Point Cloud Library × Point CloudとMeshの処理のための、C++言語から使用できるオープンソースライブラリ(BSDライセンス)
× Win/Mac/Linuxのクロスプラットフォーム
× OpenCVと姉妹プロジェクト
× OpenNIと連携しており、KinectなどのデプスセンサからPoint Cloudを取得可能。
41
※このチュートリアルではPCLのバージョン 1.5.1をベースに解説しました。
![Page 42: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/42.jpg)
Point Cloudを取得できるセンサ
画像引用元: ICCV 2011 PCL tutorial 42
![Page 43: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/43.jpg)
PCLの依存ライブラリ × Boost: C++の拡張標準ライブラリ。マルチスレッド、スマートポインタ、データ構造拡張、ファイル入出力拡張など。
× VTK(Visualization Tool Kit): 3D可視化・GUIライブラリ。(OpenGLをラッパー)
× Eigen: コードが書き易い、高速な線形代数ライブラリ。
× FLANN: 最近傍探索ライブラリ(pcl::searchで使用)
× qHull: 凸法、三角化、ドロネー分割などのメッシュ処理。
× OpenNI(オプション): Kinect/XtionからRGB+ Depthを取得。
43
![Page 44: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/44.jpg)
PCLの構成モジュール
44
![Page 45: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/45.jpg)
PCLの構成モジュール
45
![Page 46: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/46.jpg)
PCLの公式チュートリアル http://pointclouds.org/documentation/tutorials/
46
![Page 47: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/47.jpg)
PCLの公式サンプルプログラム (Windows)
× C¥:Program Files¥PCL 1.5.1¥bin にPCL公式サイトの各チュートリアルのサンプルがコンパイルされた.exeがインストールされている。
× 対応するソースコードの保存場所は C¥:Program Files¥PCL 1.5.1¥share¥doc¥pcl-1.5¥tutorials¥sources
(いずれも.cppファイルのみ。特定のIDE向けのプロジェクトは含まれていない)
解説(英語)付きのWebチュートリアルが、各モジュールの各機能毎に(例:registrationのICP,segmentationの平面特定など) 、サンプルコードとセットで提供されている。 PCLの習得には、ぜひこれらのサンプルとチュートリアルを活用されたい。
47
![Page 48: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/48.jpg)
拙ブログ「DERiVE –コンピュータビジョンブログ」にて PCLのチュートリアル連載を継続中
http://derivecv.tumblr.com/ twitter : @derivecv
「PCLの公式チュートリアルの各記事+アルファ」を日本語で解説する記事の連載「PCLを触ってみよう!」を継続中。
48
![Page 49: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/49.jpg)
デモ1 Hello PCL World!
まずはPCLのHello World的プログラムを紹介。
× PCL独自のPoint cloudファイル形式である「.pcd」データをPointCloud<PointT>オブジェクトに読み込む。
× 読み込んだPointCloudをCloudViewerに表示する。
49
![Page 50: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/50.jpg)
Point Cloud in PCL 基本形:
pcl::PointCloud< PointT >::Ptr cloud( new PointCloud< PointT >() );
Point Cloudに含まれる点の形式を表すPointTの例:
u pcl::PointXYZ : 3D 位置
u pcl::PointXYZI : 3D 位置 + 輝度
u pcl::PointXYZRGBA: 3D 位置 + RGBA
u pcl::PointNormal: 3D 位置+法線ベクトル
例):格納する各点がPointXYZRGBAのPoint Cloudを作成。
PointCloud<pcl::PointXYZRGBA>::Ptr data( new PointCloud<pcl::PointXYZRGBA>() );
50
![Page 51: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/51.jpg)
Point CloudへのPointTの追加 PointCloud型のメンバである「points」にpush_backする。
(※ PointCloudの中身はSTLのvectorのようなデータ構造)
例: Point Cloudに座標値が(100,200,300)のPointXYZ型の点を
1点だけ追加する。
pcl::PointCloud< PointXYZ >::Ptr cloud( new PointCloud< PointXYZ >() );
PointXYZ point; point.x = 100; point.y = 200; point.z = 300;
cloud->points.push_back( point );
51
![Page 52: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/52.jpg)
PCL::ioモジュール × PointCloud<PointT>型のデータをPCLの独自ファイル形式「.pcd形式」へ保存・読み込みができる。
× OpenNIによりデータを取得できる各種デプスセンサ(Kinect, Xtion)からリアルタイムに同期された「デプス+RGB画像」を直接PointCloud型でキャプチャ可能!
(→ OpenNIでPoint cloud を取り扱いたいなら、OpenNI単体での使用よりPCLからのOpenNIの使用がおすすめ)
× CG/CAD用のメッシュデータ形式(.obj 、.ply)の読み/書きが可能。
52
![Page 53: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/53.jpg)
Cloud Viewerクラス × シンプルなPoint Cloudの可視化クラス(ウィンドウ)。
× VTKによる実装(OpenGLによるグラフィックス表示)。
× .pcdファイルから読み込んだ1つのPoint Cloudを表示するにはこれで十分。
CloudViewer *viewer = new CloudViewer( “Sample" );
viewer->showCloud( cloud_filtered );
※本日はこのCloudViewerのみを紹介するがPCLにはより多機能なビューワーであるPCLVisulaizerクラスが用意されている。
53
![Page 54: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/54.jpg)
デモ1: 実演
54
![Page 55: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/55.jpg)
デモ2 Hello OpenNI World!
OpenNIとのインターフェースであるOpenNIGrabberクラスの使い方を学ぶ
× OpenNIGrabberクラスによるPointCloudの取得。
× リアルタイムに取得しているPointCloudのCloudViewerへの表示。
× 取得したPointCloudを.pcd形式で保存する
55
![Page 56: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/56.jpg)
OpenNI Grabberフレームワーク OpenNIGrabber:Kinectから「RGB画像+デプス」をリアルタイム取得できる(OpenNIをラッピングしている)
1. PCLのPointCloud<PointT>型でデータを取ってきてくれる(デプス画像からデプスに変換する必要がない)。
2. RGB画像とデプスが、最初から「位置合わせ、同期」されている(同期する分、若干起動は遅い)。
56
![Page 57: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/57.jpg)
コールバック関数による 毎フレームの処理
× 自分で定義した関数をコールバック関数として登録しておく
boost::function<void (const pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr&)> f =
boost::bind (&SimpleOpenNIProcessor::cloud_cb_, this, _1);
× OpenNIから「デプス+RGB画像」のPointCloudが取得されるごとに登録した関数が呼ばれ、その関数の中で毎フレームの処理(Pointcloudの解析や保存、可視化)を行う。
void cloud_cb_ (const pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr &cloud)
{
(この中に毎フレームごとのcloudを用いた処理を書いておく)
}
57
![Page 58: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/58.jpg)
デモ2: 実演
58
![Page 59: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/59.jpg)
デモ3 ICPによる剛体レジストレーション × Kinectで2つの別のカメラ方向から1つの物体を撮影した時、2つの点群間をICPにより剛体レジストレーションを行う。
ターゲット ソース 59
![Page 60: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/60.jpg)
デモ3(の準備) 剛体レジストレーション
× 非剛体レジストレーションとは違い非剛体変形がない!つまりは「3D回転+平行移動」だけをICPで求める。
× ICPは初期位置合わせが重要(初期状態でソースとターゲットのPoint Cloudが遠すぎると失敗する)
× 必ずしもPoint Cloudの全点同士でICPを行う必要ない:
① 非剛体レジストレーションのように変形を仮定する必要がない。
② 特徴がよく出ている形状なら、局所特徴量の対応点で初期位置合わせができる。(ICPはそのあとのRefinementとして行う)
③ 平面性が強ければダウンサンプリングしたもの同士で十分レジストレーションが可能(元の点群と表す形状が変化しないので)
※ そもそもICPは「①初期位置合わせが近くないと」「②点数が巨大だと」なかなか収束しないし、局所解で失敗しやすい。
60
![Page 61: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/61.jpg)
pcl::IterativeClosestPointによる 剛体レジストレーション(準備)
pcl::IterativeClosestPoint<PointT, PointT> icp; (ICPを行うオブジェクトの作成)
icp.setInputCloud (cloud_source); (ソースのPointCloudの設定)
icp.setInputTarget (cloud_target); (ターゲットのPointCloudの設定)
icp.setMaxCorrespondenceDistance (distance); (対応距離の最大値)
icp.setRANSACOutlierRejectionThreshold (distance);(RANSAC除去距離)
icp.setTransformationEpsilon (transformation_epsilon); (変換パラメータ値)
icp.setMaximumIterations (max_iterations); (ICPの最大繰り返し回数)
61
![Page 62: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/62.jpg)
pcl::IterativeClosestPointによる 剛体レジストレーション(実行)
icp.align(cloud_source_transformed); (ICPを実行し、ソースの移動結果を取得)
std::cout << “has converged:” << icp.hasConverged() (最大反復回までに収束したか)
<< “ score: ” << icp.getFitnessScore() << std::endl; (変換を推定した後の合致度)
std::cout << icp.getFinalTransformation() << std::endl; (ICPで求めた変換行列を表示)
cloud_final = (cloud_source_transformed + *cloud_target).makeShared() ;
(変換したソースと、元のターゲットを合成)
viewer.showCloud(cloud_final);(最終的な合成結果を表示)
62
![Page 63: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/63.jpg)
結果
ソース(青色)
ターゲット(赤色)
63
![Page 64: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/64.jpg)
デモ3: 実演
64
![Page 65: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/65.jpg)
参考:ICP前の初期位置合わせ 方法1
「Feature Descriptor対応からの線形推定」
① Local descriptorによる対応点マッチング: CorrespondenseEstimation<FeartureT,FeatureT>
② SAC(Sampling Consensus)による外れ値除去:
CorrespondenceRejectorSampleConsensus<PointT>
③ 外れ値除去した対応を用いて、SVDによりpoint-to-pointの距離和を最小化して並進・回転推定:
TransformationEstimationSVD<PointT,PointT>
この①−③で位置合わせしてもよいが、次の方法2も便利
65
![Page 66: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/66.jpg)
参考:ICP前の初期位置合わせ 方法2
「SAC Initial Alignmentによる初期位置合わせ」
× SampleConsensusInitialAlignment<PointT,PointT,FeatrueT>による、初期位置合わせの一括処理。
このSAC-IAにより大まかな計算速度も速い位置合わせを行ったあと、 IterativeClosestPoint<PointT, PointT> により正確なレジストレーション
入力1 入力2
66
![Page 67: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/67.jpg)
まとめ × PCLの入門として、PCLの紹介と初歩的な使い方を紹介した。
× PCLのIterativeClosestPointクラスによる2つの点群間での剛体レジストレーションのサンプルプログラムを紹介した。
× PCL ぜひ使ってみてください。
× 今回のサンプルプログラムのソースコードは以下の場所に公開しています。https://github.com/payashim/SSII2012_PCLTutorial
67
![Page 68: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/68.jpg)
Referecence (前編) Conference tutorials:
× Eurographics 2011 “Computing Correspondences in Geometric Data Sets” http://www.mpi-inf.mpg.de/resources/deformableShapeMatching/EG2011_Tutorial/
× Eurographics 2010 “Geometric Registration for Deformable Shapes” http://www.mpi-inf.mpg.de/resources/deformableShapeMatching/EG2010_Tutorial/
Books:
× Alexander M. Bronstein, Michael M. Bronstein, Michael Bronstein, Ron Kimmel ,“Numerical geometry of Nonrigid Shapes”, Springer, 2009. (非剛体3Dメッシュの数値計算全般についての本)
68
![Page 69: SSII2012 tutorial nonrigid registration and pcl](https://reader030.vdocument.in/reader030/viewer/2022012401/5590df351a28ab32578b4716/html5/thumbnails/69.jpg)
Referecence (後編) PCL Tutorial
× PCL公式サイトのチュートリアルhttp://pointclouds.org/documentation/tutorials/
× ICCV 2011 tutorial (このサンプルコードがPCL 1.5.0から付属) http://pointclouds.org/media/iccv2011.html
× CVPR2012 tutorial(今月CVPR2012が開催後に公開される予定) http://pointclouds.org/media/cvpr2012.html
Web
× 「DERiVE –コンピュータビジョンブログ」のシリーズ「PCLを触ってみよう!」http://derivecv.tumblr.com/
69