Reputation: 173
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!
Upvotes: 3
Views: 22233
Reputation: 192
you forgot to insert after require_once use thiagoalessio\TesseractOCR\TesseractOCR;
Basically to work, you can simple do it:
<?php
require_once "../vendor/autoload.php";
use thiagoalessio\TesseractOCR\TesseractOCR;
$ocr = new TesseractOCR("17.png");
$content = $ocr->run();
echo $content;
Upvotes: 0
Reputation: 549
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,
Upvotes: 7