dog

package
v1.1.19 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: BSD-3-Clause Imports: 3 Imported by: 4

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 `desc:"is this filter active?"`

	// [viewif: On] how much relative weight does this filter have when combined with other filters
	Wt float32 `viewif:"On" desc:"how much relative weight does this filter have when combined with other filters"`

	// [def: 8] [viewif: On] overall gain multiplier applied after dog filtering -- only relevant if not using renormalization (otherwize it just gets renormed away)
	Gain float32 `` /* 163-byte string literal not displayed */

	// [def: 1] [viewif: On] gain for the on component of filter, only relevant for color-opponent DoG's
	OnGain float32 `viewif:"On" def:"1" desc:"gain for the on component of filter, only relevant for color-opponent DoG's"`

	// [viewif: On] 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 `` /* 217-byte string literal not displayed */

	// [viewif: On] 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 `` /* 187-byte string literal not displayed */

	// [def: 0.125] [viewif: On] gaussian sigma for the narrower On gaussian, in normalized units relative to Size
	OnSig float32 `viewif:"On" def:"0.125" desc:"gaussian sigma for the narrower On gaussian, in normalized units relative to Size"`

	// [def: 0.25] [viewif: On] gaussian sigma for the wider Off gaussian, in normalized units relative to Size
	OffSig float32 `viewif:"On" def:"0.25" desc:"gaussian sigma for the wider Off gaussian, in normalized units relative to Size"`

	// [def: true] [viewif: On] cut off the filter (to zero) outside a circle of diameter = Size -- makes the filter more radially symmetric
	CircleEdge bool `` /* 138-byte string literal not displayed */
}

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) 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