stack

package
v0.0.0-...-71c435a Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Width of the LoG Kernel to be applied before focus stacking.
	LoGKernelWidth = 13

	// Sigma of the Log Kernel to be applied before focus stacking.
	LogKernelSigma = 1.6
)

Variables

This section is empty.

Functions

func LoG

func LoG(sigma float64, x int, y int) float64

Compute the Laplacian of Gaussian for a given point.

Types

type DepthLUT

type DepthLUT map[int]color.Gray16

DepthLUT is a lookup table between an image index and color. Black is nearer to the camera.

type Extender

type Extender[T any] struct {
	// contains filtered or unexported fields
}

Extender extends the image pixel space indefintely by picking the nearest pixel to the point.

func NewExtender

func NewExtender[T any](source Plane[T]) *Extender[T]

func (*Extender[T]) At

func (e *Extender[T]) At(x, y int) T

func (*Extender[T]) Bounds

func (e *Extender[T]) Bounds() image.Rectangle

type FilteredImage

type FilteredImage[K, E Number] struct {
	// contains filtered or unexported fields
}

FilteredImage applies a filter to an extended image

func NewFilteredImage

func NewFilteredImage[K, E Number](kernel *Matrix[K], backend Plane[E]) *FilteredImage[K, E]

func (*FilteredImage[K, E]) At

func (img *FilteredImage[K, E]) At(x, y int) K

func (*FilteredImage[K, E]) Bounds

func (img *FilteredImage[K, E]) Bounds() image.Rectangle

type FocusStack

type FocusStack struct {
	// contains filtered or unexported fields
}

FocusStack creates a stack and depth map from a set of images.

func NewFocusStack

func NewFocusStack(rect image.Rectangle) (*FocusStack, error)

func (*FocusStack) AddImage

func (stack *FocusStack) AddImage(inputImage image.Image)

func (*FocusStack) DepthMap

func (stack *FocusStack) DepthMap(depthLUT DepthLUT) *image.Gray16

func (*FocusStack) OrderedDepths

func (stack *FocusStack) OrderedDepths() DepthLUT

Gives a strict depthmap back to front assuming images were processed in order.

func (*FocusStack) StackedImage

func (stack *FocusStack) StackedImage() image.Image

type Matrix

type Matrix[T Number] struct {
	Values []T
	Width  int
	Height int
}

func LoGKernel

func LoGKernel(sigma float64, n int) *Matrix[float32]

Computes a Laplacian of Gaussian kernel of size N (or n+1 if n is even).

func MatrixFromPlane

func MatrixFromPlane[I any, O Number](input Plane[I], converter func(I) O) *Matrix[O]

MatrixFromPlane creates a matrix from a plane using the projection function converter.

func NewMatrix

func NewMatrix[T Number](x int, y int) *Matrix[T]

func (*Matrix[T]) At

func (m *Matrix[T]) At(x, y int) T

func (*Matrix[T]) Bounds

func (m *Matrix[T]) Bounds() image.Rectangle

func (*Matrix[T]) Each

func (m *Matrix[T]) Each(callback func(x, y int, v T))

func (*Matrix[T]) Set

func (m *Matrix[T]) Set(x, y int, v T)

type Number

type Number interface {
	constraints.Float | constraints.Integer
}

type Plane

type Plane[T any] interface {
	At(x, y int) T
	Bounds() image.Rectangle
}

Plane represents a 2D plane.

Jump to

Keyboard shortcuts

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