dog

package
v2.0.0-dev0.0.10 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

package dog provides the Difference-of-Gaussians (DoG) filter for visual and other forms of signal processing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GaussDenSig

func GaussDenSig(x, sig float32) float32

GaussDenSig returns gaussian density for given value and sigma

Types

type Filter

type Filter struct {

	// is this filter active?
	On bool

	// how much relative weight does this filter have when combined with other filters
	Wt float32

	// overall gain multiplier applied after dog filtering -- only relevant if not using renormalization (otherwize it just gets renormed away)
	Gain float32 `default:"8"`

	// gain for the on component of filter, only relevant for color-opponent DoG's
	OnGain float32 `default:"1"`

	// size of the overall filter -- number of pixels wide and tall for a square matrix used to encode the filter -- filter is centered within this square -- typically an even number, min effective size ~6
	Size int

	// how far apart to space the centers of the dog filters -- 1 = every pixel, 2 = every other pixel, etc -- high-res should be 1 or 2, lower res can be increments therefrom
	Spacing int

	// gaussian sigma for the narrower On gaussian, in normalized units relative to Size
	OnSig float32 `default:"0.125"`

	// gaussian sigma for the wider Off gaussian, in normalized units relative to Size
	OffSig float32 `default:"0.25"`

	// cut off the filter (to zero) outside a circle of diameter = Size -- makes the filter more radially symmetric
	CircleEdge bool `default:"true"`
}

dog.Filter specifies a DoG Difference of Gaussians filter function.

func (*Filter) Defaults

func (gf *Filter) Defaults()

func (*Filter) FilterTensor

func (gf *Filter) FilterTensor(tsr *etensor.Float32, filt Filters) *etensor.Float32

FilterTensor extracts the given filter subspace from set of 3 filters in input tensor 0 = On, 1 = Off, 2 = Net

func (*Filter) SetSize

func (gf *Filter) SetSize(sz, spc int)

SetSize sets the size and spacing -- these are the main params that need to be varied for standard V1 dogs.

func (*Filter) ShouldShow

func (gf *Filter) ShouldShow(field string) bool

func (*Filter) ToTable

func (gf *Filter) ToTable(tab *etable.Table)

ToTable renders filters into the given etable.Table setting a column named Version and a column named Filter to the filter for that version (on, off, net) This is useful for display and validation purposes.

func (*Filter) ToTensor

func (gf *Filter) ToTensor(tsr *etensor.Float32)

ToTensor renders dog filters into the given etable etensor.Tensor, setting dimensions to [3][Y][X] where Y = X = Size, and first one is On-filter, second is Off-filter, and third is Net On - Off

func (*Filter) Update

func (gf *Filter) Update()

type Filters

type Filters int

Filters is the type of filter

const (
	On Filters = iota
	Off
	Net
	FiltersN
)

Jump to

Keyboard shortcuts

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