preprocess

package
v0.0.0-...-7e7f144 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImageData

type ImageData struct {
	Pixels   []float32
	Width    int
	Height   int
	Channels int
	OrigSize image.Point
}

ImageData represents preprocessed image data ready for model inference

func ProcessImage

func ProcessImage(img image.Image, opts ProcessImageOptions) (*ImageData, error)

ProcessImage preprocesses an image according to the specified options

type ProcessImageOptions

type ProcessImageOptions struct {
	Width      int
	Height     int
	MinEdge    int
	MaxEdge    int
	Mode       ResizeMode
	Mean       [3]float32
	StdDev     [3]float32
	CenterCrop bool
}

ProcessImageOptions contains all preprocessing configuration

type ResizeMode

type ResizeMode int

ResizeMode defines how to handle image resizing

const (
	// ResizeFixed resizes to exact dimensions
	ResizeFixed ResizeMode = iota
	// ResizeAspectFill maintains aspect ratio, fills target size
	ResizeAspectFill
	// ResizeAspectFit maintains aspect ratio, fits within target size
	ResizeAspectFit
	// ResizeWithEdges maintains aspect ratio with min/max edge constraints
	ResizeWithEdges
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL