自行车 / tesseract-bridge
通过FFI和CLI整合tesseract bridge
0.250
2021-01-28 16:13 UTC
Requires
- php: >7.4.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.17.3
- phing/phing: dev-master
- phpmd/phpmd: ^2.9.1
- phpunit/phpunit: ^9.5.0
- sebastian/phpcpd: ^6.0.3
- squizlabs/php_codesniffer: ^3.5.8
- vimeo/psalm: ^4.3.2
Suggests
- ext-ffi: So you can use tesseract via ffi integration
This package is auto-updated.
Last update: 2024-09-08 14:25:24 UTC
README
一个用于通过CLI和/或FFI接口在PHP中与Tesseract OCR交互的包装器。
‼️ 仅在FreeBSD、Debian和Ubuntu平台以及Tesseract OCR版本3和4上进行了测试(请参阅构建日志)。
安装
通过Composer
$ composer require bicycle/tesseract-bridge
用法
基本用法
-
CLI ```php use Bicycle\Tesseract\Bridge as TesseractBridge;
$configuration = TesseractBridge\Configuration(['binary_path' => 'tesseract']); $bridge = new TesseractBridge\CLI($configuration); echo $bridge->testGetVersion(); print_r($bridge->getAvailableLanguages()); echo $bridge->recognizeFromFile('eurotext.png'); // Set proper path here ```
-
FFI ```php use Bicycle\Tesseract\Bridge as TesseractBridge;
$configuration = TesseractBridge\Configuration(['binary_path' => 'tesseract']); $bridge = new TesseractBridge\FFI($configuration); echo $bridge->testGetVersion(); print_r($bridge->getAvailableLanguages()); echo $bridge->recognizeFromFile('eurotext.png'); // Set proper path here ```
语言支持
-
CLI ```php use Bicycle\Tesseract\Bridge as TesseractBridge;
$configuration = TesseractBridge\Configuration(['binary_path' => 'tesseract']); $bridge = new TesseractBridge\CLI($configuration); echo $bridge->testGetVersion(); print_r($bridge->getAvailableLanguages()); echo $bridge->recognizeFromFile('eurotext.png', ['deu']); // Set proper path here ```
-
FFI ```php use Bicycle\Tesseract\Bridge as TesseractBridge;
$configuration = TesseractBridge\Configuration(['binary_path' => 'tesseract']); $bridge = new TesseractBridge\FFI($configuration); echo $bridge->testGetVersion(); print_r($bridge->getAvailableLanguages()); echo $bridge->recognizeFromFile('eurotext.png', ['deu']); // Set proper path here ```
如何贡献
您可以通过以下方式为该项目做出贡献:
附加信息
请查看我们的常见问题解答。
许可协议
tesseract-bridge是在MIT许可协议下发布的。