Skip to content
Snippets Groups Projects
Commit de9087d7 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

[test.test_transforms] Fix auto-level test (path to img)

parent 27212d1f
No related branches found
No related tags found
1 merge request!12Streamlining
Pipeline #39081 failed
...@@ -348,17 +348,11 @@ def test_compose(): ...@@ -348,17 +348,11 @@ def test_compose():
def test_16bit_autolevel(): def test_16bit_autolevel():
test_image_path = pkg_resources.resource_filename( path = pkg_resources.resource_filename(__name__, "testimg-16bit.png")
__name__, "testimg-16bit.png"
)
# the way to load a 16-bit PNG image correctly, according to: # the way to load a 16-bit PNG image correctly, according to:
# https://stackoverflow.com/questions/32622658/read-16-bit-png-image-file-using-python # https://stackoverflow.com/questions/32622658/read-16-bit-png-image-file-using-python
# https://github.com/python-pillow/Pillow/issues/3011 # https://github.com/python-pillow/Pillow/issues/3011
img = PIL.Image.fromarray( img = PIL.Image.fromarray(numpy.array(PIL.Image.open(path)).astype("uint16"))
numpy.array(
PIL.Image.open("bob/ip/binseg/test/testimg-16bit.png")
).astype("uint16")
)
nose.tools.eq_(img.mode, "I;16") nose.tools.eq_(img.mode, "I;16")
nose.tools.eq_(img.getextrema(), (0, 65281)) nose.tools.eq_(img.getextrema(), (0, 65281))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment