gabor

package
v2.0.0-dev0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: BSD-3-Clause Imports: 5 Imported by: 2

Documentation

Overview

package gabor provides a gabor filter for visual and other forms of signal processing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 filtering -- only relevant if not using renormalization (otherwize it just gets renormed away)
	Gain float32 `default:"2"`

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

	// wavelength of the sine waves -- number of pixels over which a full period of the wave takes place -- typically same as Size (computation adds a 2 PI factor to translate into pixels instead of radians)
	WvLen float32

	// how far apart to space the centers of the gabor 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 length dimension (elongated axis perpendicular to the sine waves) -- as a normalized proportion of filter Size
	SigLen float32 `default:"0.3"`

	// gaussian sigma for the width dimension (in the direction of the sine waves) -- as a normalized proportion of filter size
	SigWd float32 `default:"0.15,0.2"`

	// phase offset for the sine wave, in degrees -- 0 = asymmetric sine wave, 90 = symmetric cosine wave
	Phase float32 `default:"0,90"`

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

	// number of different angles of overall gabor filter orientation to use -- first angle is always horizontal
	NAngles int `default:"4"`
}

gabor.Filter specifies a gabor filter function, i.e., a 2d Gaussian envelope times a sinusoidal plane wave. By default it produces 2 phase asymmetric edge detector filters.

func (*Filter) Defaults

func (gf *Filter) Defaults()

func (*Filter) SetSize

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

SetSize sets the size and WvLen to same value, and also sets spacing these are the main params that need to be varied for standard V1 gabors

func (*Filter) ShouldDisplay

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

func (*Filter) ToTable

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

ToTable renders filters into the given table.Table setting a column named Angle to the angle and a column named Gabor to the filter for that angle. This is useful for display and validation purposes.

func (*Filter) ToTensor

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

ToTensor renders filters into the given table tensor.Tensor, setting dimensions to [angle][Y][X] where Y = X = Size

func (*Filter) Update

func (gf *Filter) Update()

Jump to

Keyboard shortcuts

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