LOGO OA教程 ERP教程 模切知识交流 PMS教程 CRM教程 开发文档 其他文档  
 
网站管理员

C#WinForm使用PaddleOCRSharp识别图片文字

admin
2025年2月16日 10:1 本文热度 425
PaddleOCRSharp‌是一个基于百度飞桨(PaddlePaddle)封装的.NET版本OCR工具类库,旨在为.NET开发者提供高效且简便的方式来集成OCR功能。PaddleOCRSharp是PaddleOCR的.NET封装库,使得.NET开发者能够方便地在其项目中调用PaddleOCR提供的文本识别功能‌。

一、效果展示
二、VS2022
NuGet安装PaddleOCRSharp
界面设计
后台编码
三、代码
引用
using PaddleOCRSharp;
选择图片
private PaddleOCREngine engine;private void button1_Click(object sender, EventArgs e){	OpenFileDialog ofd = new OpenFileDialog();	ofd.Filter = "*.*|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";	if (ofd.ShowDialog() != DialogResult.OK) return;	this.pictureBox1.Image = Image.FromFile(ofd.FileName);}
识别文字
private void button2_Click(object sender, EventArgs e){	Bitmap imagebyte = new Bitmap(pictureBox1.Image);
OCRModelConfig config = null; //OCR参数 OCRParameter oCRParameter = new OCRParameter(); oCRParameter.cpu_math_library_num_threads = 10;//预测并发线程数 oCRParameter.enable_mkldnn = true;//web部署该值建议设置为0,否则出错,内存如果使用很大,建议该值也设置为0. oCRParameter.cls = false; //是否执行文字方向分类;默认false oCRParameter.det = true;//是否开启方向检测,用于检测识别180旋转 oCRParameter.use_angle_cls = false;//是否开启方向检测,用于检测识别180旋转 oCRParameter.det_db_score_mode = true;//是否使用多段线,即文字区域是用多段线还是用矩形, oCRParameter.max_side_len = 1500; oCRParameter.rec_img_h = 48; oCRParameter.rec_img_w = 320; oCRParameter.det_db_thresh = 0.3f; oCRParameter.det_db_box_thresh = 0.618f;
//初始化OCR引擎 engine = new PaddleOCREngine(config, oCRParameter);
//模型配置,使用默认值 StructureModelConfig structureModelConfig = null; //表格识别参数配置,使用默认值 StructureParameter structureParameter = new StructureParameter(); PaddleStructureEngine structengine = new PaddleStructureEngine(structureModelConfig, structureParameter);
OCRResult ocrResult = engine.DetectText(imagebyte);
richTextBox1.AppendText(ocrResult.Text);}
C#WinForm调用OpenCVSharp图像处理
C#WinForm调用Yolov8Net实现自动识别


阅读原文:原文链接


该文章在 2025/2/17 12:27:31 编辑过
关键字查询
相关文章
正在查询...
点晴ERP是一款针对中小制造业的专业生产管理软件系统,系统成熟度和易用性得到了国内大量中小企业的青睐。
点晴PMS码头管理系统主要针对港口码头集装箱与散货日常运作、调度、堆场、车队、财务费用、相关报表等业务管理,结合码头的业务特点,围绕调度、堆场作业而开发的。集技术的先进性、管理的有效性于一体,是物流码头及其他港口类企业的高效ERP管理信息系统。
点晴WMS仓储管理系统提供了货物产品管理,销售管理,采购管理,仓储管理,仓库管理,保质期管理,货位管理,库位管理,生产管理,WMS管理系统,标签打印,条形码,二维码管理,批号管理软件。
点晴免费OA是一款软件和通用服务都免费,不限功能、不限时间、不限用户的免费OA协同办公管理系统。
Copyright 2010-2025 ClickSun All Rights Reserved