jax.image.resize

目录

jax.image.resize#

jax.image.resize(image, shape, method, antialias=True, precision=Precision.HIGHEST)[源代码][源代码]#

图像调整大小。

method 参数期望以下一种调整大小的方法:

ResizeMethod.NEAREST, "nearest"

最近邻插值antialiasprecision 的值被忽略。

ResizeMethod.LINEAR"linear""bilinear""trilinear""triangle"

线性插值。如果 antialiasTrue,则在缩小图像时使用三角形滤波器。

ResizeMethod.CUBIC"cubic""bicubic""tricubic"

三次插值,使用 Keys 三次核函数。

ResizeMethod.LANCZOS3, "lanczos3"

Lanczos 重采样,使用半径为3的核。

ResizeMethod.LANCZOS5"lanczos5"

Lanczos 重采样,使用半径为5的核。

参数:
  • image – 一个 JAX 数组。

  • shape (core.Shape) – 输出形状,作为一个整数序列,长度等于 image 的维度数。注意 resize() 不区分空间维度与批次或通道维度,因此这包括图像的所有维度。要表示批次或通道维度,只需保持该形状元素不变。

  • method (str | ResizeMethod) – 要使用的调整大小方法;可以是 ResizeMethod 实例或字符串。可用方法有:LINEAR, LANCZOS3, LANCZOS5, CUBIC。

  • antialias (bool) – 在降采样时是否应使用抗锯齿滤波器?默认为 True。在升采样时无效。

返回:

调整大小后的图像。