Documentation
¶
Index ¶
- func CreateOcrInitOptions() uintptr
- func CreateOcrPipeline(initOpts uintptr, modelPath, modelKey string) uintptr
- func CreateOcrProcessOptions() uintptr
- func GetImageAngle(result uintptr) float32
- func GetOcrDllPath() string
- func GetOcrLine(result uintptr, index int) uintptr
- func GetOcrLineContent(line uintptr) string
- func GetOcrLineCount(result uintptr) int
- func GetOcrLineWordCount(line uintptr) int
- func GetOcrWord(line uintptr, index int) uintptr
- func GetOcrWordConfidence(word uintptr) float32
- func GetOcrWordContent(word uintptr) string
- func OcrInitOptionsSetUseModelDelayLoad(initOpts uintptr, enable bool)
- func OcrProcessOptionsGetMaxRecognitionLineCount(processOpts uintptr) int
- func OcrProcessOptionsGetResizeResolution(processOpts uintptr) (int, int)
- func OcrProcessOptionsSetMaxRecognitionLineCount(processOpts uintptr, count int)
- func OcrProcessOptionsSetResizeResolution(processOpts uintptr, width int, height int)
- func ReleaseOcrInitOptions(initOpts uintptr)
- func ReleaseOcrPipeline(pipeline uintptr)
- func ReleaseOcrProcessOptions(processOpts uintptr)
- func ReleaseOcrResult(result uintptr)
- func RunOcrPipeline(pipeline, processOpts uintptr, img *Image) (uintptr, error)
- func SetOcrDllPath(path string)
- type BoundingBox
- type Image
- type OcrEngine
- func (e *OcrEngine) Close()
- func (e *OcrEngine) EnableModelDelayLoad() error
- func (e *OcrEngine) GetMaxRecognitionLineCount() int
- func (e *OcrEngine) GetResizeResolution() (int, int)
- func (e *OcrEngine) Recognize(img image.Image, format string) (string, error)
- func (e *OcrEngine) SetMaxRecognitionLineCount(count int) error
- func (e *OcrEngine) SetResizeResolution(width, height int) error
- type OcrLine
- type OcrResult
- type OcrWord
- type Point
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateOcrInitOptions ¶
func CreateOcrInitOptions() uintptr
CreateOcrInitOptions creates and returns a handle to OCR initialization options.
func CreateOcrPipeline ¶
CreateOcrPipeline creates and returns a handle to OCR pipeline.
func CreateOcrProcessOptions ¶
func CreateOcrProcessOptions() uintptr
CreateOcrProcessOptions creates and returns a handle to OCR processing options.
func GetImageAngle ¶
GetImageAngle returns the detected rotation angle of the image in degrees.
func GetOcrDllPath ¶
func GetOcrDllPath() string
GetOcrDllPath returns the current directory path containing OCR DLL and model files.
func GetOcrLine ¶
GetOcrLine returns a handle to the specified text line by index.
func GetOcrLineContent ¶
GetOcrLineContent returns the text content of the specified line.
func GetOcrLineCount ¶
GetOcrLineCount returns the number of text lines detected in the image.
func GetOcrLineWordCount ¶
GetOcrLineWordCount returns the number of words in the specified text line.
func GetOcrWord ¶
GetOcrWord returns a handle to the specified word by index within a text line.
func GetOcrWordConfidence ¶
GetOcrWordConfidence returns the recognition confidence score (0-1) for the specified word.
func GetOcrWordContent ¶
GetOcrWordContent returns the text content of the specified word.
func OcrInitOptionsSetUseModelDelayLoad ¶
OcrInitOptionsSetUseModelDelayLoad enables or disables lazy loading of the OCR model.
func OcrProcessOptionsGetMaxRecognitionLineCount ¶
OcrProcessOptionsGetMaxRecognitionLineCount returns the maximum number of text lines
func OcrProcessOptionsGetResizeResolution ¶
OcrProcessOptionsGetResizeResolution returns the current width and height settings
func OcrProcessOptionsSetMaxRecognitionLineCount ¶
OcrProcessOptionsSetMaxRecognitionLineCount sets the maximum number of text lines
func OcrProcessOptionsSetResizeResolution ¶
OcrProcessOptionsSetResizeResolution sets the resolution that images will be resized to
func ReleaseOcrInitOptions ¶
func ReleaseOcrInitOptions(initOpts uintptr)
ReleaseOcrInitOptions releases the resources associated with OCR initialization options. This should be called when the options are no longer needed.
func ReleaseOcrPipeline ¶
func ReleaseOcrPipeline(pipeline uintptr)
ReleaseOcrPipeline releases the resources associated with an OCR pipeline. This should be called when the pipeline is no longer needed.
func ReleaseOcrProcessOptions ¶
func ReleaseOcrProcessOptions(processOpts uintptr)
ReleaseOcrProcessOptions releases the resources associated with OCR processing options. This should be called when the options are no longer needed.
func ReleaseOcrResult ¶
func ReleaseOcrResult(result uintptr)
ReleaseOcrResult releases the resources associated with OCR recognition results. This should be called when the results are no longer needed.
func RunOcrPipeline ¶
RunOcrPipeline executes the OCR pipeline on the provided image with the specified processing options. Returns a handle to the recognition results.
func SetOcrDllPath ¶
func SetOcrDllPath(path string)
SetOcrDllPath sets the directory path containing the required OCR DLL and model files. This must be called before any other OCR operations. It will panic if any required files are missing.
Types ¶
type BoundingBox ¶
type BoundingBox struct {
TopLeft Point `json:"top_left"`
TopRight Point `json:"top_right"`
BottomRight Point `json:"bottom_right"`
BottomLeft Point `json:"bottom_left"`
}
BoundingBox represents a rectangular region in the image defined by four corner points.
func GetOcrLineBoundingBox ¶
func GetOcrLineBoundingBox(line uintptr) BoundingBox
GetOcrLineBoundingBox returns the bounding box coordinates for the specified text line.
func GetOcrWordBoundingBox ¶
func GetOcrWordBoundingBox(word uintptr) BoundingBox
GetOcrWordBoundingBox returns the bounding box coordinates for the specified word.
type OcrEngine ¶
type OcrEngine struct {
// contains filtered or unexported fields
}
OcrEngine represents the OCR engine instance that performs text recognition.
func NewOcrEngine ¶
func NewOcrEngine() *OcrEngine
NewOcrEngine creates a new instance of the OCR engine with default settings.
func (*OcrEngine) Close ¶
func (e *OcrEngine) Close()
Close releases all resources associated with the OCR engine. This should be called when the engine is no longer needed.
func (*OcrEngine) EnableModelDelayLoad ¶
EnableModelDelayLoad enables lazy loading of the OCR model.
func (*OcrEngine) GetMaxRecognitionLineCount ¶
GetMaxRecognitionLineCount returns the maximum number of text lines
func (*OcrEngine) GetResizeResolution ¶
GetResizeResolution returns the current resolution settings used for image resizing
func (*OcrEngine) Recognize ¶
Recognize performs OCR on the provided image and returns the results. The format parameter can be either "text" for plain text output or "json" for detailed recognition results including bounding boxes and confidence scores.
func (*OcrEngine) SetMaxRecognitionLineCount ¶
SetMaxRecognitionLineCount sets the maximum number of text lines
func (*OcrEngine) SetResizeResolution ¶
SetResizeResolution sets the resolution that images will be resized to
type OcrLine ¶
type OcrLine struct {
Text string `json:"text"`
BoundingRect BoundingBox `json:"bounding_rect"`
Words []OcrWord `json:"words"`
}
OcrLine represents a single line of recognized text in the image.
type OcrWord ¶
type OcrWord struct {
Text string `json:"text"`
BoundingRect BoundingBox `json:"bounding_rect"`
Confidence float32 `json:"confidence"`
}
OcrWord represents a single word within a line of recognized text.