Python实现离线文字识别
Python有很多库可以进行文字识别,但不少都是要联网的,而且有的还需要翻墙才能用.对于需要离线进行的文字识别,pytesseract正好可以解决这个痛点.要使用pytesseract,先要安装Tesseract,该软件有32位和64位,可以在下面的网址下载.
32位:https://digi.bib.uni-mannheim.de/tesseract/tesseract-ocr-w32-setup-v5.0.1.20220118.exe
64位:https://digi.bib.uni-mannheim.de/tesseract/tesseract-ocr-w64-setup-v5.0.1.20220118.exe
下载完成后安装即可.安装包还提供了可供下载的中文简体语言包,也可以联网进行下载.
安装完成后打开安装路径,将它添加到系统变量PATH中.
下面需要安装pytesseract和Pillow两个库.用pip命令安装.
安装完成后我们可以写个程序验证下这个库的功能.我们以下面这幅图片为例.
新建一个Python文件,输入以下代码:
from PIL import Image
import pytesseract
print(pytesseract.image_to_string(Image.open('E:\sim.jpg')))保存并运行程序,可以查看结果:
‘Typical Cover Letter Format
Your Address
‘Your Contact Information
Date
Contact Name (i available)
Contact Title
‘Compary Name
‘Company Address
Dear Mr/Ms,/Dr.(f no contact, you can say “Human Resources Manager, or Hiring Manager"),
‘The first paragraph is an introduction of yourself and how you learned of the opening, as well as your
interest in the postionforganization. This requires you to relate yourself to the organization or tothe
postion in order to demonstrate your interest.
The middle paragraph(s) is a profile of how your skils and experience match the qualifications
‘sought. In order to do this, consider the following points:
Read the job description carefully to get a clear idea of what the company is looking for. This goes
beyond just the “qualifications” section of a job description- make sure to discuss your abilty to do
the job.
Review the company website to learn what type of person the company might value.
Match your background, whether itis work experience, academics, volunteer experience, etc. and
describe why you believe these experiences make you a qualified candidate for the positon,
‘The last paragraph wraps up the cover letter. You should reiterate your interest in the pasion, and
<desire to hear from them regarding the opportunity. You also want to thank the reader for ther time in
‘considering your application, and provide information for how you can be reached. if you would ike,
and are able to, you can state that you wil follow-up with them directly. Be positive and confident
(without being arrogant).
Sincerely,
‘Signed Signature ({f a physical copy is being sent)
Name (Typed)
我们还可以利用Tkinter结合这个库制作一个GUI文字识别程序.后期本人打算基于这个库开发一个Scribus文字识别插件.
good job
页:
[1]