stereo

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package stereo makes a stereo pair of a 2D picture and its disparity: each eye is the picture shifted by half the disparity, rendered row by row so that what is nearer covers what is behind it, and what an eye sees that the picture does not (behind a nearer thing's edge) filled from the farther side.

Index

Constants

View Source
const FarKnee = 0.7

FarKnee is where, as a share of Shape.Far, the depth behind the screen starts to be eased.

View Source
const RefineMultiple = 8

RefineMultiple is what the input's sides are padded to a multiple of.

Variables

View Source
var (
	BaseShape         = Shape{Scale: 0.00026, Offset: -0.0075}
	BaseRefinedShape  = Shape{Scale: 0.00022, Offset: -0.0065}
	LargeShape        = Shape{Scale: DefaultShape.Scale / 155, Offset: DefaultShape.Offset}
	LargeRefinedShape = Shape{Scale: RefinedShape.Scale / 155, Offset: RefinedShape.Offset}
)

The shapes of the other networks' depth (depth.Model.Size), each its own scale, found as RefinedShape was. Base's depth refined (the weights learnt on Small's) on the twelve clips: depth correlation 0.859 against Small's 0.832; the made right eye 27.7 dB and VMAF 30.4 (Small's 27.5 and 29.5), on the glass clips 26.6 and 31.9 (26.8 and 33.4). Base's depth as it is: 27.3 and 26.2, the best of three scales tried. Large's is Small's scaled by the ratio of their depth's fits to the discs' (155: untuned; Large's depth measured no better than Base's).

View Source
var DefaultGuide = Guide{}

DefaultGuide is the filter the conversion uses: none for now, since tools/stereobench measures no gain from it yet (radius 8, eps 1e-3: the made right eye within 0.1 dB either way); kept to tune.

View Source
var DefaultShape = Shape{Scale: 0.0012, Offset: -0.0075}

DefaultShape is the 3D discs' depth (native and studio-converted ones, measured by tools/stereobench): the network's depth taken as it is, 0.12% of the width a unit of it, the farthest 0.75% behind the screen. A fit of the discs' disparity by the network's depth over a whole clip finds about that on every clip (0.06% to 0.19% a unit, offsets -1.4% to +0.1%), and the network's depth is steady from picture to picture, so normalising each picture's range (Budget and Screen) only loses: 1.6 dB of the made right eye against the disc's.

View Source
var InpaintLayers = []RefineLayer{
	{Name: "e1a", In: 4, Out: 16, Stride: 1, Kernel: 3},
	{Name: "e1b", In: 16, Out: 16, Stride: 1, Kernel: 3},
	{Name: "e2a", In: 16, Out: 32, Stride: 2, Kernel: 3},
	{Name: "e2b", In: 32, Out: 32, Stride: 1, Kernel: 3},
	{Name: "e3a", In: 32, Out: 48, Stride: 2, Kernel: 3},
	{Name: "e3b", In: 48, Out: 48, Stride: 1, Kernel: 3},
	{Name: "e4a", In: 48, Out: 64, Stride: 2, Kernel: 3},
	{Name: "e4b", In: 64, Out: 64, Stride: 1, Kernel: 3},
	{Name: "u3", In: 64, Out: 48, Up: true},
	{Name: "d3", In: 48, Out: 48, Stride: 1, Kernel: 3},
	{Name: "u2", In: 48, Out: 32, Up: true},
	{Name: "d2", In: 32, Out: 32, Stride: 1, Kernel: 3},
	{Name: "u1", In: 32, Out: 16, Up: true},
	{Name: "d1", In: 16, Out: 16, Stride: 1, Kernel: 3},
	{Name: "out", In: 16, Out: 3, Stride: 1, Kernel: 3, Residual: true},
}

InpaintLayers is the filler's layers, in their order.

View Source
var RefineLayers = []RefineLayer{
	{Name: "e1a", In: 4, Out: 16, Stride: 1, Kernel: 3},
	{Name: "e1b", In: 16, Out: 16, Stride: 1, Kernel: 3},
	{Name: "e2a", In: 16, Out: 32, Stride: 2, Kernel: 3},
	{Name: "e2b", In: 32, Out: 32, Stride: 1, Kernel: 3},
	{Name: "e3a", In: 32, Out: 48, Stride: 2, Kernel: 3},
	{Name: "e3b", In: 48, Out: 48, Stride: 1, Kernel: 3},
	{Name: "e4a", In: 48, Out: 64, Stride: 2, Kernel: 3},
	{Name: "e4b", In: 64, Out: 64, Stride: 1, Kernel: 3},
	{Name: "u3", In: 64, Out: 48, Up: true},
	{Name: "d3", In: 48, Out: 48, Stride: 1, Kernel: 3},
	{Name: "u2", In: 48, Out: 32, Up: true},
	{Name: "d2", In: 32, Out: 32, Stride: 1, Kernel: 3},
	{Name: "u1", In: 32, Out: 16, Up: true},
	{Name: "d1", In: 16, Out: 16, Stride: 1, Kernel: 3},
	{Name: "out", In: 16, Out: 1, Stride: 1, Kernel: 3, Residual: true},
}

RefineLayers is the refinement's layers, in their order.

View Source
var RefinedShape = Shape{Scale: 0.0010, Offset: -0.0075}

RefinedShape is DefaultShape for a refined depth (Converter.Refine): found as DefaultShape was, on the benchmark's twelve clips, with weights learnt from 27 other films (since 53: the same mapping, the same scores or a little better; the made right eye 27.5 dB and VMAF 29.5 against the discs', DefaultShape's on the depth as it is 26.9 and 25.7; on the four glass clips, held out of the choice, 26.8 and 33.4 against 25.7 and 26.8).

View Source
var TunedShape = Shape{Scale: 0.00115, Offset: -0.0082}

TunedShape is DefaultShape for Small's depth with its head learnt from the 3D discs (depth.BuiltinTail), found as DefaultShape was, on the benchmark's twelve clips and checked on the wide set (fifty clips of twenty-five other films), the glass clips and Avatar 3. The whole head learnt (not the tail alone) reads the scene a little differently and wants a little less scale and a shallower offset: 0.115% a unit and -0.82% of the width against the tail's 0.13% and -0.90%. The made right eye: the twelve clips 27.63 dB and VMAF 32.0 (the tail alone at its shape 27.35 and 31.1), the wide set 28.66 and 36.2 (28.59 and 35.4), the glass clips 28.23 and 48.1 (28.11 and 45.6), Avatar 3 25.65 and 29.2 (25.83 and 31.6: that film wants a shallower shape still, 0.10% and -0.60%, where it gives 25.90 and the other sets lose a dB or more; one fixed shape is a compromise between films). Deeper offsets lose on every set: the discs go farther back than this (their 5th percentile -23 px at 1920 against ours -17), but a fixed mapping placing the far end deeper misses more than it gains.

Functions

func ApplyInpaint added in v0.21.0

func ApplyInpaint(eye *mvc.Frame, holes []bool, delta []float32, top, bottom int)

ApplyInpaint takes the filler's corrections (Inpaint's, downloaded: [3, H, W] for the rows [top, bottom) of eye, padded) into eye's holes: a luma pixel that is a hole, a chroma sample any of whose luma pixels is.

func Bars

func Bars(f *mvc.Frame) (top, bottom int)

Bars finds a picture's letterbox bars: its active rows are [top, bottom).

func Curved added in v0.21.0

func Curved(n, curve float32) float32

Curved is the nearness n (0 the farthest of a shot's range, 1 the nearest) bent by the power curve: n to it within the range, the same slope as at the range's ends beyond them (1 below, curve above), so it stays monotone and continuous; 1 (or 0) leaves it.

func Dense

func Dense(dm *Disparity, w, h int) []float32

Dense is a measured disparity (Match's, half resolution) at the picture's size (w x h, one value a luma pixel): each row's unsure runs filled from their farther side (behind an edge, what is unsure is mostly what one eye does not see, which lies behind), then interpolated up.

func FarLimit

func FarLimit(v, far, knee float32) float32

FarLimit is a disparity v kept short of far (pixels, 0 for no limit) behind the screen: past knee (FarKnee of far) eased as x/(1+x/r), x what lies past it and r the rest of the way, which leaves the slope 1 there and tends to far. Its steps rounded one at a time, as the GPU's disparity kernel takes them.

func InpaintInput added in v0.21.0

func InpaintInput(eye *mvc.Frame, holes []bool, top, bottom int) *nn.Tensor

InpaintInput is the filler's input for an eye's rows [top, bottom) (w wide: its Y, and its Cb and Cr at half size, strideY and strideC apart) and its holes (w x h of the whole eye, true in a hole): [4, H, W], the sides padded to RefineMultiple by repeating the last row and column.

func Pair

func Pair(f *mvc.Frame, d []float32) (left, right *mvc.Frame)

Pair renders the two eyes of f (8-bit 4:2:0) for its disparity, one value a luma pixel (d[y*Width+x], in pixels between the eyes: positive nearer than the screen, the left eye's view of a point that far right of the right eye's).

func Redepth

func Redepth(g *nn.GPU, l, r *mvc.Frame, k, shift float32) (nl, nr *mvc.Frame)

Redepth makes a stereo pair's eyes (8-bit 4:2:0, the same size) again with its depth scaled by k and moved by shift (pixels of disparity, positive nearer). The disparity is measured between the eyes, each way (Match), and each new eye is rendered from its own camera at (1-k)/2 of the way to the other, what it then sees that its camera did not (behind a nearer thing's edge) taken from the other camera's view, which saw it, rendered there too: so with k below 1, the views between the cameras, little is invented. Above 1 the views are outside the cameras', and what neither saw is filled from the farther side, as Pair fills. The shift moves the eyes apart (each half of it), black coming in at the edges. With k 1 the eyes are only shifted.

The matching is on g when it is not nil (MatchBothGPU), else on the CPU.

func RefineInput

func RefineInput(y, cb, cr []byte, stride int, depth []float32, w, h int) (x *nn.Tensor, mean, sd float64)

RefineInput is the refinement's input for a picture's active rows at half size (w x h): its Y (halved), Cb and Cr, each h rows of w, stride apart, and its depth (w x h); the sides padded to RefineMultiple by repeating the last row and column. It gives the depth's mean and deviation, which the refined depth is put back to.

func Render

func Render(f *mvc.Frame, d []float32, sign float32) (eye *mvc.Frame, holes []bool)

Render is one eye: each pixel of f moved by sign times its disparity d (0.5 the left eye of a pair f is the middle of, -1 the right eye of a pair f is the left eye of); holes says which of its luma pixels were filled, seen by no pixel of f.

func ScreenFar

func ScreenFar(diagonal float64) float64

ScreenFar is Shape.Far for a screen's size (its diagonal, in inches, of a 16:9 picture): the eyes' separation, 63 mm, as a fraction of its width; past that the eyes would turn outwards to see what is behind the screen.

Types

type Converter

type Converter struct {
	Model *depth.Model
	Shaper
	// Guide snaps the depth's edges to the picture's (DefaultGuide; the
	// zero Guide leaves the depth as the network gives it, upsampled).
	Guide Guide
	// NoWindow leaves out the floating window (window.go).
	NoWindow bool
	// KeepCredits gives the credits (credits.go) their depth as any
	// picture's, not flat.
	KeepCredits bool
	// Shot, when set, gives a picture's shape (by its PTS) in place of the
	// Shaper's, and whether it is made flat: a stretch of the film graded
	// by hand.
	Shot func(pts int64) (s Shape, flat bool)
	// Refine, when not nil, corrects the depth's shape (refinenet.go), on
	// the depth model's backend.
	Refine *RefineWeights
	// KeepDepth keeps each Estimate's depth even when a GPU makes the
	// eyes, for Grade to shape it again as often as asked.
	KeepDepth bool
	// Fill, when not nil, fills the eyes' holes (what an eye saw nothing
	// of) by the hole filler (inpaintnet.go) in place of the renderer's
	// carried edge, on the depth model's backend.
	Fill *Filler
	// contains filtered or unexported fields
}

Converter makes the stereo pairs of a 2D film's pictures, one picture after the other: the depth of the picture's active area (letterbox bars left out, at the screen) by the depth network, shaped into disparity, the eyes rendered from it. A cut, or bars that change, starts the network's and the shaping's state afresh.

func NewConverter

func NewConverter(m *depth.Model, shape Shape) *Converter

NewConverter is a converter for a depth model.

func (*Converter) Convert

func (c *Converter) Convert(f *mvc.Frame) (left, right *mvc.Frame, err error)

Convert gives the pair for the next picture (8-bit 4:2:0).

func (*Converter) Cuts

func (c *Converter) Cuts() int

Cuts is how many cuts the converter has seen.

func (*Converter) Depth

func (c *Converter) Depth(f *mvc.Frame) (*Estimate, error)

Depth is Estimate without the eyes: the picture's depth kept, for Still to shape as often as asked.

func (*Converter) Estimate

func (c *Converter) Estimate(f *mvc.Frame) (*Estimate, error)

Estimate is the first half of Next: the picture's depth, by the network and the refinement; on a GPU, the eyes too when it can make them (Eyes gives them).

func (*Converter) Eyes

func (c *Converter) Eyes(e *Estimate) (left, right *mvc.Frame, s *Samples)

Eyes is Shape and Pair of an Estimate (the GPU's, when it made them): the picture's two eyes and their disparity's samples. The Estimates must come in order.

func (*Converter) Grade added in v0.20.0

func (c *Converter) Grade(e *Estimate, s Shape, flat bool) (left, right *mvc.Frame, samples *Samples)

Grade is Still with the picture flat when asked (on the screen, as the credits are) and never flat otherwise, whatever the credits detector made of it: a hand's grading. It gives the disparity's samples too. The Estimate's depth must be there (KeepDepth, or Depth's).

func (*Converter) Next

func (c *Converter) Next(f *mvc.Frame) (depth, disparity []float32, err error)

Next gives the next picture's depth and disparity: depth, the network's (larger nearer, in its own units), NaN in the letterbox bars; disparity, shaped from it (zero in the bars), in pixels, as Pair takes it. The error is the depth model's backend's (a GPU's). It is Estimate then Shape.

func (*Converter) Restart added in v0.20.0

func (c *Converter) Restart()

Restart has the next picture start the network's and the shaping's state afresh, as the first did, and not count as a cut: the film read from somewhere else.

func (*Converter) Shape

func (c *Converter) Shape(e *Estimate) (depth, disparity []float32)

Shape is the second half of Next: an Estimate's depth upsampled to the picture and shaped into disparity. The Estimates must come in order; one whose eyes the GPU made has no depth to shape and goes to Eyes.

func (*Converter) Start

func (c *Converter) Start(f *mvc.Frame) *Pending

Start is Estimate begun: on a GPU, its work queued and not waited for, so that the caller's own (the next picture's decoding) runs beside it. One at a time: the next Start after this one's Wait.

func (*Converter) Still

func (c *Converter) Still(e *Estimate, s Shape) (left, right *mvc.Frame)

Still is the pair of a picture's Estimate (Depth's) shaped by s, as a picture on its own (its floating window not eased in from the pictures before). The converter's own shape is left as it was.

func (*Converter) Window

func (c *Converter) Window(left, right *mvc.Frame, s *Samples)

Window puts the floating window on the pair made of the picture Next, Shape or Eyes did last, for its disparity's samples s (unless NoWindow).

type CreditFeatures

type CreditFeatures struct {
	Dark, Thin float64
}

CreditFeatures is a picture's measures of the credits (its active rows [top, bottom), every other pixel): Dark, the share that is black; Thin, the share of the rest in runs (across a row) of at most creditStroke pixels with black either side, as letters' strokes are.

func Credits

func Credits(f *mvc.Frame, top, bottom int) CreditFeatures

Credits measures a picture's credit features.

func (CreditFeatures) IsCredits

func (c CreditFeatures) IsCredits() bool

IsCredits reports whether a picture's features are the credits'.

type Disparity

type Disparity struct {
	W, H  int
	D     []float32
	Valid []bool
}

Disparity is a disparity map measured between a stereo pair's eyes, at half their resolution: D[y*W+x], in the eyes' (full resolution) pixels, positive nearer than the screen (the left eye's view of a point that far right of the right eye's), where Valid says the match is sure.

func Match

func Match(left, right *mvc.Frame) *Disparity

Match measures the disparity between a stereo pair's eyes (8-bit 4:2:0, the same size): their luma halved, a census transform's costs aggregated along eight paths (semi-global matching), the best match to a fraction of a pixel; a match is valid when it is unique and the right eye's match of the pixel it lands on comes back to it.

func MatchBoth

func MatchBoth(left, right *mvc.Frame) (l, r *Disparity)

MatchBoth is Match and the right eye's disparity too, from the same matching: its pixel x matching the left eye's x+D (the sign Match's has), valid on the same terms.

func MatchBothGPU

func MatchBothGPU(g *nn.GPU, left, right *mvc.Frame) (l, r *Disparity, err error)

MatchBothGPU is MatchBoth on the GPU, the same disparities.

type Estimate

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

An Estimate is a picture's depth as the network (and the refinement) give it, at their size: Estimate's work, on the depth model's backend, the pictures one after the other; Shape's, on the CPU, may run beside the next picture's Estimate.

func (*Estimate) Depth added in v0.20.0

func (e *Estimate) Depth() []float32

Depth is the Estimate's depth as the network gave it (larger nearer), at the network's size, nil when there is none (a picture too short, or a GPU's eyes without KeepDepth).

func (*Estimate) Frame added in v0.20.0

func (e *Estimate) Frame() *mvc.Frame

Frame is the picture the Estimate is of.

type Filler added in v0.21.0

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

Filler is the hole filler ready to run on a backend: its weights uploaded once.

func NewFiller added in v0.21.0

func NewFiller(w *InpaintWeights) *Filler

NewFiller is a filler with weights.

func (*Filler) Fill added in v0.21.0

func (f *Filler) Fill(be nn.Backend, eye *mvc.Frame, holes []bool, top, bottom int) error

Fill corrects the holes of an eye's rows [top, bottom) on be: the filler run on the eye and its holes (Render's), its corrections taken in the holes. On a GPU the caller releases the pass's memory (nn.GPU.Release) after; the weights stay.

func (*Filler) FillGPU added in v0.21.0

func (f *Filler) FillGPU(g *nn.GPU, eyes, mask *nn.Tensor, w, h, top, bottom int)

FillGPU fills the holes of both eyes of nn.GPU.Eyes' output (with EyesMask's mask) of a w x h picture, rows [top, bottom), in place on the GPU: queued, nothing crosses to the CPU.

type Guide

type Guide struct {
	// Radius is the window's radius in pixels of the picture; zero turns
	// the filter off.
	Radius int
	// Eps is the regularisation, in luma units squared (the picture's luma
	// spread over 0..1, its 1st to 99th percentile): the larger, the less
	// the depth follows the picture's finer variations.
	Eps float64
}

Guide is the guided filter's settings.

type InpaintWeights added in v0.21.0

type InpaintWeights struct {
	W, B map[string]*nn.Tensor
}

InpaintWeights is the filler's weights, each layer's as RefineWeights'.

func DecodeInpaint added in v0.21.0

func DecodeInpaint(r io.Reader) (*InpaintWeights, error)

DecodeInpaint reads the filler's weights from r.

func ReadInpaint added in v0.21.0

func ReadInpaint(path string) (*InpaintWeights, error)

ReadInpaint reads the filler's weights (as WriteTo writes them).

func (*InpaintWeights) Inpaint added in v0.21.0

func (iw *InpaintWeights) Inpaint(be nn.Backend, x *nn.Tensor) *nn.Tensor

Inpaint runs the filler on its input (InpaintInput's) on be: the corrections to Y, Cb and Cr, [3, H, W] (padded as the input is).

func (*InpaintWeights) WriteTo added in v0.21.0

func (iw *InpaintWeights) WriteTo(w io.Writer) (int64, error)

WriteTo writes the weights: the magic, then each layer's weights and bias in order, float32 little-endian.

type Pending

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

Pending is an Estimate under way (Start's): Wait gives it.

func (*Pending) Wait

func (p *Pending) Wait() (*Estimate, error)

Wait gives the Estimate once made.

type RefineLayer

type RefineLayer struct {
	Name     string
	In, Out  int
	Stride   int  // a convolution's: 1 or 2
	Up       bool // a 2x2 transposed convolution (an upsampling)
	Kernel   int  // a convolution's: 3
	Residual bool // the last: no ReLU
}

RefineLayer is one of the refinement's layers.

func (RefineLayer) Shape

func (l RefineLayer) Shape() []int

Shape is a layer's weights' shape.

type RefineWeights

type RefineWeights struct {
	W, B map[string]*nn.Tensor
}

RefineWeights is the refinement's weights: each layer's (a convolution's [Out, In, k, k], a transposed one's [In, Out, 2, 2]) and its bias.

func BuiltinRefine

func BuiltinRefine() *RefineWeights

BuiltinRefine is the built-in refinement weights.

func DecodeRefine

func DecodeRefine(r io.Reader) (*RefineWeights, error)

DecodeRefine reads refinement weights from r.

func ReadRefine

func ReadRefine(path string) (*RefineWeights, error)

ReadRefine reads refinement weights (as WriteTo writes them).

func (*RefineWeights) Refine

func (rw *RefineWeights) Refine(be nn.Backend, x *nn.Tensor) *nn.Tensor

Refine runs the refinement on its input (RefineInput's) on be: the standardised depth corrected, [1, H, W] (padded as the input is).

func (*RefineWeights) WriteTo

func (rw *RefineWeights) WriteTo(w io.Writer) (int64, error)

WriteTo writes the weights: the magic, then each layer's weights and bias in order, float32 little-endian.

type Samples

type Samples struct {
	Left, Right []float32 // the strips, a row's after the other's
	Low         []float32 // the lower half's
}

Samples is what of a picture's disparity the floating window and the subtitles read: its side strips (sampleEdge wide) on every other active row, and every fourth row and column of its lower half. A GPU downloads these and not the whole of it.

func SamplesOf

func SamplesOf(d []float32, w, h, top, bottom int) *Samples

SamplesOf is the Samples of a w x h disparity d whose active rows are [top, bottom).

type Shape

type Shape struct {
	// Budget is the disparity across the depth's range (its 5th to 95th
	// percentile; what lies beyond goes up to a quarter of it farther), as
	// a fraction of the picture's width.
	Budget float64
	// Screen is where the screen sits in the depth range, 0 the farthest
	// and 1 the nearest: what is nearer comes out of it, what is farther
	// goes behind.
	Screen float64
	// Scale, when not zero, maps the network's depth to disparity as it
	// is, not normalised a picture at a time: Scale times the depth plus
	// Offset, as fractions of the width (Budget and Screen unused).
	Scale, Offset float64
	// Far, when not zero, is the farthest behind the screen anything may
	// go, a fraction of the width: what goes past FarKnee of it is eased
	// towards it, never reaching it (FarLimit).
	Far float64
	// Curve, when not zero or one, bends the depth within the shot's
	// range (its 5th to 95th percentile, steadied over the shot as
	// Budget's is), with Scale: the nearness n of a point in it (0 the
	// farthest, 1 the nearest) becomes n to the power Curve (Curved), the
	// ends staying. Below 1 what is between comes forward, towards the
	// nearest, as the rows of a crowd a network stacks away behind each
	// other; above 1 it goes back.
	Curve float64
}

Shape is how depth becomes disparity.

func ShapeFor

func ShapeFor(size string, refined, tuned bool) Shape

ShapeFor is the shape of a network's depth (by depth.Model.Size), refined or not, tuned (Small's with its tail learnt: TunedShape) or not.

type Shaper

type Shaper struct {
	Shape Shape
	// contains filtered or unexported fields
}

Shaper turns a stream's depth maps into disparity: each map's range (its 5th to 95th percentile) normalised to 0..1 (what lies beyond kept to a quarter of the range more), the range steadied over the frames of a shot, then the shape's budget and screen applied.

func (*Shaper) CurveArgs added in v0.21.0

func (s *Shaper) CurveArgs() (lo, span, curve float32)

CurveArgs is the shape's curve as the disparity kernels take it: the shot's range (its farthest and its span, in the depth's units) and the power; the power 0 when the shape does not bend the depth, or the shot's range is not known yet.

func (*Shaper) Disparity

func (s *Shaper) Disparity(depth []float32, width int) []float32

Disparity is the disparity of a depth map (larger nearer, as the depth network gives it), in pixels of a picture width wide.

func (*Shaper) Range added in v0.21.0

func (s *Shaper) Range() (lo, hi float64, ok bool)

Range is the shot's range so far, lo to hi (Steady's), and whether there is one.

func (*Shaper) Reset

func (s *Shaper) Reset()

Reset starts a new shot: the next map's range is taken as it is.

func (*Shaper) Steady added in v0.21.0

func (s *Shaper) Steady(lo, hi float64)

Steady takes a map's range, lo to hi, into the shot's, as steady does.

Jump to

Keyboard shortcuts

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