Skip to content
Go package for OCR (Optical Character Recognition), by using Tesseract C++ library
Branch: master
Clone or download
Latest commit 02d1df5 Apr 5, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.dockerignore Clean up runtime tests Mar 22, 2019
.gitignore Clean up runtime tests Mar 22, 2019
.travis.yml Use "go mod vendor" than "go mod download" Feb 25, 2019
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md Nov 8, 2017
Dockerfile Refactor runtime tests Nov 27, 2017
ISSUE_TEMPLATE.md Fix ISSUE_TEMPLATE Dec 3, 2017
LICENSE Recover LICENSE file Nov 3, 2017
README.md Good bye v1! Feb 13, 2018
all_test.go Skip case should be specified by runtimes Mar 22, 2019
benchmark_test.go fix: memory leak of pix images, initialize once only or on language o… Jun 8, 2018
client.go Init only when required (perfs) Mar 20, 2019
constant.go Ability to direct output to a file or disable it. Nov 20, 2018
example_test.go Fix tests Jul 16, 2018
go.mod Add modules Feb 25, 2019
go.sum Add modules Feb 25, 2019
hocr.go Simplify test assertions by using hOCR XML structure Feb 19, 2019
tessbridge.cpp Suppress "unused result" warning from c++ compiler Feb 20, 2019
tessbridge.h Try to capture Cgo stderr Jan 22, 2019

README.md

gosseract OCR

Build Status codecov Go Report Card GoDoc

Golang OCR package, by using Tesseract C++ library.

OCR Server

Do you just want OCR server, or see the working example of this package? Yes, there is already-made server application, which is seriously easy to deploy!

👉 https://github.com/otiai10/ocrserver

Example

package main

import (
	"fmt"
	"github.com/otiai10/gosseract"
)

func main() {
	client := gosseract.NewClient()
	defer client.Close()
	client.SetImage("path/to/image.png")
	text, _ := client.Text()
	fmt.Println(text)
	// Hello, World!
}

Install

  1. tesseract-ocr, including library and headers
  2. go get -t github.com/otiai10/gosseract

Check Dockerfile for more detail of installation, or you can just try by docker run -it --rm otiai10/gosseract.

Test

In case you have tesseract-ocr on your local, you can just hit

% go test .

Otherwise, if you DON'T want to install tesseract-ocr on your local, kick ./test/runtime which is using 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.

Issues

You can’t perform that action at this time.