gabor

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: 4 Imported by: 21

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 `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: 2] [viewif: On] overall gain multiplier applied after filtering -- only relevant if not using renormalization (otherwize it just gets renormed away)
	Gain float32 `` /* 159-byte string literal not displayed */

	// [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] 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 `` /* 219-byte string literal not displayed */

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

	// [def: 0.3] [viewif: On] gaussian sigma for the length dimension (elongated axis perpendicular to the sine waves) -- as a normalized proportion of filter Size
	SigLen float32 `` /* 162-byte string literal not displayed */

	// [def: 0.15,0.2] [viewif: On] gaussian sigma for the width dimension (in the direction of the sine waves) -- as a normalized proportion of filter size
	SigWd float32 `` /* 154-byte string literal not displayed */

	// [def: 0,90] [viewif: On] phase offset for the sine wave, in degrees -- 0 = asymmetric sine wave, 90 = symmetric cosine wave
	Phase float32 `` /* 128-byte string literal not displayed */

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

	// [def: 4] [viewif: On] number of different angles of overall gabor filter orientation to use -- first angle is always horizontal
	NAngles int `` /* 132-byte string literal not displayed */
}

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

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

ToTable renders filters into the given etable.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 *etensor.Float32)

ToTensor renders filters into the given etable etensor.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