mirror of
https://github.com/wassname/scikit-image.git
synced 2026-06-29 16:49:06 +08:00
Add test for neggative gamma parameter
This commit is contained in:
@@ -263,7 +263,7 @@ def adjust_gamma(image, gamma=1, gain=1):
|
||||
dtype = image.dtype.type
|
||||
|
||||
if gamma < 0:
|
||||
return "Gamma should be a non-negative real number"
|
||||
raise ValueError("Gamma should be a non-negative real number.")
|
||||
|
||||
scale = float(dtype_limits(image, True)[1] - dtype_limits(image, True)[0])
|
||||
|
||||
|
||||
@@ -230,6 +230,11 @@ def test_adjust_gamma_greater_one():
|
||||
assert_array_equal(result, expected)
|
||||
|
||||
|
||||
def test_adjust_gamma_neggative():
|
||||
image = np.arange(0, 255, 4, np.uint8).reshape(8,8)
|
||||
assert_raises(ValueError, exposure.adjust_gamma, image, -1)
|
||||
|
||||
|
||||
# Test Logarithmic Correction
|
||||
# ===========================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user