Perpustakaan Python untuk Downsampling Foto

skimage_resized = resize(mask, (mask.shape[0]//2, mask.shape[1]//2), mode='constant')
print(skimage_resized.shape, np.unique(mask_resized))

skimage_rescale = rescale(mask, 1.0/2.0, mode='constant')
print(skimage_rescale.shape, np.unique(mask_resized))

ndimage_resized = ndimage.interpolation.zoom(mask, 0.5)
print(ndimage_resized.shape, np.unique(mask_resized))


cv2_resized = cv2.resize(mask, (mask.shape[0]//2, mask.shape[1]//2),
                        interpolation=cv2.INTER_NEAREST)
print(cv2_resized.shape, np.unique(mask_resized))

mask_pil = Image.fromarray(mask, mode=None)
pil_resized = mask_pil.thumbnail((mask.shape[0]//2, mask.shape[1]//2), Image.NEAREST)
print(skimage_resized.shape, np.unique(pil_resized))
Horrible Hoopoe