jax.image.resize#
- jax.image.resize(image, shape, method, antialias=True, precision=Precision.HIGHEST)[source]#
图像大小调整。
method
参数应为以下调整大小方法之一ResizeMethod.NEAREST
,"nearest"
最近邻插值。
antialias
和precision
的值将被忽略。ResizeMethod.LINEAR
,"linear"
,"bilinear"
,"trilinear"
,"triangle"
线性插值。 如果
antialias
为True
,则在降采样时使用三角形滤波器。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
。 升采样时无效。
- 返回:
调整大小后的图像。