注意: CentOS 7 php中开启exec,system等函数调用系统命令
仓库里添加第三方源
yum-config-manager --add-repo https://download.opensuse.org/repositories/home:/Alexander_Pozdnyakov/CentOS_7/
引入rpm包
sudo rpm --import https://build.opensuse.org/projects/home:Alexander_Pozdnyakov/public_key
更新仓库
yum update
安装 tesseract
yum install tesseract
查看版本,能看到版本说明安装完成
tesseract -v
搜索语言包
- yum search tesseract-langpack //也可以到GitHub下载:https://github.com/tesseract-ocr/tessdata
- 将包上传到服务器/usr/share/tesseract/4/tessdata(可能不在这,以实际安装目录为准)
使用
composer require thiagoalessio/tesseract_ocr
chi_sim 中文简体
echo (new TesseractOCR('/test-2.jpg'))->lang('chi_sim')->run();