软件下载安装地址:https://jingyan.baidu.com/article/219f4bf788addfde442d38fe.html
下载traineddata
前往:https://github.com/tesseract-ocr/tesseract/wiki/Data-Files
下载Data Files for Version 4.00 (November 29, 2016)以及
Updated Data Files for Version 4.00 (September 15, 2017)
转自:https://blog.youkuaiyun.com/weixin_41905562/article/details/81040118
2、php辅助包:
https://github.com/ShuiPingYang/tesseract-ocr-for-php
3、语言包:
识别效果还是不错的,直接看例子:
这是我要识别的图片: 
识别输出为:
当 打 开 一 个 终 端 的 时 候 , 该 终 端 最 初 会 抒 行 一 组 命 令 来 定 义 诸 如 提 示 文 本 . 颜 色 等 各 类 设 置 。
这 组 命 令 来 自 位 于 用 户 home 目 录 中 的 -bashre 脚 本 文 件 (-/bashre)。Bash 还 维 护 了 一 个 历 史 记 录
文 件 -/bash_history, 用 于 保 存 用 户 运 行 过 的 命 令 。- 是 一 种 简 写 , 代 表 用 户 home 目 录 的 路 径 。
在 Bash 中 , 每 个 命 令 或 是 命 令 序 列 是 通 过 使 用 分 号 或 换 行 符 来 分 隔 的 。 比 如 :[Finished in 3.1s]
则里面还是有些错误,所以会用到训练库那个软件,暂时还没有尝试。
想要尝试的朋友可以看看:
https://www.cnblogs.com/cnlian/p/5765871.html
交流论坛:
https://gitter.im/thiagoalessio/tesseract-ocr-for-php
摊主的代码老牛比了,贴一个上来:
前提是你的项目下面已经:
composer require thiagoalessio/tesseract_ocr
-
<?php -
require_once __DIR__ . '/vendor/autoload.php'; -
use thiagoalessio\TesseractOCR\TesseractOCR; -
# saving image locally -
#这个是网上的图片,我第一次看到下面这种用法。 -
$imageUrl = 'https://files.gitter.im/thiagoalessio/tesseract-ocr-for-php/gFLb/deretan.png'; -
$imageTempName = tempnam(sys_get_temp_dir(), 'image-from-kartaterazu'); -
file_put_contents($imageTempName, file_get_contents($imageUrl)); -
# recognizing it -
$ocr = new TesseractOCR($imageTempName); -
$ocr->psm(4); -
echo $ocr->run(), PHP_EOL;
本文介绍OCR软件的下载及安装流程,包括获取traineddata文件和语言包的步骤。同时,分享了如何利用PHP辅助包进行图像文字识别,提供了具体代码示例和效果展示。
790

被折叠的 条评论
为什么被折叠?



