From de9087d7445bcdb23572a170cbad50fc6bc38f15 Mon Sep 17 00:00:00 2001 From: Andre Anjos <andre.anjos@idiap.ch> Date: Tue, 21 Apr 2020 14:32:17 +0200 Subject: [PATCH] [test.test_transforms] Fix auto-level test (path to img) --- bob/ip/binseg/test/test_transforms.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/bob/ip/binseg/test/test_transforms.py b/bob/ip/binseg/test/test_transforms.py index a1967fe5..698c0a0e 100644 --- a/bob/ip/binseg/test/test_transforms.py +++ b/bob/ip/binseg/test/test_transforms.py @@ -348,17 +348,11 @@ def test_compose(): def test_16bit_autolevel(): - test_image_path = pkg_resources.resource_filename( - __name__, "testimg-16bit.png" - ) + path = pkg_resources.resource_filename(__name__, "testimg-16bit.png") # 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://github.com/python-pillow/Pillow/issues/3011 - img = PIL.Image.fromarray( - numpy.array( - PIL.Image.open("bob/ip/binseg/test/testimg-16bit.png") - ).astype("uint16") - ) + img = PIL.Image.fromarray(numpy.array(PIL.Image.open(path)).astype("uint16")) nose.tools.eq_(img.mode, "I;16") nose.tools.eq_(img.getextrema(), (0, 65281)) -- GitLab