From db2e066f4cbefe95cd203818adc62f98db487da1 Mon Sep 17 00:00:00 2001 From: Olivier Debeir Date: Mon, 12 Nov 2012 14:40:49 +0100 Subject: [PATCH] add: test otsu --- skimage/filter/rank/tests/test_rank.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/skimage/filter/rank/tests/test_rank.py b/skimage/filter/rank/tests/test_rank.py index c40c91d7..73f3a5c3 100644 --- a/skimage/filter/rank/tests/test_rank.py +++ b/skimage/filter/rank/tests/test_rank.py @@ -320,7 +320,13 @@ def test_empty_selem(): def test_otsu(): # - pass + test = np.tile([128, 145, 103, 127, 165, 83, 127, 185, 63, 127, 205, 43, 127, 225, 23, 127],(16,1)) + test = test.astype(np.uint8) + res = np.tile([1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1],(16,1)) + selem = np.ones((6,6), dtype=np.uint8) + th = 1*(test>=rank.otsu(test,selem)) + assert_array_equal(th,res) + def test_entropy(): # verify that entropy is coherent with bitdepth of the input data @@ -358,3 +364,4 @@ def test_entropy(): if __name__ == "__main__": run_module_suite() + \ No newline at end of file