mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-07 18:21:44 +08:00
BUG: Fix OTSU thresholding tests with matplotlib IO plugin.
The matplotlib IO returns float arrays from [0, 1], which gives difference results than a ubyte array. Explicitly convert to a ubyte array in the tests.
This commit is contained in:
@@ -73,11 +73,13 @@ class TestSimpleImage():
|
||||
|
||||
|
||||
def test_otsu_camera_image():
|
||||
assert threshold_otsu(data.camera()) == 87
|
||||
camera = skimage.img_as_ubyte(data.camera())
|
||||
assert threshold_otsu(camera) == 87
|
||||
|
||||
|
||||
def test_otsu_coins_image():
|
||||
assert threshold_otsu(data.coins()) == 107
|
||||
coins = skimage.img_as_ubyte(data.coins())
|
||||
assert threshold_otsu(coins) == 107
|
||||
|
||||
|
||||
def test_otsu_coins_image_as_float():
|
||||
@@ -86,7 +88,8 @@ def test_otsu_coins_image_as_float():
|
||||
|
||||
|
||||
def test_otsu_lena_image():
|
||||
assert threshold_otsu(data.lena()) == 141
|
||||
lena = skimage.img_as_ubyte(data.lena())
|
||||
assert threshold_otsu(lena) == 141
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user