intertitle

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PredictorPath is the folder the trained predictor is in
	PredictorPath = "/etc/cabiria"
	// PredictorFilename is the name of the file which holds the trained predictor
	PredictorFilename = "intertitlePredictor.model"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Predictor

type Predictor struct {
	Predictor ml.Predictor
}

Predictor can be used to predict whether given frames are intertitles

or not.

func Load

func Load(predictorPath string) (Predictor, error)

Load loads and constructs the intertitle predictor from disk.

func (Predictor) Predict

func (p Predictor) Predict(frames []image.Image) ([]bool, error)

Predict guesses what frames are intertitles, and outputs associated intertitles

func (Predictor) PredictSingle

func (p Predictor) PredictSingle(frame image.Image) (bool, error)

PredictSingle guesses whether a frame is an intertitle

type Range

type Range struct {
	StartFrame int
	EndFrame   int
	FPS        float64
	Style      Style
}

Range defines a set of frames which encapsulate an intertitle.

Range can be used as a Period.

func MapRanges

func MapRanges(intertitles []bool, fps float64, framePaths []string) ([]Range, error)

MapRanges takes an array of intertitle frames and an fps, and reduces it

to an array of Ranges.

func (Range) End

func (ir Range) End() time.Time

End returns a time representation of the end frame of a Range,

using the FPS.

func (Range) Start

func (ir Range) Start() time.Time

Start returns a time representation of the start frame of a Range,

using the FPS.

func (Range) TransformToNew

func (ir Range) TransformToNew(start, end time.Time) period.Period

TransformToNew computes a new Range given the desired start and end times,

calculating frame numbers using the FPS.

func (Range) Valid

func (ir Range) Valid() bool

Valid will return true if a range is valid, otherwise false.

type Style

type Style struct {
	ForegroundColor color.Color
	BackgroundColor color.Color
}

Style defines the essential aesthetics of an intertitle

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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