百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
G

gosseract

> 编程语言
开源

用于 OCR (光学字符识别) 的 Go 包,使用 Tesseract C++ 库

3.1K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

用于 OCR (光学字符识别) 的 Go 包,使用 Tesseract C++ 库

gosseract OCR

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

  • https://github.com/otiai10/gosseract/issues

GitHub Issues· 32 开放

在 GitHub 查看全部
  • #324

    tessbridge.cpp:5:10: fatal error: 'leptonica/allheaders.h' file not found

    更新于 2026年6月21日
  • #321

    gosseract.NewClient() undefined

    更新于 2025年9月7日
  • #322

    Note: build gosseract on Windows 10

    更新于 2025年3月21日
  • #318

    build fail,undefined: gosseract.NewClient

    更新于 2025年2月14日
  • #320

    undefined reference to symbol 'inflateEnd'

    更新于 2025年2月12日
  • #266

    gosseract finds no text where tesseract does

    更新于 2024年12月30日
  • #317

    undefined reference to `tesseract::TessBaseAPI::~TessBaseAPI()

    更新于 2024年12月10日
  • #316

    Losing stderr when running multiple clients at once

    更新于 2024年10月14日
  • #311

    [Asahi Linux] undefined: gosseract.NewClient when CGO_ENABLED=0

    更新于 2024年10月4日
  • #314

    Support for character bounding boxes.

    更新于 2024年9月24日

核心特点

  • •Go
  • •go
  • •ocr
  • •ocr-server
  • •tesseract

> 标签

Gogoocrocr-servertesseract

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言