mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-03 02:00:26 +08:00
rank filter asserts input is 2d
This commit is contained in:
@@ -43,6 +43,9 @@ def median_filter(data, mask=None, radius=1, percent=50):
|
||||
|
||||
'''
|
||||
|
||||
if data.ndim!=2:
|
||||
raise TypeError("The input 'data' must be a two dimensional array.")
|
||||
|
||||
if mask is None:
|
||||
mask = np.ones(data.shape, dtype=np.bool)
|
||||
mask = np.ascontiguousarray(mask, dtype=np.bool)
|
||||
|
||||
@@ -101,5 +101,12 @@ def test_default_values():
|
||||
result2 = median_filter(img)
|
||||
assert_array_equal(result1, result2)
|
||||
|
||||
def test_default_values():
|
||||
img = (np.random.random((20, 20)) * 255).astype(np.uint8)
|
||||
mask = np.ones((20, 20), dtype=np.uint8)
|
||||
result1 = median_filter(img, mask, radius=1, percent=50)
|
||||
result2 = median_filter(img)
|
||||
assert_array_equal(result1, result2)
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_module_suite()
|
||||
|
||||
Reference in New Issue
Block a user