自行车/tesseract-bridge

通过FFI和CLI整合tesseract bridge

0.250 2021-01-28 16:13 UTC

This package is auto-updated.

Last update: 2024-09-08 14:25:24 UTC


README

一个用于通过CLI和/或FFI接口在PHP中与Tesseract OCR交互的包装器。

Minimum PHP Version Build Status Codacy Badge codecov Scrutinizer Code Quality Latest stable version on packagist Total downloads Monthly downloads License

‼️ 仅在FreeBSD、Debian和Ubuntu平台以及Tesseract OCR版本3和4上进行了测试(请参阅构建日志)。

安装

通过Composer

$ composer require bicycle/tesseract-bridge

用法

基本用法

example

  • 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
    ```
    

如何贡献

您可以通过以下方式为该项目做出贡献:

  • 如果您发现了一个错误或希望提出一个新功能,请提交问题
  • 如果您想要改进/创建/修复某些内容,请提交PR

附加信息

请查看我们的常见问题解答

许可协议

tesseract-bridge是在MIT许可协议下发布的。