Back to Tensorflow

ResizeOp

tensorflow/lite/g3doc/api_docs/java/org/tensorflow/lite/support/image/ops/ResizeOp.html

2.21.06.3 KB
Original Source

public class ResizeOp

As a computation unit for processing images, it can resize an image to user-specified size.

It interpolates pixels when image is stretched, and discards pixels when image is compressed.

See Also
  • for resizing without content distortion.

Nested Classes

| enum | ResizeOp.ResizeMethod | Algorithms for resizing. |

Public Constructors

| | ResizeOp(int targetHeight, int targetWidth, ResizeOp.ResizeMethod resizeMethod) Creates a ResizeOp which can resize images to specified size in specified method.

|

Public Methods

| TensorImage | apply(TensorImage image) Applies the defined resizing on given image and returns the result.

| | int | getOutputImageHeight(int inputImageHeight, int inputImageWidth) Computes the height of the expected output image when input image size is given.

| | int | getOutputImageWidth(int inputImageHeight, int inputImageWidth) Computes the width of the expected output image when input image size is given.

| | PointF | inverseTransform(PointF point, int inputImageHeight, int inputImageWidth) Transforms a point from coordinates system of the result image back to the one of the input image.

|

Inherited Methods

From class java.lang.Object

| boolean | equals(Object arg0) | | final Class<?> | getClass() | | int | hashCode() | | final void | notify() | | final void | notifyAll() | | String | toString() | | final void | wait(long arg0, int arg1) | | final void | wait(long arg0) | | final void | wait() |

From interface org.tensorflow.lite.support.image.ImageOperator

| abstract TensorImage | apply(TensorImage image) | | abstract int | getOutputImageHeight(int inputImageHeight, int inputImageWidth) Computes the height of the expected output image when input image size is given.

| | abstract int | getOutputImageWidth(int inputImageHeight, int inputImageWidth) Computes the width of the expected output image when input image size is given.

| | abstract PointF | inverseTransform(PointF point, int inputImageHeight, int inputImageWidth) Transforms a point from coordinates system of the result image back to the one of the input image.

|

From interface org.tensorflow.lite.support.common.Operator

| abstract TensorImage | apply(TensorImage x) Applies an operation on a T object, returning a T object.

|

Public Constructors

public ResizeOp (int targetHeight, int targetWidth, ResizeOp.ResizeMethod resizeMethod)

Creates a ResizeOp which can resize images to specified size in specified method.

Parameters

| targetHeight | The expected height of resized image. | | targetWidth | The expected width of resized image. | | resizeMethod | The algorithm to use for resizing. Options: ResizeOp.ResizeMethod |

Public Methods

public TensorImage apply (TensorImage image)

Applies the defined resizing on given image and returns the result.

Note: the content of input image will change, and image is the same instance with the output.

Parameters

| image | input image. |

Returns
  • output image.

public int getOutputImageHeight (int inputImageHeight, int inputImageWidth)

Computes the height of the expected output image when input image size is given.

Parameters

| inputImageHeight | | | inputImageWidth | |

public int getOutputImageWidth (int inputImageHeight, int inputImageWidth)

Computes the width of the expected output image when input image size is given.

Parameters

| inputImageHeight | | | inputImageWidth | |

public PointF inverseTransform (PointF point, int inputImageHeight, int inputImageWidth)

Transforms a point from coordinates system of the result image back to the one of the input image.

Parameters

| point | the point from the result coordinates system. | | inputImageHeight | the height of input image. | | inputImageWidth | the width of input image. |

Returns
  • the point with the coordinates from the coordinates system of the input image.