morphological filter example python

Solutions on MaxInterview for morphological filter example python by the best coders in the world

showing results for - "morphological filter example python"
Matteo
17 Nov 2016
1import os
2import matplotlib.pyplot as plt
3from skimage.data import data_dir
4from skimage.util import img_as_ubyte
5from skimage import io
6
7orig_phantom = img_as_ubyte(io.imread(os.path.join(data_dir, "phantom.png"),
8                                      as_grey=True))
9fig, ax = plt.subplots()
10ax.imshow(orig_phantom, cmap=plt.cm.gray)
11
Neele
16 Aug 2020
1def plot_comparison(original, filtered, filter_name):
2
3    fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(8, 4), sharex=True,
4                                   sharey=True)
5    ax1.imshow(original, cmap=plt.cm.gray)
6    ax1.set_title('original')
7    ax1.axis('off')
8    ax1.set_adjustable('box-forced')
9    ax2.imshow(filtered, cmap=plt.cm.gray)
10    ax2.set_title(filter_name)
11    ax2.axis('off')
12    ax2.set_adjustable('box-forced')
13
Luca
23 Sep 2017
1from skimage.morphology import erosion, dilation, opening, closing, white_tophat
2from skimage.morphology import black_tophat, skeletonize, convex_hull_image
3from skimage.morphology import disk
4
5selem = disk(6)
6eroded = erosion(orig_phantom, selem)
7plot_comparison(orig_phantom, eroded, 'erosion')
8
similar questions
queries leading to this page
morphological filter example python