当前位置: 首页 > news >正文

西安网站建设易网宣/最新搜索引擎排名

西安网站建设易网宣,最新搜索引擎排名,做移动类网站的书推荐,网站怎样自动文字排版C#本地使用离线ocr库识别图片文本,工具包PaddleOCRSharp PaddleOCRSharp介绍 项目地址:https://github.com/raoyutian/PaddleOCRSharp PaddleOCRSharp 是一个.NET版本OCR可离线使用类库。项目核心组件PaddleOCR.dll目前已经支持C\C、.NET、Python、Go…

C#本地使用离线ocr库识别图片文本,工具包PaddleOCRSharp

PaddleOCRSharp介绍

项目地址:https://github.com/raoyutian/PaddleOCRSharp

PaddleOCRSharp 是一个.NET版本OCR可离线使用类库。项目核心组件PaddleOCR.dll目前已经支持C\C++、.NET、Python、Golang、Rust、java等众多开发语言的直接API接口调用。项目包含文本识别、文本检测、表格识别功能。本项目做了大量优化,提高了识别率和推理性能。包含总模型仅8.6M的超轻量级中文OCR,单模型支持中英文数字组合识别、竖排文本识别、长文本识别。同时支持中英文、纯英文以及多种语言文本检测识别。

PaddleOCRSharp封装极其简化,实际调用仅几行代码,极大的方便了中下游开发者的使用和降低了PaddleOCR的使用入门级别,同时提供不同的.NET框架使用,方便各个行业应用开发与部署。Nuget包即装即用,可以离线部署,不需要网络就可以识别的高精度中英文OCR。

本项目支持官方所有公开的通用OCR模型,如:PPOCRV2、PPOCRV3、PPOCRV4、PP-OCRv4_server、PP-OCRv4_server_doc(1.5万字符字典模型)。最新版默认使用中英文V4模型ch_PP-OCRv4

我的测试使用框架:

.NET9

  • WPF
  • nuget包:PaddleOCRSharp

XAML代码:

<Window x:Class="WpfOCR.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:local="clr-namespace:WpfOCR"mc:Ignorable="d"Title="MainWindow" Height="850" Width="900" FontSize="22" WindowStartupLocation="CenterScreen"><Grid><Grid.RowDefinitions><RowDefinition Height="140"></RowDefinition><RowDefinition Height="*"></RowDefinition></Grid.RowDefinitions><StackPanel Grid.Row="0" Orientation="Vertical" ><TextBlock   Margin="5" TextWrapping="Wrap" Text="选择待识别图片:" VerticalAlignment="Top" HorizontalAlignment="Left" /><TextBox Margin="5" x:Name="imgDetectionPath"  TextWrapping="Wrap" Text="" Width="680" HorizontalAlignment="Left" /><Button Margin="5" Content="识别" Click="Button_Click" Width="96" HorizontalAlignment="Left" VerticalAlignment="Top" /></StackPanel><Grid Grid.Row="1"    ><Grid.RowDefinitions><RowDefinition Height="auto"   ></RowDefinition><RowDefinition Height="*"></RowDefinition></Grid.RowDefinitions><TextBlock  Grid.Row="0" HorizontalAlignment="Left"  TextWrapping="Wrap" Text="识别结果:" VerticalAlignment="Top" /><TextBox Grid.Row="1"       x:Name="txtResult" VerticalScrollBarVisibility="Auto"  HorizontalAlignment="Stretch"    TextWrapping="Wrap" AcceptsReturn="True" Text="" VerticalAlignment="Stretch" /></Grid></Grid>
</Window>

后台代码:

using PaddleOCRSharp;
using System.Drawing;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;namespace WpfOCR;/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{public MainWindow(){InitializeComponent();}//识别private void Button_Click(object sender, RoutedEventArgs e){string imgPath = this.imgDetectionPath.Text;var imagebyte = File.ReadAllBytes(imgPath);Bitmap bitmap = new Bitmap(new MemoryStream(imagebyte));OCRModelConfig config = null;OCRParameter oCRParameter = new OCRParameter();oCRParameter.use_gpu = true;//当使用GPU版本的预测库时,该参数打开才有效果OCRResult ocrResult = null;PaddleOCREngine engine = new PaddleOCREngine(config, oCRParameter);ocrResult = engine.DetectText(bitmap);List<OcrResult>? ocrResults = System.Text.Json.JsonSerializer.Deserialize<List<OcrResult>>(ocrResult.JsonText);StringBuilder stringBuilder = new StringBuilder();string text = string.Join(System.Environment.NewLine, ocrResults.Select(g => g.Text));this.txtResult.Text = text;}public record OcrResult(string Text);}

待识别图片
在这里插入图片描述
识别结果:
在这里插入图片描述

http://www.whsansanxincailiao.cn/news/32018178.html

相关文章:

  • 久久文化传媒有限公司在哪里/seo优化方法有哪些
  • wordpress多站点demo/贵州seo学校
  • 中国建设管理信息网站/广丰网站seo
  • 大连建设工业产品网站/上海做关键词推广企业
  • 互联网网站建设咨询/性价比高的seo网站优化
  • 服装营销型网站建设/企业网站代运营
  • 专业做旅游网站的公司/今日头条热榜
  • 教育网站改造方案/怎么样推广自己的网站
  • 网站域名服务器/如何制作微信小程序店铺
  • hbulider 做网站/googleplay官网
  • 免费空间清理软件/seo排名影响因素主要有
  • 福建漳州网站建设费用/seo包括哪些方面
  • 学做美食看哪个网站/深圳网络营销推广渠道
  • 设计企业网站哪家好/网站推广软件哪个好
  • 梅河口建设局网站/痘痘如何去除效果好
  • 网站建设方案是什么/网站模板哪家好
  • 网站开发什么语言安全/百度软件应用中心
  • 房地产开发公司排名/深度优化
  • 只做同城交易的网站/网络营销策略包括
  • 建wap手机网站/网络推广页面
  • 汕头汽车网站建设/黄页88网推广服务
  • wordpress csshero/网络优化公司
  • 深圳建网站一般多少钱/个人购买链接
  • 学做视频的网站/搜索引擎优化的意思
  • wordpress 小工具 导航/seo项目分析
  • 最少的钱怎么做网站/软文推广的100个范例
  • 摄影协会网站源码/优化大师下载旧版本安装
  • 个人企业邮箱登录入口/优化公司哪家好
  • 东坑镇网站仿做/温州网站建设优化
  • 网站源码本地测试/如何做好网上销售