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

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

相关内容

热门资讯

开挂透视!aapoker万能辅... 开挂透视!aapoker万能辅助器,aapoker透视脚本下载,切实是真的有辅助app(哔哩哔哩)1...
于此同时!约战武汉辅助软件,W... 于此同时!约战武汉辅助软件,WePOker有没有透视方法(透视)总是有辅助攻略(哔哩哔哩)1、操作简...
此事备受玩家关注"a... 此事备受玩家关注"aapoker万能辅助器"大菠萝789辅助器下载(好像是有辅助软件)-哔哩哔哩暗藏...
在玩家背景下!久久互娱科技,广... 在玩家背景下!久久互娱科技,广丰中至510k辅助(切实存在有挂)-哔哩哔哩1、游戏颠覆性的策略玩法,...
教你透视!wepoker有辅助... 教你透视!wepoker有辅助器吗,wepoker透视脚本视频,好像存在有辅助插件(哔哩哔哩)1、完...
长期以来!欢聚水鱼智能辅助,w... 长期以来!欢聚水鱼智能辅助,wpk显示有作必弊(透视)其实存在有辅助插件(哔哩哔哩)长期以来!欢聚水...
近年来"hhpoke... 近年来"hhpoker一直输有挂吗"有没有人wepoker(确实存在有辅助工具)-哔哩哔哩hhpok...
透视透视!德普之星app安卓版... 透视透视!德普之星app安卓版破解版,德普之星透视辅助软件,原来是真的有辅助神器(哔哩哔哩)1、用户...
据了解!大菠萝辅助器,龙岩闲游... 据了解!大菠萝辅助器,龙岩闲游安卓脚本(真是真的是有挂)-哔哩哔哩1、很好的工具软件,可以解锁游戏的...
现有关情况通报如下!余干中至辅... 现有关情况通报如下!余干中至辅助器,we-poker辅助(透视)果然真的是有辅助攻略(哔哩哔哩)1、...