Recognize Text in Image using Tesseract OCR and PHP

thiagoalessio/tesseract_ocr wrapper

  1. Install Tesseract OCR on your system. Make sure that Tesseract is accessible from the command line:
tesseract --version
  1. Add thiagoalessio/tesseract_ocr wrapper to composer.json file:
"require": {
    "thiagoalessio/tesseract_ocr": "^2.9"
  1. Install library from the command line:
composer install
  1. Recognize text in image using Tesseract OCR:

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

Your email address will not be published.