scale_and_translate(image, shape, spatial_dims, scale, translation, method, antialias=True, precision=<PrecisionConfig_Precision.HIGHEST: 2>)¶
Apply a scale and translation to an image.
Generates a new image of shape ‘shape’ by resampling from the input image using the sampling method corresponding to method. For 2D images, this operation transforms a location in the input images, (x, y), to a location in the output image according to:
(x * scale + translation, y * scale + translation)
(Note the _inverse_ warp is used to generate the sample locations.) Assumes half-centered pixels, i.e the pixel at integer location row,col has coordinates y, x = row + 0.5, col + 0.5. Similarly for other input image dimensions.
If an output location(pixel) maps to an input sample location that is outside the input boundaries then the value for the output location will be set to zero.
methodargument expects one of the following resize methods:
"triangle"Linear interpolation. If
True, uses a triangular filter when downsampling.
Cubic interpolation, using the Keys cubic kernel.
Lanczos resampling, using a kernel of radius 3.
Lanczos resampling, using a kernel of radius 5.
image – a JAX array.
scale – A [K] array with the same number of dimensions as image, containing the scale to apply in each dimension.
translation – A [K] array with the same number of dimensions as image, containing the translation to apply in each dimension.
bool) – Should an antialiasing filter be used when downsampling? Defaults to
True. Has no effect when upsampling.
The scale and translated image.