From 6872e9cdf3ab5030cc3ccbbac6d614c0656252ac Mon Sep 17 00:00:00 2001 From: Tony S Yu Date: Fri, 9 Dec 2011 00:13:49 -0500 Subject: [PATCH] Add thresholding example --- doc/examples/plot_otsu.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 doc/examples/plot_otsu.py diff --git a/doc/examples/plot_otsu.py b/doc/examples/plot_otsu.py new file mode 100644 index 00000000..03534bc9 --- /dev/null +++ b/doc/examples/plot_otsu.py @@ -0,0 +1,23 @@ +""" +============ +Thresholding +============ + +Thresholding is used to create a binary image. This example uses Otsu's method to calculate the threshold value. + +""" + +import matplotlib.pyplot as plt + +from skimage.data import camera +from skimage.thresholding import threshold_otsu + + +image = camera() +thresh = threshold_otsu(camera()) +binary = image > thresh + +plt.imshow(binary) +plt.axis('off') +plt.show() +