Golang OCR package, by using Tesseract C++ library.
If you need an OCR server or want to see a working example of this package, there is a ready-made server application, which is very easy to deploy!
👉 https://github.com/otiai10/ocrserver
package main
import (
"fmt"
"github.com/otiai10/gosseract/v2"
)
func main() {
client := gosseract.NewClient()
defer client.Close()
client.SetImage("path/to/image.png")
text, _ := client.Text()
fmt.Println(text)
// Hello, World!
}
- tesseract-ocr, including library and headers
go get -t github.com/otiai10/gosseract/v2
Please check this Dockerfile to get started.
Alternatively, you can deploy the pre-existing Docker image by invoking docker run -it --rm otiai10/gosseract
.
In case you have tesseract-ocr installed on your local environment, you can run the tests with:
% go test .
If you DON'T want to install tesseract-ocr on your local environment, run ./test/runtime
which utilises Docker and Vagrant to test the source code on some runtimes.
% ./test/runtime --driver docker
% ./test/runtime --driver vagrant
Check ./test/runtimes for more information about runtime tests.