tf.image.resize_images( images, size, method=ResizeMethod.BILINEAR, align_corners=False )
Defined in tensorflow/python/ops/image_ops_impl.py
.
See the guide: Images > Resizing
Resize images
to size
using the specified method
.
Resized images will be distorted if their original aspect ratio is not the same as size
. To avoid distortions see tf.image.resize_image_with_crop_or_pad
.
method
can be one of:
ResizeMethod.BILINEAR
: Bilinear interpolation.
ResizeMethod.NEAREST_NEIGHBOR
: Nearest neighbor interpolation.
ResizeMethod.BICUBIC
: Bicubic interpolation.
ResizeMethod.AREA
: Area interpolation.The return value has the same type as images
if method
is ResizeMethod.NEAREST_NEIGHBOR
. It will also have the same type as images
if the size of images
can be statically determined to be the same as size
, because images
is returned in this case. Otherwise, the return value has type float32
.
images
: 4-D Tensor of shape [batch, height, width, channels]
or 3-D Tensor of shape [height, width, channels]
.size
: A 1-D int32 Tensor of 2 elements: new_height, new_width
. The new size for the images.method
: ResizeMethod. Defaults to ResizeMethod.BILINEAR
.align_corners
: bool. If True, the centers of the 4 corner pixels of the input and output tensors are aligned, preserving the values at the corner pixels. Defaults to False
.ValueError
: if the shape of images
is incompatible with the shape arguments to this functionValueError
: if size
has invalid shape or type.ValueError
: if an unsupported resize method is specified.If images
was 4-D, a 4-D float Tensor of shape [batch, new_height, new_width, channels]
. If images
was 3-D, a 3-D float Tensor of shape [new_height, new_width, channels]
.
© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/image/resize_images