As a computation unit for processing images, it could resize image to predefined size.

It will not stretch or compress the content of image. However, to fit the new size, it crops or pads pixels. When it crops image, it performs a center-crop; when it pads pixels, it performs a zero-padding.

• ```for reszing images while stretching / compressing the content. ```

### Public Methods

 TensorImage apply(TensorImage image) Applies the defined resizing with cropping or/and padding 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.

## Public Constructors

#### public ResizeWithCropOrPadOp(int targetHeight, int targetWidth)

##### Parameters
targetHeight The expected height of cropped/padded image. The expected width of cropped/padded image.

## Public Methods

#### public TensorImage apply(TensorImage image)

Applies the defined resizing with cropping or/and padding 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.

#### public int getOutputImageWidth(int inputImageHeight, int inputImageWidth)

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

#### 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. the height of input image. the width of input image.
##### Returns
• the point with the coordinates from the coordinates system of the input image.
[]
[]