diff --git a/skimage/thresholding/__init__.py b/skimage/thresholding/__init__.py index d5d6eddf..9b6e229c 100644 --- a/skimage/thresholding/__init__.py +++ b/skimage/thresholding/__init__.py @@ -1 +1,2 @@ -from .thresholding import threshold_otsu, binarize +from .thresholding import threshold_otsu + diff --git a/skimage/thresholding/tests/test_thresholding.py b/skimage/thresholding/tests/test_thresholding.py index 6fc3f020..2ec64da6 100644 --- a/skimage/thresholding/tests/test_thresholding.py +++ b/skimage/thresholding/tests/test_thresholding.py @@ -2,7 +2,7 @@ import numpy as np import skimage from skimage import data -from skimage.thresholding import threshold_otsu, binarize +from skimage.thresholding import threshold_otsu class TestSimpleImage(): @@ -24,14 +24,6 @@ class TestSimpleImage(): image = np.float64(self.image) assert 2 <= threshold_otsu(image) < 3 - def test_binarize(self): - expected = np.array([[0, 0, 0, 1, 1], - [0, 0, 1, 1, 1], - [0, 0, 1, 1, 0], - [0, 1, 1, 0, 0], - [1, 1, 0, 0, 0]]) - assert np.all(binarize(self.image) == expected) - def test_otsu_camera_image(): assert threshold_otsu(data.camera()) == 87 diff --git a/skimage/thresholding/thresholding.py b/skimage/thresholding/thresholding.py index 131d33e7..b274010f 100644 --- a/skimage/thresholding/thresholding.py +++ b/skimage/thresholding/thresholding.py @@ -1,7 +1,7 @@ import numpy as np -__all__ = ['threshold_otsu', 'binarize'] +__all__ = ['threshold_otsu'] def threshold_otsu(image, bins=256): @@ -45,28 +45,6 @@ def threshold_otsu(image, bins=256): return threshold -_threshold_funcs = {'otsu': threshold_otsu} -def binarize(image, method='otsu'): - """Return binary image using an automatic thresholding method. - - Parameters - ---------- - image : array - Input array. - method : {'otsu'} - Method used to calculate threshold value. Currently, only Otsu's method - is implemented. - - Returns - ------- - out : array - Thresholded image. - """ - get_threshold = _threshold_funcs[method] - threshold = get_threshold(image) - return image > threshold - - def histogram(image, bins): """Return histogram of image.