濾波器

Python 的生醫影像分析

Stephen Bailey

Instructor

濾波器

已套用濾波的影像示例

Python 的生醫影像分析

使用銳化濾波器的卷積

卷積範例

Python 的生醫影像分析

使用銳化濾波器的卷積

卷積結果

Python 的生醫影像分析

由 Michael Plotke 製作 - 自製,CC BY-SA 3.0,https://commons.wikimedia.org/w/index.php?curid=24288958

Python 的生醫影像分析

由 Michael Plotke 製作 - 自製,CC BY-SA 3.0,https://commons.wikimedia.org/w/index.php?curid=24288958

Python 的生醫影像分析

影像卷積

import imageio.v2 as imageio
import scipy.ndimage as ndi

im=imageio.imread('foot-xray.jpg')

weights = [[.11, .11, .11], [.11, .12, .11], [.11, .11, .11]]
im_filt = ndi.convolve(im, weights)
fig, axes = plt.subplots(2, 1)
axes[0].imshow(im, cmap='gray')
axes[1].imshow(im_filt,cmap='gray')
plt.imshow()

平滑後的腳部 X 光

Python 的生醫影像分析

濾波函式

scipy.ndimage.filters 包含:

  • median_filter()
  • uniform_filter()
  • maximum_filter()
  • percentile_filter()
ndi.median_filter(im, size=10)

腳部中值濾波

Python 的生醫影像分析

高斯濾波

1 維的高斯分佈 Gaussian distribution 1D

ndi.gaussian_filter(im, sigma=5)

sigma = 5 的模糊

2 維的高斯分佈 By Kghose at the English language Wikipedia, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=2550031

ndi.gaussian_filter(im, sigma=10)

sigma = 10 的模糊

Python 的生醫影像分析

一起來練習吧!

Python 的生醫影像分析

Preparing Video For Download...