aanred / ssocr-for-php
此包的最新版本(dev-master)没有可用的许可证信息。
用于与PHP的七段式OCR一起工作的包装器。
dev-master
2017-02-21 03:02 UTC
Requires
- php: >=5.6.0
This package is not auto-updated.
Last update: 2024-09-28 20:19:55 UTC
README
用于与PHP的七段式OCR一起工作的包装器。此包装器是基于为Tesseract OCR构建的包装器Tesseract OCR for PHP。
安装
您首先需要确保已安装由auerswal提供的七段式数字OCR库 SSOCR。
要使用此库,
$ composer require aanred/ssocr-for-php
快速入门和示例
基本用法
$ssocr = new SSOCR('img.png'); echo $ssocr->run();
示例
单色图像(《004200_mono.png》链接)
$ssocr = new SSOCR('004200_mono.png'); echo $ssocr->run(); // Result // 004200
彩色图像(《004200.png》链接)
$ssocr = new SSOCR('004200.png'); // use iterative thresholding $ssocr->iterativeThreshold(); // we need to crop the image so the tiny dot on the right bottom corner is not processed $ssocr->crop(0, 0, 598, 172); echo $ssocr->run(); // Result // 004200
手动阈值(《inside_box.png》链接)
$ssocr = new SSOCR('inside_box.png'); // use manual thresholding $ssocr->threshold(20); // we need to crop the image to take only the boxed numbers $ssocr->crop(230, 195, 220, 60); echo $ssocr->run(); // Result // 086861