当前位置:网站首页>Python image recognition OCR
Python image recognition OCR
2020-11-07 20:56:00 【Coxhuang】
List of articles
- Python Image recognition OCR
- #1 demand
- #2 Environmental Science
- #3 install
- #3.1 macOS
- #3.2 Linux(CentOS)
- #4 Use
- #4.1 python install pytesseract library
- #4.2 Python Code
- #5 Online case
Python Image recognition OCR
#1 demand
- Identify the information in the picture , Such as QR code
#2 Environmental Science
macOS / Linux Python3.7.6
#3 install
#3.1 macOS
- install tesseract
// Install only tesseract, Don't install training tools brew install tesseract // install tesseract At the same time install training tools brew install --with-training-tools tesseract // install tesseract Install all languages at the same time , The language pack is bigger , If installed, it will take a long time , It is not recommended to install , Select on demand brew install --all-languages tesseract // install tesseract, And install training tools and language brew install --all-languages --with-training-tools tesseract
2. Download the language pack
Address : https://github.com/tesseract-ocr/tessdata
I have installed a Chinese language pack here
Chinese language pack : https://github.com/tesseract-ocr/tessdata/blob/master/chi_sim.traineddata
Then copy the downloaded Chinese language pack to the following path :
/usr/local/Cellar/tesseract/4.0.0_1/share/tessdata
3. Check out the local language pack
tesseract --list-langs
#3.2 Linux(CentOS)
- Installation dependency
yum install autoconf automake libtool libjpeg-devel libpng-devel libtiff-devel zlib-devel
2. install leptonica
download : wget https://github.com/tesseract-ocr/tesseract/archive/4.1.0.tar.gz
Unpack the installation
tar -xzvf leptonica-1.74.4.tar.gz cd leptonica-1.74.4.tar.gz ./configure --profix=/usr/local/leptonica make sudo make install
3. install tesseract-ocr
wget https://github.com/tesseract-ocr/tesseract/archive/3.04.zip unzip 3.04.zip cd tesseract-3.04/ ./configure make && make install sudo ldconfig
I have installed a Chinese language pack here
Chinese language pack : https://github.com/tesseract-ocr/tessdata/blob/master/chi_sim.traineddata
Then copy the downloaded Chinese language pack to the following path :
/usr/local/share/tessdata
#4 Use
#4.1 python install pytesseract library
pip install pytesseract pip install Pillow
#4.2 Python Code
from PIL import Image import pytesseract # Specify the image path and identify the language data = pytesseract.image_to_string(Image.open('/Users/Documents/1.png'), lang='chi_sim') print(data)
#5 Online case
Address :
Participation of this paper Tencent cloud media sharing plan , You are welcome to join us , share .
版权声明
本文为[Coxhuang]所创,转载请带上原文链接,感谢
边栏推荐
- When tidb and Flink are combined: efficient and easy to use real-time data warehouse
- 模型预测准确率高达94%!利用机器学习完美解决2000亿美元库存难题
- Kubernetes服务类型浅析:从概念到实践
- ECMAScript7规范中的instanceof操作符
- Python 图片识别 OCR
- What do you think of the most controversial programming ideas?
- [original] the influence of arm platform memory and cache on the real-time performance of xenomai
- Stack bracket matching
- 虚拟DOM中给同一层级的元素设置固定且唯一的key为什么能提高性能
- 不懂数据库索引的底层原理?那是因为你心里没点b树
猜你喜欢
如何高效的学习技术
What do you think of the most controversial programming ideas?
What kind of technical ability should a programmer who has worked for 1-3 years? How to improve?
The emergence and significance of micro service
Insight -- the application of sanet in arbitrary style transfer
laravel8更新之维护模式改进
Do not understand the underlying principle of database index? That's because you don't have a B tree in your heart
你可能不知道的Animation动画技巧与细节
What magic things can a line of Python code do?
On hiz buffer
随机推荐
Ac86u KX Online
IDEA-项目未自动生成 .iml 文件
awk实现类sql的join操作
laravel8更新之维护模式改进
Awk implements SQL like join operation
[C + + learning notes] how about the simple use of the C + + standard library STD:: thread?
工作1-3年的程序员,应该具备怎么样的技术能力?该如何提升?
What magic things can a line of Python code do?
Adobe Prelude /Pl 2020软件安装包(附安装教程)
websocket+probuf.原理篇
static+代码块+多态+异常
How to think in the way of computer
模型预测准确率高达94%!利用机器学习完美解决2000亿美元库存难题
AFO
Git代码提交操作,以及git push提示failed to push some refs'XXX'
There's not much time left for Kwai Chung.
关于update操作并发问题
What do you think of the most controversial programming ideas?
年薪90万程序员不如月入3800公务员?安稳与高收入,到底如何选择?
Search and replace of sed