https://github.com/ddeboer/tesseract
A PHP wrapper for the Tesseract OCR engine
https://github.com/ddeboer/tesseract
ocr php tesseract
Last synced: over 1 year ago
JSON representation
A PHP wrapper for the Tesseract OCR engine
- Host: GitHub
- URL: https://github.com/ddeboer/tesseract
- Owner: ddeboer
- License: mit
- Created: 2013-04-10T20:07:37.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2017-10-16T19:24:14.000Z (over 8 years ago)
- Last Synced: 2024-10-12T04:31:40.291Z (over 1 year ago)
- Topics: ocr, php, tesseract
- Language: PHP
- Homepage:
- Size: 353 KB
- Stars: 21
- Watchers: 7
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/ddeboer/tesseract)
Tesseract: a wrapper for the Tesseract OCR engine
================================================
A small PHP >=5.3 library that makes working with the open source [Tesseract OCR engine](https://github.com/tesseract-ocr)
easier.
Installation
------------
You need a working Tesseract installation. For more information about
installation and adding language support, see Tesseract’s [README](https://github.com/tesseract-ocr/tesseract/blob/master/README.md).
Then install this library, which is available on [Packagist](http://packagist.org/packages/ddeboer/tesseract),
through [Composer](http://getcomposer.org/):
$ composer require ddeboer/tesseract:1.0
Usage
-----
If the `tesseract` binary is in your path, just do:
```php
use Ddeboer\Tesseract\Tesseract;
$tesseract = new Tesseract();
```
Otherwise, construct Tesseract with the path to the binary:
```php
$tesseract = new Tesseract('/usr/local/bin/tesseract');
```
Get version and supported languages information:
```php
$version = $tesseract->getVersion();
$languages = $tesseract->getSupportedLanguages();
```
Perform OCR on an image file:
```php
$text = $tesseract->recognize('myfile.tif');
```
Optionally, specify the language(s) as second argument:
```php
$text = $tesseract->recognize('myfile.tif', array('nld', 'eng'));
```
And specify Tesseract’s page seg mode as third argument:
```php
$text = $tesseract->recognize('myfile.tif', null, Tesseract::PAGE_SEG_MODE_AUTOMATIC_OSD);
```