config

package
v0.0.0-...-5315466 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(ctx *cli.Context) error

func Reset

func Reset(*cli.Context) error

func Save

func Save(ctx *cli.Context) error

Types

type Area

type Area struct {
	Left   RelativeValue `json:"left"`
	Right  RelativeValue `json:"right"`
	Top    RelativeValue `json:"top"`
	Bottom RelativeValue `json:"bottom"`
}

type BinarizeConfig

type BinarizeConfig struct {
	Crop       Area            `json:"crop"`
	TextColors []ColorGroup    `json:"textColors"`
	Optitmizer OptimizerConfig `json:"optimizer"`
}

type BorderConfig

type BorderConfig struct {
	Color []ColorGroup  `json:"colors"`
	Level RelativeValue `json:"level"`
}

type CheckConfig

type CheckConfig struct {
	MaskLevel  float64    `json:"maskLevel"`
	Cropped    ColorGroup `json:"cropped"`
	Background ColorGroup `json:"background"`
	Text       ColorGroup `json:"text"`
	Discarded  ColorGroup `json:"discarded"`
}

type ColorGroup

type ColorGroup struct {
	R, G, B uint8
	Error   int
	Color   color.RGBA
}

func MustNewColorGroup

func MustNewColorGroup(s string) ColorGroup

func (*ColorGroup) Assign

func (cg *ColorGroup) Assign(s string) error

func (*ColorGroup) Contains

func (cg *ColorGroup) Contains(c color.RGBA) bool

func (ColorGroup) MarshalJSON

func (cg ColorGroup) MarshalJSON() ([]byte, error)

func (*ColorGroup) String

func (cg *ColorGroup) String() string

func (*ColorGroup) UnmarshalJSON

func (cg *ColorGroup) UnmarshalJSON(b []byte) error

type Config

type Config struct {
	Ffmpeg    FfmpegConfig    `json:"ffmpeg"`
	Tesseract TesseractConfig `json:"tesseract"`
	Slice     SliceConfig     `json:"slice"`
	Binarize  BinarizeConfig  `json:"binarize"`
	Check     CheckConfig     `json:"check"`
	Ocr       OcrConfig       `json:"ocr"`
	Convert   ConvertConfig   `json:"convert"`
}
var Value Config

type ConvertConfig

type ConvertConfig struct {
	Replace []Replace     `json:"replace"`
	Format  string        `json:"format"`
	Merge   RelativeValue `json:"merge"`
}

type FfmpegConfig

type FfmpegConfig struct {
	Filters    []string `json:"filters"`
	AppendArgs []string `json:"appendArgs"`
}

type MarginConfig

type MarginConfig struct {
	X RelativeValue `json:"x"`
	Y RelativeValue `json:"y"`
}

type NoOnEdgeConfig

type NoOnEdgeConfig struct {
	Left   bool `json:"left"`
	Right  bool `json:"right"`
	Top    bool `json:"top"`
	Bottom bool `json:"bottom"`
}

type OcrConfig

type OcrConfig struct {
	Cache      RelativeValue `json:"cache"`
	Margin     MarginConfig  `json:"margin"`
	Format     string        `json:"format"`
	JpgQuality int           `json:"jpgQuality"`
	Replace    []Replace     `json:"replace"`
}

type OptimizerConfig

type OptimizerConfig struct {
	Connectivity int            `json:"connectivity"`
	Size         Range          `json:"size"`
	Width        Range          `json:"width"`
	Height       Range          `json:"height"`
	Border       BorderConfig   `json:"border"`
	NoOnEdge     NoOnEdgeConfig `json:"noOnEdge"`
}

type Range

type Range struct {
	Min RelativeValue `json:"min"`
	Max RelativeValue `json:"max"`
}

func MustNewRange

func MustNewRange(min, max string) Range

type RelativeValue

type RelativeValue struct {
	Ratio  float64
	Offset int
}

func MustNewRelativeValue

func MustNewRelativeValue(s string) RelativeValue

func (*RelativeValue) Assign

func (rv *RelativeValue) Assign(s string) error

func (RelativeValue) Calculate

func (rv RelativeValue) Calculate(base int) int

func (RelativeValue) Equal

func (rv RelativeValue) Equal(ratio float64, offset int) bool

func (RelativeValue) MarshalJSON

func (rv RelativeValue) MarshalJSON() ([]byte, error)

func (*RelativeValue) String

func (rv *RelativeValue) String() string

func (*RelativeValue) UnmarshalJSON

func (rv *RelativeValue) UnmarshalJSON(b []byte) error

type Replace

type Replace struct {
	Regexp bool   `json:"regexp"`
	From   string `json:"from"`
	To     string `json:"to"`
}

type SliceConfig

type SliceConfig struct {
	Fps           int    `json:"fps"`
	FpsFactor     int    `json:"fpsFactor"`
	FrameInterval int    `json:"frameInterval"`
	Format        string `json:"format"`
}

type TesseractConfig

type TesseractConfig struct {
	Langs []string `json:"langs"`
	Psm   int      `json:"psm"`
}

Jump to

Keyboard shortcuts

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