python识别图像中的文字
我们想识别图像中对我们有用的评论,所以需要卡一个阈值来仅仅获得对我们有用的信息
import easyocr# 创建reader对象
import json
reader = easyocr.Reader(['en'])
result_list = reader.readtext('review2.png')
def use_result_list_to_recentangle(result_list):pos_list = []text_list = []for sample in result_list:if int(sample[0][1][0])>560:pos_list.append(sample[0])text_list.append(sample[1])return pos_list,text_listdef get_important_information(pos_list,text_list):tmp_sample = {}content = ''all_samples = []flag = 'review_background'for index in range(len(text_list)):if 'Reviewed in the' in text_list[index]:place = text_list[index]title = text_list[index-1]tmp_sample['title'] = titletmp_sample['place'] = placeif 'Color' in text_list[index]:color = text_list[index]tmp_sample['color'] = colorif flag == 'content':content += text_list[index]if 'Purchase' in text_list[index]:Verify_purchase = text_list[index]tmp_sample['Verify_purchase'] = Verify_purchaseflag = 'content'if 'Helpful' == text_list[index]:flag = 'review_background'tmp_sample['content'] = contentall_samples.append(tmp_sample)content = ''tmp_sample = {}return all_samplespos_list,text_list = use_result_list_to_recentangle(result_list)
all_samples = get_important_information(pos_list,text_list)
json_path = '/cloud/cloud_disk/users/huh/nlp/vision-reptile/vision_reptile/data/result.json'
out_file = open(json_path, "w")
json.dump(all_samples, out_file, indent=6)
python识别图像中的文字相关推荐
- 使用python识别图像中的文字
以下内容主要介绍一下使用python语言及PIL,pytesser模块来识别图片中的文字,这样方便我们在模拟网站登录时识别验证码(可能也需要用到selenuim模块). 现在正式开始介绍: PIL安装 ...
- python 识别图像中的文字(数字)之python图文识别
最近在爬一个网站,找了数据老半天突然发现原来人家不是用数据传输过来的,而是用png背景透明的图片传输过来的,这把我气的不轻.不过发现了是图片就好说,图像文字识别呗,结果发现,这玩意儿里面又有坑等着我. ...
- Python识别图像中的文字、数字等
今天给大家分享一个生活中常见的案例,那就是识别图片.PDF文档中的数据,主要是以文字和数字为例. 需要用到两个第三方库:pyocr.cnocr 这里有个大坑:在安装这两个第三方库的时候走了很漫长的路. ...
- python 图像处理与识别书籍_Python图像处理之识别图像中的文字(实例讲解)
①安装PIL:pip install Pillow(之前的博客中有写过) ②安装pytesser3:pip install pytesser3 ③安装pytesseract:pip install p ...
- python去除图片上的文字_Python图像处理之识别图像中的文字(实例讲解)
①安装PIL:pip install Pillow(之前的博客中有写过) ②安装pytesser3:pip install pytesser3 ③安装pytesseract:pip install p ...
- 编程实战(4)——python识别图像中的坐标点并保存坐标数据
编程实战(4)--python识别图像中的坐标点并保存坐标数据 文章目录 编程实战(4)--python识别图像中的坐标点并保存坐标数据 综述 代码思路 库的安装 图片预处理 图像细化 图像二极化 提 ...
- Python图像处理之识别图像中的文字
①安装PIL:pip install Pillow(之前的博客中有写过) ②安装pytesser3:pip install pytesser3 ③安装pytesseract:pip install p ...
- python识别图像中的物体_OpenCV+Python 指定物体识别
本文介绍一种基于HoG+Pyramids+Sliding Windows+SVM的物体识别方法 基本流程 (1)确定最小检测物体,对原图img缩放,缩放比例为(滑动窗大小/最小物体大小). (2)缩放 ...
- python识别图像中绿色的部分_[OpenCV-Python] OpenCV 中的图像处理 部分 IV (四)
部分 IV OpenCV 中的图像处理 21 OpenCV 中的轮廓 21.1 初识轮廓 目标 • 理解什么是轮廓 • 学习找轮廓,绘制轮廓等 • 函数:cv2.findContours(),cv2. ...
- [译] 用于 iOS 的 ML Kit 教程:识别图像中的文字
原文地址:ML Kit Tutorial for iOS: Recognizing Text in Images 原文作者:By David East 译文出自:掘金翻译计划 本文永久链接:githu ...
最新文章
- 使用verdaccio 搭建npm私有仓库
- 有序回归(ordinal regression)
- 细节定成败!汕头网络推广提醒你在做网站内容收录时需注意什么?
- python爬虫项目实例-Python爬虫实例项目
- WinPhone 开发(1)-----在 XAML 页面之间浏览和数据的传递、保留以及恢复
- NLP:Transformer的架构详解之详细攻略(持续更新)
- 序列标注问题中将分类标签引入RNN网络结构的尝试
- 这十个好习惯助你摆脱消极的态度
- linux 启动端口失败,linux – 应用程序’appname’在开放移动节点应用程序启动失败(端口8080不可用)...
- 2013页面验证框架来袭。基于独创的vvc思想。还不知道的童鞋赶快围观吧!
- ajax 最大链接数_[LeetCode] 479. 最大回文数乘积
- python中easygui有几种_Python 模块EasyGui详细介绍
- AcWing 840. 模拟散列表(散列hash)
- 如何注册苹果开发者账号
- realme v11密码解锁_真我V11忘记密码怎么刷机删除跳过激活账号使用
- CRM系统创建营销活动
- 金融贷超、贷款行业防止撸贷方案分析
- IPv6地址的无状态自动配置
- [笔记]阿里云物联网之业务服务端(java、php)接入阿里云平台
- 使用 HTML、CSS 和 JavaScript 的简单模拟时钟