はじめに
skimage.morphologyのskeletonizeで、ボクセルグラフで表示した3次元オブジェクトを細線化する方法について説明する。
コード

解説
モジュールのインポートなど
バージョン
構造化要素で物体を作成
skimage,morphologyのoctahedronとballを使って構造化要素を作成して、それらをnp.concatenateで連結して3次元オブジェクトを作成する。
3次元オブジェクトの細線化
skeletonizeで細線化する。2次元画像の細線化については下記記事で解説した。

[scikit-image] 23. 画像の細線化(morphology.skeletonize)
ここでは、skimage.morphology の skeletonizeを用いた画像の細線化について説明する。
結果の表示
ボクセルグラフでオリジナル物体とその物体を細線化した結果を表示する。なお、ボクセルグラフについては下記で解説した。

[matplotlib 3D] 28. Pythonで3D voxelグラフ
3D voxelグラフの作成について解説する。

回転アニメーション
回転アニメーションは以下記事を参考にして作成した。

[matplotlib 3D] 14. 3Dグラフの回転アニメーション
matplotlib mplot3d のグラフの回転アニメーション
参考
Generate footprints (structuring elements) — skimage 0.25.2rc0.dev0 documentation
skimage.morphology — skimage 0.26.0rc0.dev0 documentation
コメント