Add thresholding example

This commit is contained in:
Tony S Yu
2011-12-09 00:13:49 -05:00
parent 5a171a2bfb
commit 6872e9cdf3
+23
View File
@@ -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()