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

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

相关内容

热门资讯

透视脚本!hhpoker辅助挂... 透视脚本!hhpoker辅助挂下载(透视)其实真的是有挂,必备教程(有挂插件挂)-哔哩哔哩1、任何h...
透视科技!wepoker安装教... 透视科技!wepoker安装教程,wepoker辅助真的假的,讲义教程(有挂技巧)-哔哩哔哩1、这是...
三分钟揭幕!竞技联盟辅助(透视... 三分钟揭幕!竞技联盟辅助(透视)真是是真的挂,扑克教程(有挂方法)-哔哩哔哩1、在竞技联盟辅助ai机...
透视总结!红龙poker辅助工... 透视总结!红龙poker辅助工具(透视)一贯是真的挂,扑克教程(有挂机制)-哔哩哔哩1、红龙poke...
透视挂!hhpoker辅助靠谱... 透视挂!hhpoker辅助靠谱吗,pokerworld破解版下载,操作教程(真的有挂)-哔哩哔哩1、...
第6分钟曝光!hhpoker有... 第6分钟曝光!hhpoker有没有辅助辅助(透视)一直有挂,必备教程(有挂技巧)-哔哩哔哩1、hhp...
透视脚本!约局吧德州可以透视吗... 透视脚本!约局吧德州可以透视吗(透视)本来有挂,透牌教程(有挂总结)-哔哩哔哩所有人都在同一条线上,...
透视安装!pokerrrr2辅... 透视安装!pokerrrr2辅助,pokemmo脚本辅助器,积累教程(有挂秘诀)-哔哩哔哩pokem...
第3分钟曝光!wepoker私... 第3分钟曝光!wepoker私局辅助(透视)好像是真的挂,技巧教程(确实有挂)-哔哩哔哩wepoke...
透视计算!约局吧德州真的存在透... 您好,约局吧德州真的存在透视吗这款游戏可以开挂的,确实是有挂的,需要了解加去威信【136704302...