threshold

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2023 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OtsuThreshold

func OtsuThreshold(img *image.Gray, method Method) (*image.Gray, error)

OtsuThreshold returns a grayscale image which was segmented using Otsu's adaptive thresholding method. Methods: ThreshBinary, ThreshBinaryInv, ThreshTrunc, ThreshToZero, ThreshToZeroInv More info about Otsu's method: https://en.wikipedia.org/wiki/Otsu%27s_method

func Threshold

func Threshold(img *image.Gray, t uint8, method Method) (*image.Gray, error)

Threshold returns a 8 bit grayscale image as result which was segmented using one of the following methods: ThreshBinary, ThreshBinaryInv, ThreshTrunc, ThreshToZero, ThreshToZeroInv

func Threshold16

func Threshold16(img *image.Gray16, t uint16, method Method) (*image.Gray16, error)

Threshold16 returns a grayscale image represented on 16 bits as result which was segmented using one of the following Methods: ThreshBinary, ThreshBinaryInv, ThreshTrunc, ThreshToZero, ThreshToZeroInv

Types

type Method

type Method int

Method is an enum type for global threshold methods

const (
	// ThreshBinary
	//				 _
	//				| maxVal if src(x, y) > thresh
	// dst(x, y) =	|
	//				| 0 otherwise
	//				|_
	ThreshBinary Method = iota
	// ThreshBinaryInv
	//				 _
	//				| 0 if src(x, y) > thresh
	// dst(x, y) =	|
	//				| maxVal otherwise
	//				|_
	ThreshBinaryInv
	// ThreshTrunc
	//				 _
	//				| thresh if src(x, y) > thresh
	// dst(x, y) =	|
	//				| src(x, y) otherwise
	//				|_
	ThreshTrunc
	// ThreshToZero
	//				 _
	//				| src(x, y) if src(x, y) > thresh
	// dst(x, y) =	|
	//				| 0 otherwise
	//				|_
	ThreshToZero
	// ThreshToZeroInv
	//				 _
	//				| 0 if src(x, y) > thresh
	// dst(x, y) =	|
	//				| src(x, y) otherwise
	//				|_
	ThreshToZeroInv
)

Jump to

Keyboard shortcuts

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