Add test for threshold_otsu on single color image

This commit is contained in:
Himanshu Mishra
2016-01-25 13:56:45 +05:30
parent 28f19d3076
commit 1740767a3a
+8 -1
View File
@@ -1,5 +1,7 @@
import numpy as np
from numpy.testing import assert_equal, assert_almost_equal
from numpy.testing import (assert_equal,
assert_almost_equal,
assert_raises)
import skimage
from skimage import data
@@ -162,6 +164,11 @@ def test_otsu_astro_image():
with expected_warnings(['grayscale']):
assert 109 < threshold_otsu(img) < 111
def test_otsu_one_color_image():
img = np.ones((10, 10), dtype=np.uint8)
assert_raises(TypeError, threshold_otsu, img)
def test_li_camera_image():
camera = skimage.img_as_ubyte(data.camera())
assert 63 < threshold_li(camera) < 65