mirror of
https://github.com/wassname/scikit-image.git
synced 2026-06-27 17:31:50 +08:00
Add regression tests for S&P noise
This commit is contained in:
@@ -26,6 +26,19 @@ def test_salt():
|
||||
assert 0.11 < proportion <= 0.15
|
||||
|
||||
|
||||
def test_salt_p1():
|
||||
image = np.random.rand(2, 3)
|
||||
noisy = random_noise(image, mode='salt', amount=1)
|
||||
assert_array_equal(noisy, [[1, 1, 1], [1, 1, 1]])
|
||||
|
||||
|
||||
def test_singleton_dim():
|
||||
"""Ensure images where size of a given dimension is 1 work correctly."""
|
||||
image = np.random.rand(1, 20)
|
||||
noisy = random_noise(image, mode='salt', amount=0.1, seed=42)
|
||||
assert np.sum(noisy == 1) == 2
|
||||
|
||||
|
||||
def test_pepper():
|
||||
seed = 42
|
||||
cam = img_as_float(camera())
|
||||
|
||||
Reference in New Issue
Block a user