百度飞桨 OCR识别
创始人
2024-11-11 05:10:40
0

百度飞桨 OCR识别代码

import warnings import time import cv2 as cv import paddlehub as hub # Load the image img = cv.imread("1.jpg") height, width, channels = img.shape imglist = [img] ocr = hub.Module(name="ch_pp-ocrv3", enable_mkldnn=True)  # mkldnn acceleration is only effective on CPU start_time = time.time() result = ocr.recognize_text(images=imglist) end_time = time.time() elapsed_time = end_time - start_time print(f"执行时间: {elapsed_time} seconds") for data in result[0]['data']:     text = data['text']     confidence = data['confidence']     if confidence > 0.85:         points = data['text_box_position']         left = min(point[0] for point in points)         top = min(point[1] for point in points)         right = max(point[0] for point in points)         bottom = max(point[1] for point in points)         print(f"Text: {text}, Box: ({left}, {top}), ({right}, {bottom})")         cv.rectangle(img, (left, top), (right, bottom), (0,0, 255), 2)         cv.putText(img, text, (left, top - 10), cv.FONT_HERSHEY_SIMPLEX, 2, (0, 0, 255), 2) resize_img = cv.resize(img, [width // 4, height // 4]) cv.imwrite("result.jpg", resize_img) cv.imshow("Result",resize_img) cv.waitKey(0) cv.destroyAllWindows() print(result)  

显示效果图
在这里插入图片描述

相关内容

热门资讯

透视好友!pokerrrr2辅... 透视好友!pokerrrr2辅助,皇豪互众控制系统(竟然真的是有挂)1、皇豪互众控制系统ai辅助优化...
透视ai!wepoker怎么发... 透视ai!wepoker怎么发冤家牌,广西八一字牌辅助app,普及教程(有挂黑科技)1、让任何用户在...
透视讲解!hhpoker怎么开... 透视讲解!hhpoker怎么开透视,德州透视是真的假的(详细辅助攻略方法);致您一封信;亲爱德州透视...
教学盘点“兴动互娱辅助工具”w... 教学盘点“兴动互娱辅助工具”wepoker轻量版书签(竟然存在有挂);科技安装教程;13670430...
透视黑科技“aapoker有脚... 透视黑科技“aapoker有脚本吗”原来存在有挂(辅助挂)详细辅助AI教程1、让任何用户在无需AI插...
hhpoker怎么开透视!we... hhpoker怎么开透视!we poker游戏下,wpk透视辅助软件(详细辅助攻略教程)是一款可以让...
透视ai代打!pokerwor... 透视ai代打!pokerworld软件,旗圣麻将辅助,2025新版技巧(有挂详情)1、超多福利:超高...
透视苹果版!wepoker透视... 透视苹果版!wepoker透视辅助下载,欢乐游戏城破解版内置修改器(原来真的是有挂)1、该软件可以轻...
透视透视!wepoker辅助下... 透视透视!wepoker辅助下载,wepoker辅助分析器(详细辅助曝光教程)关于wepoker辅助...
重大通报“湘竞技辅助”aapo... 重大通报“湘竞技辅助”aapoker如何设置胜率(一贯真的是有挂);玩家必备必赢加哟《1367043...