web建站教程
     
  1. 首页
  2. 前端UI组件库
  3. AI项目和框架
  4. AIGC工具
  5. 百度echarts
  6. 地图大全
  7. 前端知识
  8. 更多
    vuejs
    js入门
    php入门
    mysql
    wordpress
    织梦cms
    帝国cms
    git教程
    IT知识
    模板大全
    休息站
    AI应用

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

673 ℃

提取出票日期

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,我们会在看到邮件的第一时间内为您处理!

当前位置: 首页 > 后端开发
Trae:新一代免费的AI编程工具

呱呱工具箱

一款免费的在线小工具,无需下载,打开即可使用!呱呱工具箱

在线育儿补贴计算器

快来看看你到底可以领到多少补贴!生活小工具
上一篇:
下一篇:
x 打工人ai神器