Skip to content
프로젝트

소개

Tesseract C++ 라이브러리를 사용한 OCR(광학 문자 인식)용 Go 패키지.

개발 도구

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
+1
in 15 days
+3
in 1 month
+10

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

gosseract OCR

Go Test Docker Test BSD Test Windows Test codecov Go Report Card License: MIT Go Reference

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

OCR Server

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

Example

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!
}

Installation

macOS

brew install tesseract
go get -t github.com/otiai10/gosseract/v2

Linux (Debian/Ubuntu)

sudo apt-get install -y libtesseract-dev libleptonica-dev tesseract-ocr-eng
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.

Windows

Windows support requires vcpkg and MinGW-w64:

# Install Tesseract via vcpkg
vcpkg install tesseract:x64-windows

# Create MinGW import libraries from vcpkg DLLs
cd C:/vcpkg/installed/x64-windows/bin
gendef tesseract55.dll leptonica-1.87.0.dll
dlltool -d tesseract55.def -l libtesseract.a -D tesseract55.dll
dlltool -d leptonica-1.87.0.def -l libleptonica.a -D leptonica-1.87.0.dll
mv *.a ../lib/

# Download language data
mkdir C:/tessdata
curl -L -o C:/tessdata/eng.traineddata https://github.com/tesseract-ocr/tessdata/raw/main/eng.traineddata

Set environment variables before building:

export CGO_ENABLED=1
export CC=C:/mingw64/bin/gcc.exe
export CGO_CFLAGS="-IC:/vcpkg/installed/x64-windows/include"
export CGO_LDFLAGS="-LC:/vcpkg/installed/x64-windows/lib"
export TESSDATA_PREFIX="C:/tessdata"
export PATH="/c/mingw64/bin:/c/vcpkg/installed/x64-windows/bin:$PATH"

For detailed troubleshooting, see knowledge/windows-support.md.

Test

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 --engine docker
% ./test/runtime --engine vagrant

Check ./test/runtimes for more information about runtime tests.

Note: Clear Linux support was removed in January 2026 as Intel discontinued the distribution in July 2025.

Note: Arch Linux support was removed in January 2026 as the official image does not provide ARM64 architecture support.

Issues

관련 프로젝트 살펴보기

불러오는 중…