fizzday/ocrphp

a simple and beautiful ocr php library which can easily recognize the image to text depend on tesseract-ocr (一个简洁优雅的图像识别转换文字的php类库, 须安装tesseract-ocr)

dev-master 2017-02-03 08:54 UTC

This package is not auto-updated.

Last update: 2024-11-23 20:20:49 UTC


README

description

a simple and beautiful ocr php library which can easily recognize the image to text depend on tesseract-ocr ( 一个简洁优雅的图像识别转换文字的php类库, 须安装tesseract-ocr)

useage

english document
中文文档

install with composer

{
    "require": {
        "fizzday/ocrphp": "dev-master"
    }
}

or

composer require fizzday/ocrphp

notice : before recognize , you need install the tesseract engine, which can find in my blog ...

recognize

use Fizzday\OcrPHP;

OcrPHP::file($file)->run();

// or

OcrPHP::file($file)->lang($lang)->psm($psm)->run($type);

it shall like :

OcrPHP::file('/var/www/img/test.jpg')->lang('eng')->run();

// or

OcrPHP::file('/var/www/img/test.jpg')->lang(['eng', 'chi_sim'])->psm(3)->run('id');

comment

  • $file -- the source file in local
  • $lang -- the recognize language , like english(eng), chinese(chi_sim or chi_tra) ......
  • $psm -- the reconize type default 3
  • $type -- the Specific results like id_num, business card ...... which can return the info you need directly, default null, thie library have offered the id_num return , you just need the 'id' param in run() method