美文网首页
Ubuntu18.04 下python3简单提取图片中数字为文本

Ubuntu18.04 下python3简单提取图片中数字为文本

作者: Blue冰焰 | 来源:发表于2018-11-16 14:43 被阅读0次

Ubuntu18.04 下python3简单提取图片中数字为文本

    1、首先确认相关模块是否已经安装!

                〔1〕tesseract 识别引擎

                        终端下输入 tesseract -v  获取识别引擎是否安装

                〔2〕pytesseract 模块

                        终端下输入 pip3 install pytesseract    等待安装完成  

    2、找到所需图片,我随便找了一个!放到你能知道到的目录下

                我放在了  /home/bingyan/Desktop/123.png    一会会用到   ps:其他图片格式也可以,可以自测

    3、进入python命令行,我用的是ipython  无所谓除了进入的方法不一样其他都一样

                〔1〕import pytesseract 

                〔2〕from PIL import Image

                〔3〕str = pytesseract.image_to_string(Image.open('/home/bingyan/Desktop/123.png '), lang='eng')

                〔4〕str

相关文章

网友评论

      本文标题:Ubuntu18.04 下python3简单提取图片中数字为文本

      本文链接:https://www.haomeiwen.com/subject/dulmfqtx.html