image

package
v0.0.0-...-1611311 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2023 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Box

type Box struct {
	Start, End Point
}

Box represents the coordinates of 2 points in the space

type Image

type Image struct {
	*tfgo.Tensor
}

Image is the type that abstracts a Tensorflow tensor representing an image. The image is always a float32 value unless manually casted.

func NewImage

func NewImage(scope *op.Scope, tensor tf.Output) *Image

NewImage creates an *Image from a 3 or 4D input tensor Place the created image within the specified scope

func Read

func Read(scope *op.Scope, imagePath string, channels int64) *Image

Read searches for the `imagePath` extensions and uses the Read<format> function to decode and load the right image. Panics if the format is unknown.

func ReadGIF

func ReadGIF(scope *op.Scope, imagePath string) *Image

ReadGIF reads the GIF image whose path is `imagePath` and returns an Image

func ReadJPEG

func ReadJPEG(scope *op.Scope, imagePath string, channels int64) *Image

ReadJPEG reads the JPEG image whose path is `imagePath` that has `channels` channels it returns an Image

func ReadPNG

func ReadPNG(scope *op.Scope, imagePath string, channels int64) *Image

ReadPNG reads the PNG image whose path is `imagePath` that has `channels` channels it returns an Image

func (*Image) Add

func (image *Image) Add(tfout tf.Output) *Image

Add defines the add operation between the image and tfout `tfout` dtype is converted to image.Dtype() before adding

func (*Image) AdjustBrightness

func (image *Image) AdjustBrightness(delta float32) *Image

AdjustBrightness adds delta to the image

func (*Image) AdjustContrast

func (image *Image) AdjustContrast(contrastFactor float32) *Image

AdjustContrast changes the contrast by contrastFactor

func (*Image) AdjustGamma

func (image *Image) AdjustGamma(gamma, gain float32) *Image

AdjustGamma performs gamma correction on the image

func (*Image) AdjustHue

func (image *Image) AdjustHue(delta float32) *Image

AdjustHue changes toe Hue by delta

func (*Image) AdjustSaturation

func (image *Image) AdjustSaturation(saturationFactor float32) *Image

AdjustSaturation changes the saturation by saturationFactor

func (*Image) Cast

func (image *Image) Cast(dtype tf.DataType) *Image

Cast casts the current image tensor to the requested type

func (*Image) Center

func (image *Image) Center() *Image

Center computes the mean value of the pixel values and subtracts this value from every pixel: this operation centers the data

func (*Image) CentralCrop

func (image *Image) CentralCrop(centralFraction float32) *Image

CentralCrop extracts from the center of the image a portion of image with an area equals to the centralFraction

func (*Image) Clone

func (image *Image) Clone() *Image

Clone returns a copy of the current image in a new scope Clone must be used when one want to create a different image from the output of an operation.

func (*Image) ConvertDtype

func (image *Image) ConvertDtype(dtype tf.DataType, saturate bool) *Image

ConvertDtype converts the Image dtype to dtype, uses SaturatesCast if required

func (*Image) Convolve

func (image *Image) Convolve(filter tf.Output, stride Stride, padding padding.Padding) *Image

Convolve executes the convolution operation between the current image and the passed filter The strides parameter rules the stride along each dimension Padding is a padding type to specify the type of padding

func (*Image) Correlate

func (image *Image) Correlate(filter tf.Output, stride Stride, padding padding.Padding) *Image

Correlate executes the correlation operation between the current image and the passed filter The strides parameter rules the stride along each dimension Padding is a padding type to specify the type of padding

func (*Image) CropAndResize

func (image *Image) CropAndResize(box Box, size Size, optional ...op.CropAndResizeAttr) *Image

CropAndResize crops the image to the specified box and resizes the result to size

func (*Image) Dilate

func (image *Image) Dilate(filter tf.Output, stride, rate Stride, padding padding.Padding) *Image

Dilate executes the dilatation operation between the current image and the padded filter The strides parameter rules the stride along each dimension, in output. The rate parameter rules the input stride for atrous morphological dilatation Padding is a padding type to specify the type of padding

func (*Image) DrawBoundingBoxes

func (image *Image) DrawBoundingBoxes(boxes []Box) *Image

DrawBoundingBoxes draws the specified boxes to the image

func (*Image) EncodeJPEG

func (image *Image) EncodeJPEG(optional ...op.EncodeJpegAttr) tf.Output

EncodeJPEG encodes the image in the JPEG format and returns an evaluable tensor

func (*Image) EncodePNG

func (image *Image) EncodePNG(optional ...op.EncodePngAttr) tf.Output

EncodePNG encodes the image in the PNG format and returns an evaluable tensor

func (*Image) Erode

func (image *Image) Erode(filter tf.Output, stride, rate Stride, padding padding.Padding) *Image

Erode executes the erosion operation between the current image and the padded filter The strides parameter rules the stride along each dimension The rate parameter rules the input stride for atrous morphological dilatation Padding is a padding type to specify the type of padding

func (*Image) ExtractGlimpse

func (image *Image) ExtractGlimpse(size Size, offset Point, optional ...op.ExtractGlimpseAttr) tf.Output

ExtractGlimpse extracts a glimpse with the specified size at the specified offset

func (*Image) HSVToRGB

func (image *Image) HSVToRGB() *Image

HSVToRGB performs the colorspace transformation from HSV to RGB

func (*Image) Mul

func (image *Image) Mul(tfout tf.Output) *Image

Mul defines the multiplication operation between the tensor and `tfout`. `tfout` dtype is converted to tensor.Dtype() before multiplying

func (*Image) Normalize

func (image *Image) Normalize() *Image

Normalize computes the mean and the stddev of the pixel values and normalizes every pixel subtracting the mean (centering) and dividing by the stddev (scale)

func (*Image) Pow

func (image *Image) Pow(y tf.Output) *Image

Pow defines the pow operation x^y, where x are the image values y dtype is converted to image.Dtype() before executing Pow

func (*Image) RGBToGrayscale

func (image *Image) RGBToGrayscale() *Image

RGBToGrayscale converts the image from RGB to Grayscale

func (*Image) RGBToHSV

func (image *Image) RGBToHSV() *Image

RGBToHSV performs the colorspace transformation from RGB to HSV

func (*Image) ResizeArea

func (image *Image) ResizeArea(size Size, optional ...op.ResizeAreaAttr) *Image

ResizeArea resizes the image to the specified size using the Area interpolation

func (*Image) ResizeBicubic

func (image *Image) ResizeBicubic(size Size, optional ...op.ResizeBicubicAttr) *Image

ResizeBicubic resizes the image to the specified size using the Bicubic interpolation

func (*Image) ResizeBilinear

func (image *Image) ResizeBilinear(size Size, optional ...op.ResizeBilinearAttr) *Image

ResizeBilinear resizes the image to the specified size using the Bilinear interpolation

func (*Image) ResizeNearestNeighbor

func (image *Image) ResizeNearestNeighbor(size Size, optional ...op.ResizeNearestNeighborAttr) *Image

ResizeNearestNeighbor resizes the image to the specified size using the NN interpolation

func (*Image) SaturateCast

func (image *Image) SaturateCast(dtype tf.DataType) *Image

SaturateCast casts the image to dtype handling overflow and underflow problems, saturate the exceeding values to to minimum/maximum accepted value of the dtype

func (*Image) Scale

func (image *Image) Scale(min, max float32) *Image

Scale scales the image range value to be within [min, max]

func (*Image) Sqrt

func (image *Image) Sqrt() *Image

Sqrt defines the square root operation for the image values

func (*Image) Square

func (image *Image) Square() *Image

Square defines the square operation for the image values

func (*Image) Value

func (image *Image) Value() tf.Output

Value returns the 3D tensor that represents a single image in the Tensorflow environment. If the image is a GIF the returned tensor is 4D

type Point

type Point struct {
	X, Y float32
}

Point represents a single point in the 2D space

type Rectangle

type Rectangle struct {
	Start  Point
	Extent Size
}

Rectangle represents a rectangle in the 2D space. This rectangle starts from the Point Start and has a specified Extent

type Size

type Size struct {
	Height, Width float32
}

Size represents the spatial extent of an Image

type Stride

type Stride struct {
	X, Y int64
}

Stride represents the amount in pixel to move along each dimension

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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