OcrPHP是一个一个简洁优雅的图像识别转换文字的php类库,须安装tesseract-ocr
使用composer安装{"require":{"fizzday/ocrphp":"dev-master"}}或者
composerrequirefizzday/ocrphp注意:使用之前必须先安装 tesseract,安装方法见我的博客
开始使用useFizzday\OcrPHP;OcrPHP::file($file)->ru();//orOcrPHP::file($file)->lag($lag)->psm($psm)->ru($type);将会是这样的:
OcrPHP::file('/var/www/img/test.jpg')->lag('eg')->ru();//orOcrPHP::file('/var/www/img/test.jpg')->lag(['eg','chi_sim'])->psm(3)->ru('id');说明
$file --本地图片源文件$lag --要识别的语言,如英语(eg),汉语(chi_sim(简体)orchi_tra(繁体))......$psm --识别类型默认为3$type --自定义识别输出的结果,比如自定义身份证号码,名片相关信息,本类提供了身份证号码的输出('id'),默认为空,返回完全输出信息









评论