Package org.jetbrains.kotlinx.dl.dataset.preprocessor.image

Types

CenterCrop
Link copied to clipboard
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.

Convert
Link copied to clipboard
class Convert(colorMode: ColorMode) : ImagePreprocessorBase

Converts provided image to the desired ColorMode.

Cropping
Link copied to clipboard
class Cropping(top: Int, bottom: Int, left: Int, right: Int) : ImagePreprocessorBase

This image preprocessor defines the Crop operation.

ImagePreprocessing
Link copied to clipboard
class ImagePreprocessing

Represents the image preprocessing stage of the org.jetbrains.kotlinx.dl.dataset.preprocessor.Preprocessing. Consists of the operations implementing ImagePreprocessing which are applied to the image one by one.

ImagePreprocessor
Link copied to clipboard
interface ImagePreprocessor

Basic interface for image preprocessors. It operates on BufferedImage.

ImagePreprocessorBase
Link copied to clipboard
abstract class ImagePreprocessorBase : ImagePreprocessor

Base class for ImagePreprocessor implementations. Allows to add additional features, such as saving output with ImageSaver.

ImageSaver
Link copied to clipboard
interface ImageSaver

Interface for saving image preprocessing output result.

InterpolationType
Link copied to clipboard
enum InterpolationType : Enum<InterpolationType>

When an image is resized, we need an interpolation algorithm to draw newly created pixels between old pixels.

Padding
Link copied to clipboard
class Padding(top: Int, bottom: Int, left: Int, right: Int, mode: PaddingMode) : ImagePreprocessorBase

This image preprocessor defines the Pad operation.

PaddingMode
Link copied to clipboard
interface PaddingMode

Type of padding to use.

RenderingSpeed
Link copied to clipboard
enum RenderingSpeed : Enum<RenderingSpeed>

The speed of single file preprocessing could be tuned via this setting.

Resize
Link copied to clipboard
class Resize(outputWidth: Int, outputHeight: Int, interpolation: InterpolationType, renderingSpeed: RenderingSpeed, enableAntialiasing: Boolean) : ImagePreprocessorBase

This image preprocessor defines the Resize operation.

Rotate
Link copied to clipboard
class Rotate(degrees: Float, interpolation: InterpolationType, renderingSpeed: RenderingSpeed, enableAntialiasing: Boolean) : ImagePreprocessorBase

This image preprocessor defines the Rotate operation.

Save
Link copied to clipboard
class Save(dirLocation: File?) : ImageSaver

This ImageSaver allows saving image preprocessing result to file or directory in jpg format.

Functions

centerCrop
Link copied to clipboard
fun ImagePreprocessing.centerCrop(block: CenterCrop.() -> Unit)

Applies CenterCrop operation to crop the image at the center.

convert
Link copied to clipboard
fun ImagePreprocessing.convert(block: Convert.() -> Unit)

Applies Convert operation to convert the image to a different ColorMode.

crop
Link copied to clipboard
fun ImagePreprocessing.crop(block: Cropping.() -> Unit)

Applies Cropping operation to crop the image by the specified amount.

grayscale
Link copied to clipboard
fun ImagePreprocessing.grayscale()

Applies Convert operation to convert the image to ColorMode.GRAYSCALE.

pad
Link copied to clipboard
fun ImagePreprocessing.pad(block: Padding.() -> Unit)

Applies Padding operation to pad the image.

resize
Link copied to clipboard
fun ImagePreprocessing.resize(block: Resize.() -> Unit)

Applies Resize operation to resize the image to a specific size.

rotate
Link copied to clipboard
fun ImagePreprocessing.rotate(block: Rotate.() -> Unit)

Applies Rotate operation to rotate the image by an arbitrary angle (specified in degrees).

save
Link copied to clipboard
fun ImagePreprocessorBase.save(block: Save.() -> Unit)

Saves the result of the enclosing ImagePreprocessor to the specified location.