From 8ed834a3ab6651e35ecca487f69d0dc85ee18435 Mon Sep 17 00:00:00 2001 From: Tony S Yu Date: Sat, 17 Dec 2011 22:02:10 -0500 Subject: [PATCH] Add example for threshoding This example was removed in a previous commit. --- 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..3557bc2c --- /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.filter import threshold_otsu + + +image = camera() +thresh = threshold_otsu(image) +binary = image > thresh + +plt.imshow(binary) +plt.axis('off') +plt.show() +