はじめに
skimage.future graphのshow_ragにより、領域隣接グラフを表示する例について説明する。
コード

解説
モジュールのインポート
画像データの読み込み
コリファンタ属の象牙丸を用いる。

k平均法によるセグメント化
segmentation.slic()により、k平均法によるセグメント化を行う。
隣接境界グラフの生成
rag_mean_color()で画像とそのセグメント化された情報から、領域隣接グラフ(RAG)を構築する。
領域隣接グラフを表示
Imagegridの設定
Imagegridを用いて画像を表示する。Imagegridについては下記で解説した。

[matplotlib] 19. mpl_toolkits.axes_grid1 の使い方(画像の表示)
axes_grid1のImageGridを用いて複数の画像を表示する方法

[matplotlib] 20. mpl_toolkits.axes_grid1 の使い方(ラベルとカラーバー)
axes_grid1を用いて複数の画像を表示する際のラベルとカラーバーの設定方法
default settingsの画像
imgとRAGが同じような色調で表示される。
画像とRAGのcmapを変えた画像
グレースケール画像にviridisのRAGを表示した。
コードをダウンロード参考
Drawing Region Adjacency Graphs (RAGs) — skimage 0.25.0 documentation
skimage.segmentation — skimage 0.25.0 documentation
Page not found · GitHub Pages
Page not found · GitHub Pages
コメント