在 Python 中是否有可以处理超过 8 位颜色的 imresize 模拟?

Is there imresize analog that can work with more than 8 bit colors in Python?

我想调整每个颜色通道中由 uint16 值表示的图像的大小。如果我使用 imresize,它会将数据转换为 uint8 值。如何保留 uint16 和调整图像大小?

我还想使用 interp='lanczos' 调整大小的方法 - 不仅可以缩小数据,还可以保留细节。在 Python 中是否有可以使用超过 8 位颜色的 imresize 模拟?

使用 OpenCV resize 函数:OpenCV Documenation 而不是 SkiPy imresize

解决方法:升级到 int32,并设置模式参数以告知 PIL 遵守它:

scipy.misc.imresize(
    my_data.astype(np.int32),
    size=..., interp=..., mode='I'
).astype(np.uint16)