当前位置:网站首页>Character recognition easyocr
Character recognition easyocr
2022-04-23 05:37:00 【Ice and snow chess book】
# Identify a single picture + Show + preservation
#!-*-coding:utf-8-*-
import easyocr
import cv2
import time
reader=easyocr.Reader(['ch_sim','en'])
img=cv2.imread('test (1).jpg')
result=reader.readtext(img)
color=(0,0,255)
thick=3
for res in result:
print(res)
pos = res[0]
text = res[1]
for p in [(0,1),(1,2),(2,3),(3,0)]:
cv2.line(img,tuple(pos[p[0]]),tuple(pos[p[1]]),color,thick)
cv2.putText(img, text,(pos[0][0]+10,pos[0][1]-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255))
cv2.imshow('result',img)
time.sleep(10)
cv2.imwrite('bx-road-poetry.jpg',img)
# Identify all pictures in the folder and save
import easyocr
import cv2
import time
import os
reader=easyocr.Reader(['ch_sim','en'])
parent_path="./images/license_plate_test/"
for filename in os.listdir(parent_path):
print(filename)
path=os.path.join(parent_path,filename)
img=cv2.imread(path)
#img=cv2.imread('test (1).jpg')
result=reader.readtext(img)
color=(0,0,255)
thick=3
for res in result:
print(res)
pos = res[0]
text = res[1]
for p in [(0,1),(1,2),(2,3),(3,0)]:
cv2.line(img,tuple(pos[p[0]]),tuple(pos[p[1]]),color,thick)
cv2.putText(img, text,(pos[0][0]+10,pos[0][1]-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255))
#cv2.imshow('result',img)
#time.sleep(10)
cv2.imwrite("./reultimg/"+filename,img)
conda create easyocr
conda activate easyocr
pip install easyocr
pip install torch torchvision torchaudio
edition :
torch==1.5.1
torchvision==0.4.1
easyocr==1.4.2
Pay attention to the version problem , Modify the version installation several times , The above version can run the code normally .
show There is a problem with the display of Chinese characters when , yes OpenCV The display of Chinese characters is not supported , It needs to be transcoded .
版权声明
本文为[Ice and snow chess book]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230530364323.html
边栏推荐
- Golang implements Ping connectivity detection case through exec module
- JVM memory and memory overflow exceptions (personal summary)
- [machine learning] scikit learn introduction
- Parameter analysis of open3d material setting
- Establish excel bookkeeping book through setting context menu
- Arithmetic and logical operations
- [triangle Yang Hui triangle printing odd even cycle JS for break cycle]
- Hongji cyclone RPA provides technical support for Guojin securities and realizes process automation in more than 200 business scenarios
- Necessity of selenium preloading cookies
- QSslSocket::connectToHostEncrypted: TLS initialization failed
猜你喜欢

Create cells through JS (while loop)
![[untitled] Notepad content writing area](/img/0a/4a3636025c3e0441f45c99e3c67b67.png)
[untitled] Notepad content writing area

Generation of straightening body in 3D slicer

Create a tabbar component under the components folder, which is public

弘玑微课堂 | Cyclone RPA之“灵活的数字员工”执行器

Uncle wolf is looking for a translator -- Plato -- ongoing translation

Radar equipment (greedy)

Flutter 新一代圖形渲染器 Impeller

C language - Spoof shutdown applet

OSI层常用协议
随机推荐
Frequently asked interview questions - 1 (non technical)
提升独立站转化率攻略 | 挽回弃购用户
Vscode settings JSON configuration
C, class library
selenium預先加載cookie的必要性
Multiple mainstream SQL queries only take the latest one of the data
AcWing 1096. Detailed notes of Dungeon Master (3D BFS) code
Hongji | how does HR carry out self change and organizational change in the digital era?
Formal parameters, local variables and local static variables
Find the number of "blocks" in the matrix (BFS)
Nécessité de précharger les cookies dans le sélénium
Quick app bottom navigation bar
Usage and difference of shellexecute, shellexecuteex and winexec in QT
Establish excel bookkeeping book through setting context menu
Membarrier (personal learning and understanding)
Common interview questions - 4 (MySQL)
what is wifi6?
Create process memory management copy_ Mm - processes and threads (IX)
Create cells through JS (while loop)
Parameter analysis of open3d material setting