脊线算子#

脊线滤波器可用于检测脊线状结构,例如神经突 [1]、管子 [2]、血管 [3]、皱纹 [4] 或河流。

不同的脊线滤波器可能适合检测不同的结构,例如,取决于对比度或噪声水平。

当前的脊线滤波器类依赖于图像强度海森矩阵的特征值来检测脊线结构,其中强度垂直变化但沿着结构不变化。

参考文献#

original, meijering σ = [1], meijering σ = [1, 2, 3, 4], sato σ = [1], sato σ = [1, 2, 3, 4], frangi σ = [1], frangi σ = [1, 2, 3, 4], hessian σ = [1], hessian σ = [1, 2, 3, 4]
from skimage import data
from skimage import color
from skimage.filters import meijering, sato, frangi, hessian
import matplotlib.pyplot as plt


def original(image, **kwargs):
    """Return the original image, ignoring any kwargs."""
    return image


image = color.rgb2gray(data.retina())[300:700, 700:900]
cmap = plt.cm.gray

plt.rcParams["axes.titlesize"] = "medium"
axes = plt.figure(figsize=(10, 4)).subplots(2, 9)
for i, black_ridges in enumerate([True, False]):
    for j, (func, sigmas) in enumerate(
        [
            (original, None),
            (meijering, [1]),
            (meijering, range(1, 5)),
            (sato, [1]),
            (sato, range(1, 5)),
            (frangi, [1]),
            (frangi, range(1, 5)),
            (hessian, [1]),
            (hessian, range(1, 5)),
        ]
    ):
        result = func(image, black_ridges=black_ridges, sigmas=sigmas)
        axes[i, j].imshow(result, cmap=cmap)
        if i == 0:
            title = func.__name__
            if sigmas:
                title += f"\n\N{GREEK SMALL LETTER SIGMA} = {list(sigmas)}"
            axes[i, j].set_title(title)
        if j == 0:
            axes[i, j].set_ylabel(f'{black_ridges = }')
        axes[i, j].set_xticks([])
        axes[i, j].set_yticks([])

plt.tight_layout()
plt.show()

脚本总运行时间:(0 分钟 2.089 秒)

Sphinx-Gallery 生成的图库