mirror of
https://github.com/wassname/scikit-image.git
synced 2026-10-01 12:31:10 +08:00
Add test for neggative gamma parameter
This commit is contained in:
1 parent
0a2ed35253
commit
5b3c21a4d4
2 files changed
+6
-1
No files matched your search
@@ -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