问题
I have installed the Tesseract OCR via MacPorts based on the documentation provided on the GitHUb, and they were installed successfully, and
However, I am trying to use Tesseract OCR for PHP (https://github.com/thiagoalessio/tesseract-ocr-for-php), so I download the zip and include the library to my php file, and use the
echo (new TesseractOCR('text.png'))
->run();
but nothing is showing up.
Below is the full code in the php
<?php
REQUIRE_ONCE __DIR__.'/src/TesseractOCR.php';
echo (new TesseractOCR('text.png'))
->run();
?>
My error log has this entry:
sh: tesseract: command not found
If you share me some lights on how to get this work, it will be great!
回答1:
In order to use Tesseract OCR you may need to follow following steps:
1) Install Tesseract OCR into your system For installation
please checkout:https://github.com/tesseract-ocr/tesseract/wiki.
For Ubuntu Linux System you can run :
sudo apt-get install tesseract-ocr
2) Make composer.json file with following content:
{"require":{"thiagoalessio/tesseract_ocr": "1.0.0-RC"}}
3) Execute command from terminal
composer install
4) Finally, Do PHP Code:
require_once "vendor/autoload.php";
echo (new TesseractOCR('test.png'))->run();
Hope this will works for you,
来源:https://stackoverflow.com/questions/38091060/how-to-setup-and-running-tesseract-ocr-for-php-opensource