はじめに
Seaborn-imageはmatplotlibベースの画像可視化ライブラリであり、簡潔なコードで画像データを明瞭に描写することができる。データ可視化ライブラリであるseabornの2次元データ版のような感じとなっている。ここでは、画像に各種フィルタをかけて表示できるfilterplot
について説明する。
seaborn-image: image data visualization — seaborn-image documentation
コード&解説
インストール
condaの方は
conda install -c conda-forge seaborn-image
pipの方は
pip install -U seaborn-image
でインストールできる。
モジュールのインポート
seaborn_image は isnsとして読み込む。
バージョン
全体の設定
isns.set_imageで、デフォルトのカラーマップをcmap=”bone”とし、画像の原点の設定をupperにする。
適用可能なフィルタ
かけることのできるフィルタには以下のものがある。
データの読み込み
サボテンのすみれ丸の画像を読み込む。以下の画像を用いた。rgb2grayでグレースケール画像としておく。

gaussianフィルタ
filterplotでfilt='gaussian',sigma=5
とすることでsigma=5のガウシアンフィルタをかけた画像が表示される。

ndimage
の関数を直接、filt=ndi.gaussian_filterのように指定することでもフィルタのかかった画像が表示される。

sobelフィルタ


[scikit-image] 90. sobelフィルタで画像の各画素における勾配を求める
skimage.filtersのsobel,sobel_h, sobel_vを使用して、画像の各画素の勾配を求める方法について解説する。
medianフィルタ


[SciPy] 3. ndimageによる画像処理
SciPyのndimageによる画像の処理方法
maxフィルタ


[scikit-image] 108. マキシマムフィルタによる高輝度部分の強調(skiamge.filters.rank.maximum)
skiamgeのfiltersのrank.maximumを使って、画像中の高輝度部分を強調する方法について説明する。
DoGフィルタ


[ipywidgets] 34. バンドパスフィルタ(skimage.filters.difference_of_gaussians)のsigmaをFloatSliderで調整して2Dフーリエ変換
skimage.filters の difference_of_gaussiansで画像にバンドパスフィルタを適用することができる。ここではipywidgetsのFloatSliderでフィルタのsigmaを調整してフーリエ変換する方法について説明する。
ガウス微分フィルタ


[SciPy] 24. ガウス微分フィルタによるエッジ検出(ndimage.gaussian_gradient_magnitude)
scipyのndimageのgaussian_gradient_magnitudeを使って、画像のエッジを検出して表示する方法について説明する。
gaussian_laplaceフィルタ


[SciPy] 25. LoGフィルタによるエッジ検出(ndimage. gaussian_laplace)
scipyのndimageのgaussian_laplaceを使って、LoGフィルタで画像のエッジを検出して表示する方法について説明する。
laplaceフィルタ


[SciPy] 26. ラプラシアンフィルタによるエッジ検出(ndimage.laplace)
はじめにscipyのndimageのlaplaceを使って、ラプラシアンフィルタで画像のエッジを検出して表示する方法について説明する。コード&解説モジュールのインポートバージョン画像の読み込み下記サイトから画像を取得し、plt.imread...
minimumフィルタ


[SciPy] 27. ミニマムフィルタによる低輝度部分の強調(ndimage.minimum_filter)
scipyのndimageのminimum_filterを使って、画像中の低輝度部分を強調して、高輝度部分を目立たなくする方法について説明する。
percentileフィルタ


[SciPy] 28. パーセンタイルフィルタによる画像の平滑化(ndimage.percentile_filter)
scipyのndimageのpercentile_filterを使って、画像を任意のパーセンタイル点で平滑化する方法について説明する。
prewittフィルタ


[scikit-image] 91. 各種エッジフィルタの回転不変性の比較
skimage.filtersのエッジ検出フィルタには、sobel,prewitt, farid、scharrがある。これらのフィルタの回転不変性は、farid、scharr、sobel、prewittの順によかったので、各種フィルタを適用した画像の比較結果を示す。
rankフィルタ


[scikit-image] 35. 平均化フィルタによる画像の平滑化(skimage.rank mean, mean_percentile, mean_percentile)
ここでは、skimage rank mean, mean_percentile, mean_percentileにより画像に平均化フィルタを適用した例について説明する。
uniformフィルタ

uniformフィルタは、平均値フィルタ(meanフィルタ)である。
コードをダウンロード(.pyファイル) コードをダウンロード(.ipynbファイル)参考
seaborn_image.filterplot — seaborn-image documentation
コメント