.. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_packages_scikit-image_auto_examples_plot_boundaries.py: Segmentation contours ===================== Visualize segmentation contours on original grayscale image. .. image:: /packages/scikit-image/auto_examples/images/sphx_glr_plot_boundaries_001.png :class: sphx-glr-single-img .. code-block:: python from skimage import data, segmentation from skimage import filters import matplotlib.pyplot as plt import numpy as np coins = data.coins() mask = coins > filters.threshold_otsu(coins) clean_border = segmentation.clear_border(mask).astype(np.int) coins_edges = segmentation.mark_boundaries(coins, clean_border) plt.figure(figsize=(8, 3.5)) plt.subplot(121) plt.imshow(clean_border, cmap='gray') plt.axis('off') plt.subplot(122) plt.imshow(coins_edges) plt.axis('off') plt.tight_layout() plt.show() **Total running time of the script:** ( 0 minutes 0.083 seconds) .. _sphx_glr_download_packages_scikit-image_auto_examples_plot_boundaries.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download :download:`Download Python source code: plot_boundaries.py ` .. container:: sphx-glr-download :download:`Download Jupyter notebook: plot_boundaries.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_