Documentation ¶
Index ¶
- func IsSameSize(im1, im2 Image) bool
- type Batch
- type Color
- type EdgeType
- type Image
- func (image Image) AdaptiveToneShift(n uint8, shiftLeft bool) Image
- func (image Image) ApplyMask(mask Mask) (Image, error)
- func (image Image) Box(x, y, halfWidth int) Image
- func (image Image) Circle(x, y, r int) Image
- func (image Image) Copy() Image
- func (image Image) RandBox() Image
- func (image Image) RandCircle() Image
- func (image Image) RandScribe() Image
- func (image Image) RandTriangle() Image
- func (image Image) RawScaled() ImageRaw
- func (image Image) RawUnscaled() ImageRaw
- func (image Image) Size() (int, int, int)
- func (image Image) Slice(c Color) (Slice, error)
- type ImageProcessor
- type ImageRaw
- type Mask
- type Op
- func (op *Op) Decode(r io.Reader) (Image, error)
- func (op *Op) Encode(image Image) ([]byte, error)
- func (op *Op) GetStats(images ...ImageRaw) ([]Stats, error)
- func (op *Op) MakeBatch(height, width int, images ...Image) (Batch, error)
- func (op *Op) RGB2GrayScale(images ...Image) ([]Image, error)
- func (op *Op) Read(fileName string) (Image, error)
- func (op *Op) Resize(height, width int, images ...Image) ([]ImageRaw, error)
- func (op *Op) ResizeNormalize(height, width int, mean, std float32, images ...Image) ([]ImageRaw, error)
- func (op *Op) Sobel(images ...ImageRaw) ([]SobelRaw, error)
- func (op *Op) Write(image Image, fileName string) error
- type Operator
- type Slice
- type SliceRaw
- type SobelRaw
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsSameSize ¶
IsSameSize returns of two input images are of the same size.
Types ¶
type Image ¶
type Image [][][]uint8
Image defines format of data returned by TensorFlow after image decoding
func (Image) AdaptiveToneShift ¶
AdaptiveToneShift shifts the exposure by n counts either towards highlights of towards shadows (shiftLeft = true), but maintains the relative dynamic range by squeezing the histogram.
func (Image) ApplyMask ¶
ApplyMask creates a new image copying only those pixels from input image that have a corresponding mask value of true.
func (Image) RandCircle ¶
RandCircle draws random partially filled circle.
func (Image) RandScribe ¶
RandScribe draws a random scribe (line) on receiver image and modifies it before returning it.
func (Image) RandTriangle ¶
RandTriangle draws a random triangle on receiver image and modifies it before returning it.
func (Image) RawScaled ¶
RawScaled rescales byte based input image into a float32 based data and rescales it in the range [0, 1]
func (Image) RawUnscaled ¶
RawUnscaled rescales byte based input image into a float32 based data
type ImageProcessor ¶
type ImageProcessor interface { Size() (int, int, int) Slice(c Color) (Slice, error) Flatten(image Image, flattenFunc func(r, g, b uint8) uint8) Slice }
ImageProcessor works on an image producing various transformations
type ImageRaw ¶
type ImageRaw [][][]float32
func (ImageRaw) ToImageScaled ¶
func (ImageRaw) ToImageUnscaled ¶
type Mask ¶
type Mask [][]bool
Mask for an image.
func (Mask) InheritEdges ¶
func (mask Mask) InheritEdges(sobelRaw SobelRaw, edgeType EdgeType, f func(float32) bool, colors ...Color) error
InheritEdges updates mask with new edge data extracted from raw sobel data and a threshold.
func (Mask) ToSliceRaw ¶
ToSliceRaw converts a mask into a floating point equivalent image frame.
type Op ¶
Op is the operator for TF interface.
func NewOperator ¶
func NewOperator(options *tf.SessionOptions) (*Op, error)
NewOperator provides an operator that implements Operator interface for jpg images.
func (*Op) MakeBatch ¶
GetBatch performs batch grayscale, resize and normalization, producing a 2D matrix of float32.
func (*Op) RGB2GrayScale ¶
RGB2GrayScale reduces color image into a grayscale.
func (*Op) ResizeNormalize ¶
func (op *Op) ResizeNormalize(height, width int, mean, std float32, images ...Image) ([]ImageRaw, error)
ResizeNormalize resize and normalize input image using bilinear algorithm.
type Operator ¶
type Operator interface { // Read decodes input jpg file into an Image Read(fileName string) (Image, error) // Write writes image back to disk as a jpg file. Write(image Image, fileName string) error // Decode decodes byte buffer from reader into an Image Decode(r io.Reader) (Image, error) // Encode encodes image into byte buffer suitable for writing jpg file. Encode(image Image) ([]byte, error) // RGB2GrayScale converts input image into gray scale RGB2GrayScale(images ...Image) ([]Image, error) // Resize uses bilinear algorithm with alignCorners = true to resize an image. // height and width, when non positive, autoscale will decide the values. Resize(height, width int, images ...Image) ([]ImageRaw, error) // ResizeNormalize will resize and normalize images. It subtracts mean and then // divides by std. ResizeNormalize(height, width int, mean, std float32, images ...Image) ([]ImageRaw, error) // Sobel returns raw sobel output from sobel filter. Sobel(images ...ImageRaw) ([]SobelRaw, error) // Stats returns mean and variance for a raw image GetStats(images ...ImageRaw) ([]Stats, error) // Batch does following to each image: // * Convert to grayscale // * Resize // * Extract slide // * Normalize MakeBatch(height, width int, images ...Image) (Batch, error) }
Operator defines operations for working with images