cic

package
v0.0.0-...-2f9545d Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertImageToColouring

func ConvertImageToColouring(
	filename string,
	outputFilename string,
	sigma float64,
	upperThreshold int,
	lowerThreshold int,
	nonMaxSuppDist int,
	thickerThreshold int,
	thinnerThreshold int,
)

func DiscreteGaussian

func DiscreteGaussian(n int, t float64) float64

t of Discrete Gaussian is σ² of continuous Gaussian, i.e. the variance (square of standard deviation)

func GaussianBlur

func GaussianBlur(img *image.Gray, sigma float64) *image.Gray

func GaussianBlurColour

func GaussianBlurColour(img *image.RGBA, sigma float64) *image.RGBA

func GrayscaleImage

func GrayscaleImage(img image.Image) *image.Gray

func InvertGrayscaleImage

func InvertGrayscaleImage(img *image.Gray) *image.Gray

func KMeansImage

func KMeansImage(img *image.RGBA, k int) *image.RGBA

func ModBesselI0

func ModBesselI0(x float64) (ans float64)

ModBesselI0 returns the modified Bessel function I0(x) for any real x.

func ModBesselI1

func ModBesselI1(x float64) (ans float64)

ModBesselI1 returns the modified Bessel function I1(x) for any real x.

func ModBesselIn

func ModBesselIn(n int, x float64) (ans float64)

ModBesselIn returns the modified Bessel function In(x) for any real x and n ≥ 0

func ModBesselK0

func ModBesselK0(x float64) float64

ModBesselK0 returns the modified Bessel function K0(x) for positive real x.

Special cases:
  K0(x=0) = +Inf
  K0(x<0) = NaN

func ModBesselK1

func ModBesselK1(x float64) float64

ModBesselK1 returns the modified Bessel function K1(x) for positive real x.

Special cases:
  K0(x=0) = +Inf
  K0(x<0) = NaN

func ModBesselKn

func ModBesselKn(n int, x float64) float64

ModBesselKn returns the modified Bessel function Kn(x) for positive x and n ≥ 0

func PixelNonmaxSuppression

func PixelNonmaxSuppression(ig *ImageGradients, x, y, distance int) bool

Returns True if a pixel should be retained during non-max suppression, and False if it should be discarded.

func RgbToGray

func RgbToGray(c color.RGBA) color.Gray

func RunColourImageProc

func RunColourImageProc(filename string, outputFilename string)

[todo] -- add root app CLI options to colour processing

func RunKMeansImage

func RunKMeansImage(filename string, outputFilename string, k int)

func RunSeparateColourImageProc

func RunSeparateColourImageProc()

func SeparateColourSobelFilter

func SeparateColourSobelFilter(img *image.RGBA) (
	*ImageGradients, *ImageGradients, *ImageGradients)

func ThickenLineAtPixel

func ThickenLineAtPixel(img *image.Gray, x, y, thickness int, col color.Gray)

func ThickenLinesByDarkness

func ThickenLinesByDarkness(
	src *image.Gray,
	thickerThreshold uint8,
	thinnerThreshold uint8,
) *image.Gray

Types

type DiscreteGaussianKernel1D

type DiscreteGaussianKernel1D struct {
	Size          int
	Variance      float64
	ScalingFactor float64
	Elements      []float64
}

func CreateDiscreteGaussianKernel

func CreateDiscreteGaussianKernel(sigma float64) *DiscreteGaussianKernel1D

func (DiscreteGaussianKernel1D) String

func (dgk DiscreteGaussianKernel1D) String() string

type GradientDirection

type GradientDirection uint8

func CalcGradientDirection

func CalcGradientDirection(x, y int) GradientDirection

type HSVA

type HSVA struct {
	H       uint16
	S, V, A uint8
}

func (HSVA) RGBA

func (c HSVA) RGBA() (r, g, b, a uint32)

type ImageGradients

type ImageGradients struct {
	Value     [][]int
	Direction [][]GradientDirection
	X         int
	Y         int
}

func ColourSobelFilter

func ColourSobelFilter(img *image.RGBA) *ImageGradients

func CreateImageGradients

func CreateImageGradients(x, y int) *ImageGradients

func SobelFilter

func SobelFilter(img *image.Gray) *ImageGradients

func (*ImageGradients) BasicThresholdSuppression

func (ig *ImageGradients) BasicThresholdSuppression() *ImageGradients

func (*ImageGradients) FollowEdge

func (ig *ImageGradients) FollowEdge(x, y, upper, lower int, accEdges sets.Set[image.Point])

func (*ImageGradients) GrayscaleImage

func (ig *ImageGradients) GrayscaleImage() *image.Gray

func (*ImageGradients) LineFollowingThresholdSuppression

func (ig *ImageGradients) LineFollowingThresholdSuppression(upperThreshold, lowerThreshold int) *ImageGradients

func (*ImageGradients) NeighbourOverThreshold

func (ig *ImageGradients) NeighbourOverThreshold(x, y, thr int) bool

func (*ImageGradients) NonmaxSuppression

func (ig *ImageGradients) NonmaxSuppression(distance int) *ImageGradients

type KMeansClusters

type KMeansClusters struct {
	K        int
	Means    []Mean
	Clusters [][]Pixel
	CostVal  float64
}

func InitKMeans

func InitKMeans(k int) *KMeansClusters

func (*KMeansClusters) AssignClusterMeanValues

func (kmc *KMeansClusters) AssignClusterMeanValues(img *image.RGBA) *image.RGBA

func (*KMeansClusters) AssignClusters

func (kmc *KMeansClusters) AssignClusters(img *image.RGBA)

func (*KMeansClusters) CalculateMeans

func (kmc *KMeansClusters) CalculateMeans(img *image.RGBA)

func (*KMeansClusters) DistToMean

func (kmc *KMeansClusters) DistToMean(meanIdx int, px color.RGBA) float64

func (*KMeansClusters) PartlyRandomiseMeans

func (kmc *KMeansClusters) PartlyRandomiseMeans()

func (*KMeansClusters) RandomiseMeans

func (kmc *KMeansClusters) RandomiseMeans()

type Mean

type Mean struct {
	R uint8
	G uint8
	B uint8
}

type Pixel

type Pixel struct {
	X int
	Y int
}

type SobelKernel

type SobelKernel struct {
	Size      int
	Direction string
	Factors   [][]int
}

func CreateSobelKernel

func CreateSobelKernel(dir string) *SobelKernel

Jump to

Keyboard shortcuts

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