web建站教程
  1. 首页
  2. vuejs
  3. js
  4. 好玩
  5. AIGC工具
  6. 前端知识
  7. 百度echarts
  8. 更多
    php入门
    nodejs
    mockjs
    reactjs
    mysql
    wordpress
    织梦cms
    帝国cms
    git教程
    IT知识
    模板大全
    休息站
    手机应用

Python语言如何实现批量数据提取(附代码)

532 ℃

提取出票日期

def text1(new_img):
#提取出票日期
left = 80
top = 143
right = 162
bottom = 162
image_text1 = new_img.crop((left, top, right, bottom))
#展示图片
#image_text1.show()
txt1 = tool.image_to_string(image_text1)
print(txt1)
return str(txt1)

提取金额

def text2(new_img):
#提取金额
left = 224
top = 355
right = 585
bottom = 380
image_text2 = new_img.crop((left, top, right, bottom))
#展示图片
#image_text2.show()
image_text2.save("img/tmp.png")
temp = ocr.ocr("img/tmp.png")
temp="".join(temp[0])
txt2=chineseNumber2Int(temp)
print(txt2)
return txt2

提取出票人

def text3(new_img):
#提取出票人
left = 177
top = 207
right = 506
bottom = 231
image_text3 = new_img.crop((left, top, right, bottom))
#展示图片
#image_text3.show()
image_text3.save("img/tmp.png")
temp = ocr.ocr("img/tmp.png")
txt3="".join(temp[0])
print(txt3)
return txt3

提取付款行

def text4(new_img):
#提取付款行
left = 177
top = 274
right = 492
bottom = 311
image_text4 = new_img.crop((left, top, right, bottom))
#展示图片
#image_text4.show()
image_text4.save("img/tmp.png")
temp = ocr.ocr("img/tmp.png")
txt4="".join(temp[0])
print(txt4)
return txt4

提取汇票到账日期

def text5(new_img):
#提取汇票到日期
left = 92
top = 166
right = 176
bottom = 184
image_text5 = new_img.crop((left, top, right, bottom))
#展示图片
#image_text5.show()
txt5 = tool.image_to_string(image_text5)
print(txt5)
return txt5

提取票据单据

def text6(new_img):
#提取票据号码
left = 598
top = 166
right = 870
bottom = 182
image_text6 = new_img.crop((left, top, right, bottom))
#展示图片
#image_text6.show()
txt6 = tool.image_to_string(image_text6)
print(txt6)
return txt6

Python语言如何实现大写汉字和数字的转换

Python语言适合哪些应用场景

标签: Python数据提取, Python语言

上面是“Python语言如何实现批量数据提取(附代码)”的全面内容,想了解更多关于 后端开发 内容,请继续关注web建站教程。

当前网址:https://ipkd.cn/webs_4293.html

声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

当前位置: 网站首页 > 后端开发
本文共计1331个字,预计阅读时长9分钟
Trae:新一代免费的AI编程工具

基金从业资格考试题库

一站式备考基金从业资格考试,收录2021-2025年模拟题库!呱呱工具箱

AI工作站

收录全球3800+ 款各行各业AI应用,轻轻松松做事!
生活小工具,收录了80多款小工具
上一篇: 推荐一款免费可商用仿宋字体——汉字之美仿宋GBK
下一篇: 推荐一款免费可商用英文字体——Atkinson Hyperlegible
x 打工人ai神器