Skip to content

Commit f4f2b5a

Browse files
committed
m
1 parent 618203a commit f4f2b5a

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

yeke/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
+ [py-minesweep](https://github.com/JustDoPython/python-examples/tree/master/yeke/py-minesweep) :用 Python 实现扫雷小游戏
1919
+ [py-ascii](https://github.com/JustDoPython/python-examples/tree/master/yeke/py-ascii) :Python 实现图片转字符画,静态图、GIF 都能转
2020
+ [py-snow](https://github.com/JustDoPython/python-examples/tree/master/yeke/py-snow) :用 Python 实现带音乐的雪花飘落雪景图
21+
+ [py-discern](https://github.com/JustDoPython/python-examples/tree/master/yeke/py-discern) :十行 Python 代码就提取了韦小宝的身份证信息
2122

2223
---
2324

yeke/py-discern/__init__.py

Whitespace-only changes.

yeke/py-discern/card.jpg

144 KB
Loading

yeke/py-discern/idcard_discern.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from aip import AipOcr
2+
3+
APP_ID = ''
4+
API_KEY = ''
5+
SECRET_KEY = ''
6+
# 创建客户端对象
7+
client = AipOcr(APP_ID, API_KEY, SECRET_KEY)
8+
# 打开并读取文件内容
9+
fp = open("card.jpg", "rb").read()
10+
# res = client.basicGeneral(fp) # 普通
11+
res = client.basicAccurate(fp) # 高精度
12+
# 遍历结果
13+
for tex in res["words_result"]:
14+
row = tex["words"]
15+
print(row)

0 commit comments

Comments
 (0)