Add test for neggative gamma parameter

This commit is contained in:
Johannes Schönberger
2013-11-22 12:33:21 +01:00
parent 0a2ed35253
commit 5b3c21a4d4
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -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])
+5
View File
@@ -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
# ===========================