Review threshold minimum

This commit is contained in:
François Boulogne
2016-05-23 14:25:28 +02:00
committed by François Boulogne
parent 31db1c607e
commit 80e8544067
4 changed files with 60 additions and 47 deletions
@@ -4,10 +4,10 @@ Minimum Algorithm For Thresholding
==================================
The minimum algorithm takes a histogram of the image and smooths it
repeatedly unitl there are only two peaks in the histogram. Then it
finds the minimum value between the two peaks. With the smoothing
there can be multiple pixel values with the minimum histogram count,
so you can pick 'min', 'mid', or 'max' of these values.
repeatedly until there are only two peaks in the histogram. Then it
finds the minimum value between the two peaks. After smoothing the
histogram, there can be multiple pixel values with the minimum histogram
count, so you can pick 'min', 'mid', or 'max' of these values.
"""
import matplotlib.pyplot as plt
@@ -18,7 +18,6 @@ from skimage.filters.thresholding import threshold_minimum
image = data.camera()
threshold = threshold_minimum(image, bias='min')
binarized = image > threshold
fig, axes = plt.subplots(nrows=2, figsize=(7, 8))
@@ -26,10 +25,10 @@ ax0, ax1 = axes
plt.gray()
ax0.imshow(image)
ax0.set_title('Image')
ax0.set_title('Original image')
ax1.imshow(binarized)
ax1.set_title('Thresholded')
ax1.set_title('Result')
for ax in axes:
ax.axis('off')