当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- 团灭 LeetCode 股票买卖问题
- Let's talk about the locks in the database
- 动态规划——用二进制表示集合的状态压缩DP
- 【C++学习笔记】C++ 标准库 std::thread 的简单使用,一文搞定还不简单?
- Jingtao project day09
- 屏读时代,我们患上了注意力缺失候群症
- What magic things can a line of Python code do?
- Practice of Xiaoxiong school development board: real equipment access of smart street lamp sandbox experiment
- 获取树形菜单列表
- 如何高效的学习技术
猜你喜欢

团灭 LeetCode 股票买卖问题

Do not understand the underlying principle of database index? That's because you don't have a B tree in your heart

数据库基本操作

一万四千字分布式事务原理解析,全部掌握你还怕面试被问?

洞察——风格注意力网络(SANet)在任意风格迁移中的应用

Count the frequency of letters in text (case insensitive)

The emergence and significance of micro service

微信小程序request报400错误 @RequestBody接收不到

use Xunit.DependencyInjection Transformation test project

Got timeout reading communication packets解决方法
随机推荐
使用 Xunit.DependencyInjection 改造测试项目
Cpp(一) 安装CMake
supervisor和Python多进程multiprocessing使用 子进程残留问题
sed之查找替换
supervisor进程管理安装使用
From technology to management, the technology of system optimization is applied to enterprise management
Ac86u KX Online
delphi10的rest.json与system.json的踩坑
In the age of screen reading, we suffer from attention deficit syndrome
How Facebook open source framework simplifies pytorch experiment
static+代码块+多态+异常
Stack bracket matching
Let's talk about the locks in the database
阿里terway源码分析
统计文本中字母的频次(不区分大小写)
Adobe Lightroom /Lr 2021软件安装包(附安装教程)
Web安全(三)---CSRF攻击
Adobe media encoder /Me 2021软件安装包(附安装教程)
Deep into web workers (1)
Web安全(四)---XSS攻击