fix: Handle cases where tile size > image size

This commit is contained in:
blessedcoolant 2023-09-23 02:18:59 +05:30 committed by Kent Keirsey
parent 0363a06963
commit 51451cbf21

View File

@ -578,9 +578,12 @@ class ColorMapImageProcessorInvocation(ImageProcessorInvocation):
image = np.array(image, dtype=np.uint8)
height, width = image.shape[:2]
width_tile_size = min(self.color_map_tile_size, width)
height_tile_size = min(self.color_map_tile_size, height)
color_map = cv2.resize(
image,
(width // self.color_map_tile_size, height // self.color_map_tile_size),
(width // width_tile_size, height // height_tile_size),
interpolation=cv2.INTER_CUBIC,
)
color_map = cv2.resize(color_map, (width, height), interpolation=cv2.INTER_NEAREST)