- Install Tesseract OCR on your system. Make sure that Tesseract is accessible from the command line:
tesseract --version
- Add
thiagoalessio/tesseract_ocr
wrapper to composer.json
file:
"require": {
"thiagoalessio/tesseract_ocr": "^2.9"
}
- Install library from the command line:
composer install
- Recognize text in image using Tesseract OCR:
<?php
use thiagoalessio\TesseractOCR\TesseractOCR;
require_once __DIR__.'/vendor/autoload.php';
$ocr = new TesseractOCR('test.png');
$text = $ocr->run();
echo $text;
Leave a Comment
Cancel reply