ocrschema

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OCRCheckpoint

type OCRCheckpoint struct {
	Crop        *OCRCrop `json:"crop,omitempty"`
	Fingerprint string   `json:"fingerprint,omitempty"`
}

type OCRCrop

type OCRCrop struct {
	X int
	Y int
	W int
	H int
}

func (*OCRCrop) CropRectangle added in v0.8.0

func (b *OCRCrop) CropRectangle() image.Rectangle

func (*OCRCrop) MarshalJSON

func (b *OCRCrop) MarshalJSON() ([]byte, error)

func (*OCRCrop) UnmarshalJSON

func (b *OCRCrop) UnmarshalJSON(data []byte) error

type OCRResult added in v0.8.0

type OCRResult struct {
	Filename string                 `json:"filename"`
	Data     map[string]interface{} `json:"data"`
	Took     time.Duration          `json:"duration"`
}

type OCRSchema added in v0.8.0

type OCRSchema struct {
	Callback  interface{}   `json:"callback,omitempty"`
	Languages []string      `json:"lang,omitempty"`
	OEM       int           `json:"oem,omitempty"`
	PSM       int           `json:"psm,omitempty"`
	Crop      *OCRCrop      `json:"crop,omitempty"`
	AllowList []interface{} `json:"allowlist,omitempty"`
}

func NewNumberField

func NewNumberField(cropArea *OCRCrop) OCRSchema

func NewTextField

func NewTextField(cropArea *OCRCrop, languages ...string) OCRSchema

type OCRTableField added in v0.8.0

type OCRTableField struct {
	Title string
	Field string
	Bold  bool
	Color string
}

func (*OCRTableField) MarshalJSON added in v0.8.0

func (b *OCRTableField) MarshalJSON() ([]byte, error)

func (*OCRTableField) UnmarshalJSON added in v0.8.0

func (b *OCRTableField) UnmarshalJSON(data []byte) error

type OCRTemplate added in v0.8.0

type OCRTemplate struct {
	Title       string               `json:"title,omitempty"`
	Version     string               `json:"version,omitempty"`
	Author      string               `json:"author,omitempty"`
	Width       int                  `json:"width,omitempty"`
	Height      int                  `json:"height,omitempty"`
	OCRSchema   map[string]OCRSchema `json:"ocr_schema,omitempty"`
	Fingerprint string               `json:"fingerprint,omitempty"`
	Threshold   int                  `json:"threshold,omitempty"`
	Table       []OCRTableField      `json:"table,omitempty"`
	Checkpoints []OCRCheckpoint      `json:"checkpoints,omitempty"`
}

func FindTemplate added in v0.8.0

func FindTemplate(mediaDir string, availableTemplate []OCRTemplate) OCRTemplate

func LoadTemplate

func LoadTemplate(fileName string) (OCRTemplate, error)

func LoadTemplates added in v0.8.0

func LoadTemplates(directory string) []OCRTemplate

func PickTemplate added in v0.8.0

func PickTemplate(hash *goimagehash.ImageHash, availableTemplate []OCRTemplate) OCRTemplate

func (*OCRTemplate) Hash added in v0.8.0

func (b *OCRTemplate) Hash() *goimagehash.ImageHash

func (*OCRTemplate) Match added in v0.8.0

func (b *OCRTemplate) Match(hash *goimagehash.ImageHash) bool

func (*OCRTemplate) Matches added in v0.8.0

func (b *OCRTemplate) Matches(img image.Image) bool

Jump to

Keyboard shortcuts

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