Tesserocr bindings
Project description
ocrd_tesserocr
Crop, deskew, segment into regions / lines / words, or recognize with tesserocr
Introduction
This offers OCR-D compliant workspace processors for (much of) the functionality of Tesseract via its Python API wrapper tesserocr . (Each processor is a step in the OCR-D functional model, and can be replaced with an alternative implementation. Data is represented within METS/PAGE.)
This includes image preprocessing (cropping, binarization, deskewing), layout analysis (region, line, word segmentation) and OCR proper. Most processors can operate on different levels of the PAGE hierarchy, depending on the workflow configuration. Image results are referenced (read and written) via AlternativeImage
, text results via TextEquiv
, deskewing via @orientation
, cropping via Border
and segmentation via Region
/ TextLine
/ Word
elements with Coords/@points
.
Installation
Required ubuntu packages:
- Tesseract headers (
libtesseract-dev
) - Some tesseract language models (
tesseract-ocr-{eng,deu,frk,...}
or script models (tesseract-ocr-script-{latn,frak,...}
) - Leptonica headers (
libleptonica-dev
)
From PyPI
This is the best option if you want to use the stable, released version.
sudo apt-get install git python3 python3-pip libtesseract-dev libleptonica-dev tesseract-ocr-eng tesseract-ocr wget
pip install ocrd_tesserocr
With docker
This is the best option if you want to run the software in a container.
You need to have Docker
docker pull ocrd/tesserocr
From git
This is the best option if you want to change the source code or install the latest, unpublished changes.
We strongly recommend to use venv.
git clone https://github.com/OCR-D/ocrd_tesserocr
cd ocrd_tesserocr
make deps-ubuntu # or manually with apt-get
make deps # or pip install -r requirements
make install # or pip install .
Usage
See docstrings and in the individual processors and ocrd-tool.json descriptions.
Available processors are:
- ocrd-tesserocr-crop
- ocrd-tesserocr-deskew
- ocrd-tesserocr-binarize
- ocrd-tesserocr-segment-region
- ocrd-tesserocr-segment-line
- ocrd-tesserocr-segment-word
- ocrd-tesserocr-recognize
Testing
To run with docker:
docker run ocrd/tesserocr ocrd-tesserocrd-crop ...
Testing
make test
This downloads some test data from https://github.com/OCR-D/assets under repo/assets
, and runs some basic test of the Python API as well as the CLIs.
Set PYTEST_ARGS="-s --verbose"
to see log output (-s
) and individual test results (--verbose
).
Development
Latest changes that require pre-release of ocrd >= 2.0.0 are kept in branch edge
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ocrd_tesserocr-0.5.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18cef805014268db86fd6c32bca83069cdf536298fe8151f59f9197d255a9d14 |
|
MD5 | 8835763816200fbfec9b58670bd69d8f |
|
BLAKE2b-256 | 0684b5aca7d06e31dcb91683ab60e154b73a8d0e1cb4d5ae22debf55922573df |