A Go tesseract client (for tesseract 5.x) autogenerated using https://github.com/h12w/cwrap
This package requires the tesseract and leptonica developer libraries to be installed.
Tested with tesseract 5.0.1 and leptonica 1.82.0.
Example (see also example/main.go) :
tess := tesseract.BaseAPICreate()
defer func() {
tess.Clear()
tess.End()
}()
if ret := tess.Init3("", "eng"); ret != 0 {
log.Fatal("Tesseract init", ret)
}
// imagebytes should be a byte buffer
// containing an image in a format supported by leptonica (i.e. png)
pbytes := tess.SetImageBytes(imagebytes)
if text := tess.GetUTF8Text(); text != "" {
fmt.Println(text)
}
tesseract.FreeImageBytes(pbytes)