百度飞桨 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、超多福...
来临!有哪些免费的wpk作必弊... 来临!有哪些免费的wpk作必弊码(透视)果然存在有辅助神器(果真有挂)-哔哩哔哩1、完成有哪些免费的...
外挂办法!佛手在线大菠萝智能辅... 外挂办法!佛手在线大菠萝智能辅助器,德州私人局脚本-本来一直都是有辅助脚本(哔哩哔哩)1、佛手在线大...
我来教教你!pokemmo手机... 我来教教你!pokemmo手机版脚本免费,兴义水鱼天下有辅助吗,切实真的有辅助插件(讲解有挂)1、进...
透视辅助!aapoker怎么提... 透视辅助!aapoker怎么提高中牌率(透视)好像是有辅助修改器(有挂方针)-哔哩哔哩运aapoke...
外挂绝活!xpoker辅助怎么... 外挂绝活!xpoker辅助怎么用,哈糖大菠萝挂-好像有辅助教程(哔哩哔哩)运xpoker辅助怎么用辅...
今日百科!wepoker到底有... 今日百科!wepoker到底有没有透视,杭州都莱可以装挂吗,其实有辅助工具(有挂功能);杭州都莱可以...
迎来新发展!hhpoker脚本... 迎来新发展!hhpoker脚本(透视)一直是真的辅助app(有挂总结)-哔哩哔哩该软件可以轻松地帮助...
外挂举措!哈糖大菠萝开挂,po... 外挂举措!哈糖大菠萝开挂,poker红龙辅助-本来有辅助插件(哔哩哔哩)1、许多玩家不知道哈糖大菠萝...
总算了解!fishpoker透... 总算了解!fishpoker透视底牌,广西友乐辅助器,确实有辅助开挂(真的有挂)1、许多玩家不知道f...