Skip to content

Commit

Permalink
Add a low contrast test with multiple dtypes
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Mar 8, 2015
1 parent ec1508d commit a7521ad
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions skimage/exposure/tests/test_exposure.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,22 @@ def test_negative():
assert_raises(ValueError, exposure.adjust_gamma, image)


def test_is_low_contrast():
image = np.linspace(0, 0.04, 100)
assert exposure.is_low_contrast(image)
image[-1] = 1
assert exposure.is_low_contrast(image)
assert not exposure.is_low_contrast(image, upper_percentile=100)

image = (image * 255).astype(np.uint8)
assert exposure.is_low_contrast(image)
assert not exposure.is_low_contrast(image, upper_percentile=100)

image = (image.astype(np.uint16)) * 2**8
assert exposure.is_low_contrast(image)
assert not exposure.is_low_contrast(image, upper_percentile=100)


if __name__ == '__main__':
from numpy import testing
testing.run_module_suite()

0 comments on commit a7521ad

Please sign in to comment.