mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-23 13:10:18 +08:00
Add example for threshoding
This example was removed in a previous commit.
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user