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
。升采样时无效。
- 返回:
调整大小后的图像。