CenterCrop

class CenterCrop(size: Int) : ImagePreprocessorBase

This image preprocessor defines centerCrop operation. It crops the given image at the center. If the image size is smaller than the output size along any edge, the image is padded with 0 and then center cropped.

Constructors

CenterCrop
Link copied to clipboard
fun CenterCrop(size: Int = -1)

Functions

apply
Link copied to clipboard
open override fun apply(image: BufferedImage): BufferedImage

Transforms provided input image.

getOutputShape
Link copied to clipboard
open override fun getOutputShape(inputShape: ImageShape): ImageShape

Computes output image shape for the provided inputShape. Note that some input dimensions could equal to null, which means that they are undefined. This is useful for the operations with fixed output size not dependent on the input size.

Properties

size
Link copied to clipboard
var size: Int

target image size.