当前位置: 首页 > news >正文

诸暨公司制作网站需要哪些/百度点击排名收费软件

诸暨公司制作网站需要哪些,百度点击排名收费软件,wordpress图片下载,公司图标设计大全免费文章目录 一、效果图 二、库安装 三、使用示例 四、完整代码 一、效果图 使用的图片: 返回文字: 二、库安装 pip install easyocr opencv-python numpy 三、使用示例 ocr EasyOCRProcessor() results ocr.extract_text("test.png",&…

文章目录

一、效果图

二、库安装

三、使用示例

四、完整代码


一、效果图

使用的图片:

返回文字:

二、库安装

pip install easyocr opencv-python numpy  

三、使用示例

ocr = EasyOCRProcessor()
results = ocr.extract_text("test.png","output.png",confidence_threshold=0.6
)

四、完整代码

import easyocr
import cv2
import numpy as npclass EasyOCRProcessor:def __init__(self, languages=['ch_sim', 'en']):"""初始化EasyOCR处理器参数:languages: 需要识别的语言列表"""self.reader = easyocr.Reader(languages)def enhance_image(self, image):"""图像增强处理参数:image: OpenCV图像对象返回:处理后的图像"""# 亮度和对比度调整alpha = 1.2  # 对比度beta = 10  # 亮度adjusted = cv2.convertScaleAbs(image, alpha=alpha, beta=beta)# 锐化kernel = np.array([[-1, -1, -1],[-1, 9, -1],[-1, -1, -1]])sharpened = cv2.filter2D(adjusted, -1, kernel)return sharpeneddef extract_text(self, image_path, output_path=None, confidence_threshold=0.5):"""提取图片中的文字参数:image_path: 图片路径output_path: 可选,输出处理后图片的路径confidence_threshold: 置信度阈值返回:提取的文字内容和位置信息"""try:# 读取图片image = cv2.imread(image_path)if image is None:raise ValueError("无法读取图片")# 图像增强enhanced = self.enhance_image(image)# 使用EasyOCR识别文字results = self.reader.readtext(enhanced)# 处理结果text_results = []for bbox, text, confidence in results:if confidence > confidence_threshold:text_results.append({'text': text,'confidence': confidence,'position': bbox})# 在图片上标记文字区域if output_path:points = np.array(bbox, np.int32)cv2.polylines(image, [points], True, (0, 255, 0), 2)cv2.putText(image, f"{text} ({confidence:.2f})",(int(bbox[0][0]), int(bbox[0][1]) - 10),cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)# 保存处理后的图片if output_path:cv2.imwrite(output_path, image)return text_resultsexcept Exception as e:print(f"错误: {str(e)}")return None# 使用示例
ocr = EasyOCRProcessor()
results = ocr.extract_text("test.png","output.png",confidence_threshold=0.6
)# 打印结果
if results:for result in results:print(f"文字: {result['text']}")print(f"置信度: {result['confidence']}")print(f"位置: {result['position']}")print("---")

http://www.whsansanxincailiao.cn/news/31941876.html

相关文章:

  • 网站内做全文搜索/百度权重怎么查询
  • 平台门户网站建设/企业推广哪个平台好
  • 东莞网站排名优化价格/seo专员简历
  • 做母亲节网站的素材/什么是网络营销策划
  • 手机建网站公司/阿里云域名注册官网网址
  • wordpress 任意下载/鼓楼网站seo搜索引擎优化
  • 德州网站建设价格/百度云搜索
  • 自己建设网站怎么做/seo推广任务小结
  • 站长工具seo综合查询权重/珠海百度推广优化排名
  • wordpress建立购物网站/达州seo
  • 家装公司网站建设/页面seo是什么意思
  • 黄石网站建设公司/国际热点事件
  • 山西教育学会网站建设/对搜索引擎优化的认识
  • 网站分析百度/百度关键词挖掘工具爱站网
  • 网站被刷怎么办/百度手机助手官网下载
  • 网页设计与实现论文/外贸seo站
  • 一般的网站是由什么语言做的/宁波seo搜索排名优化
  • 游戏币销售网站建设/网站结构优化
  • 企业如何推广网站/百度搜索排名购买
  • 成都网站建设重庆最加科技/个人建网站的详细步骤
  • 做没用的网站/滕州seo
  • 建国外网站需要多少钱/指数基金什么意思
  • 网站建设 重庆/快速优化关键词排名
  • 网站开发 资质/合肥百度网站排名优化
  • 推荐坪山网站建设/论坛推广工具
  • 淄博网站制作升级优化/企业如何建站
  • 私人做网站收费/如何建立网址
  • 域名备案和网站备案区别/免费的网站域名查询app
  • wordpress 导航函数/优化大师平台
  • 杭州做网站的公司哪家好/学生个人网页设计模板