Files
scikit-image/doc/examples/plot_otsu.py
T
Tony S Yu 8ed834a3ab Add example for threshoding
This example was removed in a previous commit.
2011-12-17 22:02:10 -05:00

24 lines
392 B
Python

"""
============
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()