百度飞桨 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)  

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

相关内容

热门资讯

外挂方案!竞技联盟破解版最新版... 外挂方案!竞技联盟破解版最新版,德州透视竞技联盟-一贯存在有辅助脚本(哔哩哔哩)1、上手简单,内置详...
透视科技!德扑HHpoker有... 透视科技!德扑HHpoker有挂吗(透视)确实真的是有辅助辅助器(有挂详细)-哔哩哔哩1、实时德扑H...
专业讨论!wpk可以作必弊吗,... 专业讨论!wpk可以作必弊吗,鄱阳翻精怎么开挂,本来有辅助神器(有挂规律)进入游戏-大厅左侧-新手福...
外挂指南书!智星菠萝德州插件最... 外挂指南书!智星菠萝德州插件最新版本更新内容详解,拱趴大菠萝机器人-原来一直总是有辅助工具(哔哩哔哩...
连日来!pokemmo辅助器脚... 连日来!pokemmo辅助器脚本下载(透视)原来是真的辅助软件(有挂透明挂)-哔哩哔哩1、不需要AI...
分享一款!hhpoker作必弊... 分享一款!hhpoker作必弊码,衢州都莱罗松怎么才能赢,一直存在有辅助脚本(存在有挂)1、任何衢州...
截至发稿!uupoker有透视... 截至发稿!uupoker有透视吗(透视)果然存在有辅助平台(发现有挂)-哔哩哔哩1、每一步都需要思考...
外挂演示!德普之星透视辅助软件... 外挂演示!德普之星透视辅助软件激活码,德普之星透视辅助软件激活码-果然一直总是有辅助工具(哔哩哔哩)...
玩家攻略!wepoker安装教... 玩家攻略!wepoker安装教程,决战十三水ios辅助,真是是有辅助下载(有挂解密)1、下载好决战十...
刚刚!wepoker怎么开辅助... 刚刚!wepoker怎么开辅助(透视)好像真的有辅助修改器(有挂规律)-哔哩哔哩;1、首先打开wep...