ocrschema

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: GPL-3.0 Imports: 7 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) CropRectange

func (s *OCRCrop) CropRectange() image.Rectangle

func (*OCRCrop) MarshalJSON

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

func (*OCRCrop) UnmarshalJSON

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

type OCRResponse

type OCRResponse struct {
	Filename string                 `json:"filename"`
	Data     map[string]interface{} `json:"data"`
}

type ROKOCRSchema

type ROKOCRSchema 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) ROKOCRSchema

func NewTextField

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

type ROKTableField

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

func (*ROKTableField) MarshalJSON

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

func (*ROKTableField) UnmarshalJSON

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

type RokOCRTemplate

type RokOCRTemplate 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]ROKOCRSchema `json:"ocr_schema,omitempty"`
	Fingerprint string                  `json:"fingerprint,omitempty"`
	Threshold   int                     `json:"threshold,omitempty"`
	Table       []ROKTableField         `json:"table,omitempty"`
	Checkpoints []OCRCheckpoint         `json:"checkpoints,omitempty"`
}

func LoadTemplate

func LoadTemplate(fileName string) (RokOCRTemplate, error)

func (*RokOCRTemplate) Hash

func (*RokOCRTemplate) Match

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

func (*RokOCRTemplate) Matches

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

Jump to

Keyboard shortcuts

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