shinbuntu / gocr-php
Gocr for PHP
dev-master
2016-08-11 00:19 UTC
Requires
- php: ~5.6
Requires (Dev)
- atoum/atoum: ~2.2
- mayflower/php-codebrowser: ~1.1
- pdepend/pdepend: ~2.1
- phpdocumentor/phpdocumentor: ~2.8
- phploc/phploc: ~2.1
- phpmd/phpmd: ~2.2
- sebastian/phpcpd: ~2.0
- siwayll/phpcs-norme-dpsi: ~3.2
This package is not auto-updated.
Last update: 2025-01-08 20:29:39 UTC
README
A wrapper to work with Gocr inside PHP scripts.
Why?
This project makes easier the use of the OCR software named GOCR.
Dependencies
Installation
$ composer require shinbuntu/gocr-php
Usage
Instantiate the Gocr object with the image path:
$gocr = new Gocr('testData/images/welcome.png');
Recognize and get text content:
$textContent = $gocr->recognize();
Set spacewidth between words in units of dots (default: 0 for autodetect):
Wider widths are interpreted as word spaces, smaller as character spaces.
$gocr->setSpaceWidthParam(20);
Set Operational mode; mode is a bitfield (default: 0):
$gocr->setModeParam(258);
Set value for certainty of recognition (0..100; default: 95):
Characters with a higher certainty are accepted, characters with a lower certainty are treated as unknown (not recognized); set higher values, if you want to have only more certain recognized characters.
$gocr->setValueForCertaintyOfRecognitionParam(100);
Set database path, a final slash must be included, default is ./db/:
This path will be populated with images of learned characters.
$gocr->setDatabasePathParam('testData/db/');
Contributing
See the CONTRIBUTING file.
License
The project is open-sourced software licensed under the MIT license.