Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zhoukekestar committed May 26, 2024
1 parent 9be40e0 commit 9c8545a
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions _posts/2024-04~06/2024-04-27-ocr.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,26 @@ commentIssueId: 128
from paddleocr import PaddleOCR, draw_ocr

ocr = PaddleOCR(use_angle_cls=False, lang="ch", page_num=0)
img_path = './202.pdf'
img_path = './bijiao.pdf'


result = ocr.ocr(img_path, cls=False)
textResult = []
for idx in range(len(result)):
res = result[idx]
for line in res:
# print(line)
textResult.append(line[1][0])

fo = open("202.txt", "w")
# 空判断
if res == None:
continue
else:
for line in res:
# print(line)
textResult.append(line[1][0])

fo = open("bijiao.txt", "w")
fo.write( '\n'.join(textResult))

# 关闭打开的文件
fo.close()
```

Expand Down

0 comments on commit 9c8545a

Please sign in to comment.