From 2137aed5ec7c9799bb4fade471f45b971203115d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Boulogne?= Date: Sun, 12 Jun 2016 22:09:42 +0200 Subject: [PATCH] swap examples to show a different image inthe gallery --- .../segmentation/plot_thresholding.py | 52 +++++++++++-------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/doc/examples/segmentation/plot_thresholding.py b/doc/examples/segmentation/plot_thresholding.py index f0bf5871..baa6b0b4 100644 --- a/doc/examples/segmentation/plot_thresholding.py +++ b/doc/examples/segmentation/plot_thresholding.py @@ -4,41 +4,21 @@ Thresholding ============ Thresholding is used to create a binary image from a grayscale image [1]_. -If you are not familiar with the details of the different algorithms and the -underlying assumptions, it is often difficult to know which algorithm will give -the best results. Therefore, Scikit-image includes a function to evaluate -thresholding algorithms provided by the library. At a glance, you can select -the best algorithm for you data without a deep understanding of their -mechanisms. .. [1] https://en.wikipedia.org/wiki/Thresholding_%28image_processing%29 .. seealso:: + A more comprehensive presentation on :ref:`sphx_glr_auto_examples_xx_applications_plot_thresholding.py` """ -import matplotlib -import matplotlib.pyplot as plt - -from skimage import data -from skimage.filters import thresholding - -img = data.page() - -# Here, we specify a radius for local thresholding algorithms. -# If it is not specified, only global algorithms are called. -fig, ax = thresholding.try_all_threshold(img, radius=20, - figsize=(10, 8), verbose=False) -plt.show() ###################################################################### -# How to apply a threshold? -# ========================= -# -# Now, we illustrate how to apply one of these thresholding algorithms. +# We illustrate how to apply one of these thresholding algorithms. # This example uses the mean value of pixel intensities. It is a simple # and naive threshold value, which is sometimes used as a guess value. +import matplotlib.pyplot as plt from skimage.filters.thresholding import threshold_mean from skimage import data @@ -59,3 +39,29 @@ for a in ax: a.axis('off') plt.show() + + +###################################################################### +# If you are not familiar with the details of the different algorithms and the +# underlying assumptions, it is often difficult to know which algorithm will give +# the best results. Therefore, Scikit-image includes a function to evaluate +# thresholding algorithms provided by the library. At a glance, you can select +# the best algorithm for you data without a deep understanding of their +# mechanisms. + +import matplotlib.pyplot as plt + +from skimage import data +from skimage.filters import thresholding + +img = data.page() + +# Here, we specify a radius for local thresholding algorithms. +# If it is not specified, only global algorithms are called. +fig, ax = thresholding.try_all_threshold(img, radius=20, + figsize=(10, 8), verbose=False) +plt.show() + + + +