Awesome
English|中文
paddleocr
A simple wrapper for hiroi-sora/PaddleOCR-json implemented in Go language.
Installation
-
Download the program from PaddleOCR-json releases and decompress it.
-
install paddleocr
go get github.com/doraemonkeys/paddleocr
Quick Start
package main
import (
"fmt"
"github.com/doraemonkeys/paddleocr"
)
func main() {
p, err := paddleocr.NewPpocr("path/to/PaddleOCR-json.exe",
paddleocr.OcrArgs{})
if err != nil {
panic(err)
}
defer p.Close()
result, err := p.OcrFileAndParse(`path/to/image.png`)
if err != nil {
panic(err)
}
if result.Code != paddleocr.CodeSuccess {
fmt.Println("orc failed:", result.Msg)
return
}
fmt.Println(result.Data)
}