画像から枠を取り出します。
いくつか存在しますが、今回はcanny
,robertesフィルター
,sobelフィルター
を試してみます。
画像の用意
from skimage.data import chelsea import matplotlib.pyplot as plt img = chelsea()
エッジを抽出する
canny
from skimage import feature e1 = feature.canny(g,sigma=2) plt.imshow(e1,cmap=plt.cm.gray)
roberts,sobel
from skimage import filters edge_roberts = filters.roberts(g) edge_sobel = filters.sobel(g) plt.imshow(edge_roberts,cmap=plt.cm.gray) plt.imshow(edge_sobel,cmap=plt.cm.gray)
エッジという点ではcannyが一番良さそうです。