Package org.jetbrains.kotlinx.dl.impl.preprocessing.image

Types

ArrayTransform
Link copied to clipboard
fun interface ArrayTransform

This interface represents a custom transformation of a FloatArray.

CenterCrop
Link copied to clipboard
class CenterCrop(size: Int) : Operation<BufferedImage, BufferedImage>

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.

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

Represents the number and order of color channels in the image.

Convert
Link copied to clipboard
class Convert(colorMode: ColorMode) : Operation<BufferedImage, BufferedImage>

Converts provided image to the desired ColorMode.

ConvertToFloatArray
Link copied to clipboard
class ConvertToFloatArray : Operation<BufferedImage, Pair<FloatArray, TensorShape>>

Converts BufferedImage to float array representation.

Cropping
Link copied to clipboard
class Cropping(top: Int, bottom: Int, left: Int, right: Int) : Operation<BufferedImage, BufferedImage>

This image preprocessor defines the Crop operation.

ImageConverter
Link copied to clipboard
object ImageConverter

Helper object with methods to convert BufferedImage to FloatArray.

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) : Operation<BufferedImage, BufferedImage>

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) : Operation<BufferedImage, BufferedImage>

This image preprocessor defines the Resize operation.

Rotate
Link copied to clipboard
class Rotate(degrees: Float, interpolation: InterpolationType, renderingSpeed: RenderingSpeed, enableAntialiasing: Boolean) : Operation<BufferedImage, BufferedImage>

This image preprocessor defines the Rotate operation.

Functions

argB8888ToNCHWArray
Link copied to clipboard
common
fun argB8888ToNCHWArray(encodedPixels: IntArray, width: Int, height: Int, channels: Int): FloatArray

Decodes an ARGB8888 encoded pixel array to a float array containing the red, green, blue components in NCWH layout.

argB8888ToNHWCArray
Link copied to clipboard
common
fun argB8888ToNHWCArray(encodedPixels: IntArray, width: Int, height: Int, channels: Int): FloatArray

Decodes an ARGB8888 encoded pixel array to a float array containing the red, green, blue components in NHWC layout.

centerCrop
Link copied to clipboard
fun <I> Operation<I, BufferedImage>.centerCrop(block: CenterCrop.() -> Unit): Operation<I, BufferedImage>

Applies CenterCrop operation to crop the image at the center.

convert
Link copied to clipboard
fun <I> Operation<I, BufferedImage>.convert(block: Convert.() -> Unit): Operation<I, BufferedImage>

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

crop
Link copied to clipboard
fun <I> Operation<I, BufferedImage>.crop(block: Cropping.() -> Unit): Operation<I, BufferedImage>

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

decodeARGB8888Pixel
Link copied to clipboard
common
fun decodeARGB8888Pixel(pixelValue: Int): <ERROR CLASS><Float, Float, Float>

Decodes an ARGB8888 encoded pixel to a red, green, blue components.

denormalizeInplace
Link copied to clipboard
fun denormalizeInplace(input: FloatArray, scale: Float): FloatArray

Each array element of an input is multiplied in-place by scale coefficient.

grayscale
Link copied to clipboard
fun <I> Operation<I, BufferedImage>.grayscale(): Operation<I, BufferedImage>

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

imageType
Link copied to clipboard
fun ColorMode.imageType(): Int

Returns an integer representing a type of BufferedImage corresponding to this color mode.

pad
Link copied to clipboard
fun <I> Operation<I, BufferedImage>.pad(block: Padding.() -> Unit): Operation<I, BufferedImage>

Applies Padding operation to pad the image.

resize
Link copied to clipboard
fun <I> Operation<I, BufferedImage>.resize(block: Resize.() -> Unit): Operation<I, BufferedImage>

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

rotate
Link copied to clipboard
fun <I> Operation<I, BufferedImage>.rotate(block: Rotate.() -> Unit): Operation<I, BufferedImage>

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

toFloatArray
Link copied to clipboard
fun <I> Operation<I, BufferedImage>.toFloatArray(block: ConvertToFloatArray.() -> Unit): Operation<I, Pair<FloatArray, TensorShape>>

Applies ConvertToFloatArray operation to convert the image to a float array.