utils

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindCurrentCharacter

func FindCurrentCharacter(hWnd win.HWND, coords []Rect) int32

This function check the brightness of the pixels in the given coordinates to determine the current character

func GetPixelColor

func GetPixelColor(hWnd win.HWND, rect Rect) (color.RGBA, error)

func InitOcr

func InitOcr(cfg OCRConfig, hWnd win.HWND)

func LoadGameData

func LoadGameData()

func PanicRecover

func PanicRecover(r interface{})

func SaveImg

func SaveImg(img image.Image, fileName string) error

Types

type Data

type Data struct {
	AssetID   string
	Value     string
	Message   string
	Region    string
	SubRegion string
}

func FindClosestCorrespondence

func FindClosestCorrespondence(text string, candidates []Data) Data

This function is useful to mitigate OCR errors by finding the closest correspondence to the given text

type GameDataStruct

type GameDataStruct struct {
	Characters []Data
	Locations  []Data
	Menus      []Data
}
var GameData *GameDataStruct

type OCRConfig

type OCRConfig struct {
	ExecutablePath *string
}

type OCRManager

type OCRManager struct {
	HWND win.HWND
	// contains filtered or unexported fields
}
var OcrManager *OCRManager

func (*OCRManager) StartOcr

func (m *OCRManager) StartOcr(imageBytes []byte) (string, error)

func (*OCRManager) WindowOcr

func (m *OCRManager) WindowOcr(rect Rect, job string, preprocess bool) (string, image.Image)

type Rect

type Rect struct {
	X, Y, Width, Height int
}

Jump to

Keyboard shortcuts

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