From 2d2a10c4d93a1547eaec7848889100186f07ddf0 Mon Sep 17 00:00:00 2001 From: Eric Bezzam Date: Tue, 24 Oct 2023 11:23:17 +0200 Subject: [PATCH] Fix resizing. --- lensless/utils/image.py | 2 +- scripts/measure/collect_dataset_on_device.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lensless/utils/image.py b/lensless/utils/image.py index d826092d..857bbe4f 100644 --- a/lensless/utils/image.py +++ b/lensless/utils/image.py @@ -66,7 +66,7 @@ def resize(img, factor=None, shape=None, interpolation=cv2.INTER_CUBIC): else: resized = np.array( [ - cv2.resize(img[i], dsize=new_shape[::-1], interpolation=interpolation) + cv2.resize(img[i], dsize=tuple(new_shape[::-1]), interpolation=interpolation) for i in range(img.shape[-4]) ] ) diff --git a/scripts/measure/collect_dataset_on_device.py b/scripts/measure/collect_dataset_on_device.py index 4de5dc4a..601a503b 100644 --- a/scripts/measure/collect_dataset_on_device.py +++ b/scripts/measure/collect_dataset_on_device.py @@ -214,9 +214,9 @@ def collect_dataset(config): ) if down: - output = resize(output[None, ...], 1 / down, interpolation=cv2.INTER_CUBIC)[ - 0 - ] + output = resize( + output[None, ...], factor=1 / down, interpolation=cv2.INTER_CUBIC + )[0] # print range print(f"{output_fp}, range: {output.min()} - {output.max()}")