ImageTools

package
v0.0.0-...-80e4855 Latest Latest
Warning

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

Go to latest
Published: May 9, 2021 License: GPL-3.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsoluteError

func AbsoluteError(a [][]float32, b [][]float32) (float32, float32, float32)

* Calculates the Root Mean Absolute Error (RMAE), Mean Absolute Error (MAE), Sum Absolute Error (SAE) of two images * These metrics are combined into one function for computational efficiency

func Acos

func Acos(image [][]float32) [][]float32

* Calculates the pixelwise arccosine of an image * The output is normalised in the range 0-1 (inclusive), while preserving dynamic range

func AddImage

func AddImage(a [][]float32, b [][]float32, normalise bool) ([][]float32, error)

* Calculates the pixelwise sum of two images * The output is normalised in the range 0-1 (inclusive), while preserving dynamic range

func AddScalar

func AddScalar(a [][]float32, b float32, normalise bool) ([][]float32, error)

* Calculates the sum of an image and a scalar * The output is normalised in the range 0-1 (inclusive), while preserving dynamic range, if the normalise arg is true

func Asin

func Asin(image [][]float32) [][]float32

* Calculates the pixelwise arcsine of an image * The output is normalised in the range 0-1 (inclusive), while preserving dynamic range

func Atan

func Atan(image [][]float32) [][]float32

* Calculates the pixelwise arctangent of an image * The output is normalised in the range 0-1 (inclusive), while preserving dynamic range

func BinaryClosing

func BinaryClosing(image [][]float32, size int) [][]float32

* Performs morphological closing of a binarised image

func BinaryDilation

func BinaryDilation(image [][]float32, size int) [][]float32

* Performs morphological dilation of a binarised image

func BinaryErosion

func BinaryErosion(image [][]float32, size int) [][]float32

* Performs morphological erosion of a binarised image

func BinaryOpening

func BinaryOpening(image [][]float32, size int) [][]float32

* Performs morphological opening of a binarised image

func Convolution

func Convolution(image [][]float32, kernel [][]float32, normalise bool) [][]float32

* Applies a kernel convolution to an image

func Cos

func Cos(image [][]float32) [][]float32

* Calculates the pixelwise cosine of an image * The output is normalised in the range 0-1 (inclusive), while preserving dynamic range

func CrossCorrelation

func CrossCorrelation(a [][]float32, b [][]float32) float32

* Calculates the Zero-Normalised CrossCorrelation (ZNCC) of two images

func Dimensions

func Dimensions(image [][]float32) (int, int)

* Returns the width and height of an image

func DivideImage

func DivideImage(a [][]float32, b [][]float32, normalise bool) ([][]float32, error)

* Calculates the pixelwise quotient of two images * The output is normalised in the range 0-1 (inclusive), while preserving dynamic range

func DivideScalar

func DivideScalar(a [][]float32, b float32, normalise bool) ([][]float32, error)

* Calculates the quotient of an image and a scalar * The output is normalised in the range 0-1 (inclusive), while preserving dynamic range, if the normalise arg is true

func DualThreshold

func DualThreshold(image [][]float32, thresholdA float32, thresholdB float32) [][]float32

* Thresholds an image with 2 thresholds * White pixel if it's between the thresholds, otherwise black

func GradientMagnitude

func GradientMagnitude(image [][]float32) [][]float32

* Calculates the gradient magnitude at each pixel in an image

func HysteresisThreshold

func HysteresisThreshold(image [][]float32, thresholdA float32, thresholdB float32) [][]float32

func Image2Slice

func Image2Slice(img image.Image) [][]float32

* Takes an Image and converts it to a 2D slice of 32-bit floating points * Also converts the image to grayscale and normialises all pixels in the range 0-1 (inclusive)

func Invert

func Invert(image [][]float32) [][]float32

* Inverts an image, while preserving dynamic range

func L2Norm

func L2Norm(signature []int) float32

* Computes the L2 Norm of a signature vector

func LoadImage

func LoadImage(path string) ([][]float32, error)

* Loads an image from a file

func Mask

func Mask(image [][]float32, mask [][]float32) ([][]float32, error)

func MeanStd

func MeanStd(image [][]float32) (float32, float32)

* Calculates the mean and (population) standard deviation of an image * The two metrics are combined because the mean is needed to calculate the std, so it is more efficient to calculate them both together

func MinMax

func MinMax(image [][]float32) (float32, float32)

* Finds the dimmest and brightest pixels in an image

func MultiplyImage

func MultiplyImage(a [][]float32, b [][]float32, normalise bool) ([][]float32, error)

* Calculates the pixelwise product of two images * The output is normalised in the range 0-1 (inclusive), while preserving dynamic range

func MultiplyScalar

func MultiplyScalar(a [][]float32, b float32, normalise bool) ([][]float32, error)

* Calculates the product of an image and a scalar * The output is normalised in the range 0-1 (inclusive), while preserving dynamic range, if the normalise arg is true

func Normalise

func Normalise(image [][]float32) [][]float32

* Normalises all pixel values in the range 0-1 inclusive, while preserving dynamic range

func PixelOrientation

func PixelOrientation(image [][]float32) [][]float32

* Calculates the orientation of each pixel in an image

func RGBA2Gray16

func RGBA2Gray16(img image.Image) image.Image

* Converts an RGBA image to Gray16

func SaveImage

func SaveImage(path string, image [][]float32) error

* Saves an image to a file

func SepConvolution

func SepConvolution(image [][]float32, kernelA [][]float32, kernelB [][]float32, normalise bool) [][]float32

* Applies a separated kernel convolution to an image

func SignatureDifference

func SignatureDifference(sigA []int, sigB []int) float32

* Calculates the normalised difference between two signature vectors * Distance from A to B is always the same as distance from B to A

func SignatureVector

func SignatureVector(image [][]float32) []int

* Computes a signature of an image using the algorithm described in https://doi.org/10.1109/ICIP.2002.1038047

func Sin

func Sin(image [][]float32) [][]float32

* Calculates the pixelwise sine of an image * The output is normalised in the range 0-1 (inclusive), while preserving dynamic range

func SingleThreshold

func SingleThreshold(image [][]float32, threshold float32) [][]float32

* Thresholds an image with a single threshold

func Slice2Image

func Slice2Image(slice [][]float32) (image.Image, error)

* Takes a 2D slice of floating points representing a grayscale image and returns an Image * Note that all pixel values are assumed to be normalised in the range 0-1, so they are all multiplied by the maximum pixel value (65536), so the image can be displayed

func Sqrt

func Sqrt(image [][]float32, normalise bool) [][]float32

* Calculates the pixelwise square root of an image * The output is normalised in the range 0-1 (inclusive), while preserving dynamic range

func SquareError

func SquareError(a [][]float32, b [][]float32) (float32, float32, float32)

* Calculates the Root Mean Square Error (RMSE), Mean Square Error (MSE), Sum Square Error (SSE) of two images * These metrics are combined into one function for computational efficiency

func SubImage

func SubImage(image [][]float32, topLeftX int, topLeftY int, width int, height int) [][]float32

* Returns a subset of an image. Sometimes called a region of interest (ROI) * Any pixels in the sub-image that go off the edge of the original are set to 0, so no panic condition is generated

func SubtractImage

func SubtractImage(a [][]float32, b [][]float32, normalise bool) ([][]float32, error)

* Calculates the pixelwise difference of two images * The output is normalised in the range 0-1 (inclusive), while preserving dynamic range

func SubtractScalar

func SubtractScalar(a [][]float32, b float32, normalise bool) ([][]float32, error)

* Calculates the difference of an image and a scalar * The output is normalised in the range 0-1 (inclusive), while preserving dynamic range, if the normalise arg is true

func Tan

func Tan(image [][]float32) [][]float32

* Calculates the pixelwise tangent of an image * The output is normalised in the range 0-1 (inclusive), while preserving dynamic range

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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