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

电子书网站模板wordpress注册会员插件

电子书网站模板,wordpress注册会员插件,wordpress给图片加logo,wordpress搜索不能用项目背景介绍 铁路货运企业需要对物流单进行长期存档#xff0c;以便后续查询和审计。不同的物流单可能包含不同的关键信息#xff0c;通过自定义指定多个区域进行识别重命名#xff0c;可以使存档的图片文件名具有统一的规范和明确的含义。比如#xff0c;将包含货物运单…项目背景介绍 铁路货运企业需要对物流单进行长期存档以便后续查询和审计。不同的物流单可能包含不同的关键信息通过自定义指定多个区域进行识别重命名可以使存档的图片文件名具有统一的规范和明确的含义。比如将包含货物运单车种车号、批次号等重要信息的区域进行识别并将这些信息融入文件名中。这样在需要查找某一份特定的物流单时只需通过文件名即可快速定位大大提高了存档管理的效率和准确性。 以下是一个基于 WPF 和飞桨 OCR 深度学习模型实现批量图片自定义指定多个区域识别重命名的解决方案包含详细步骤和完整代码。 详细步骤 1. 环境准备 安装 Visual Studio用于开发 WPF 应用程序。安装 Python 和飞桨 OCR飞桨 OCR 是基于 Python 的需要安装 Python 环境建议 Python 3.7 及以上并安装飞桨 OCR 库。可以使用以下命令安装 bash pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple pip install paddleocr -i https://mirror.baidu.com/pypi/simple2. 创建 WPF 项目 打开 Visual Studio创建一个新的 WPF 应用程序项目。 3. 设计 WPF 界面 在MainWindow.xaml文件中设计界面包含选择图片文件夹按钮、选择保存文件夹按钮、指定识别区域的输入框、开始处理按钮等。 4. 实现图片处理逻辑 使用ProcessStartInfo调用 Python 脚本将图片路径和识别区域信息传递给 Python 脚本。Python 脚本使用飞桨 OCR 对指定区域进行识别并返回识别结果。根据识别结果对图片进行重命名。 完整代码 MainWindow.xaml xml Window x:ClassImageOCRRenamer.MainWindowxmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlTitle批量图片自定义指定多个区域识别重命名 Height450 Width800GridButton Content选择图片文件夹 HorizontalAlignmentLeft Margin20,20,0,0 VerticalAlignmentTop Width150 ClickSelectImageFolder_Click/TextBox x:NameImageFolderTextBox HorizontalAlignmentLeft Height23 Margin180,20,0,0 TextWrappingWrap VerticalAlignmentTop Width580 IsReadOnlyTrue/Button Content选择保存文件夹 HorizontalAlignmentLeft Margin20,60,0,0 VerticalAlignmentTop Width150 ClickSelectSaveFolder_Click/TextBox x:NameSaveFolderTextBox HorizontalAlignmentLeft Height23 Margin180,60,0,0 TextWrappingWrap VerticalAlignmentTop Width580 IsReadOnlyTrue/Label Content指定识别区域格式x1,y1,x2,y2;x3,y3,x4,y4;... HorizontalAlignmentLeft Margin20,100,0,0 VerticalAlignmentTop/TextBox x:NameRegionTextBox HorizontalAlignmentLeft Height23 Margin20,130,0,0 TextWrappingWrap VerticalAlignmentTop Width740/Button Content开始处理 HorizontalAlignmentLeft Margin350,200,0,0 VerticalAlignmentTop Width100 ClickStartProcessing_Click//Grid /WindowMainWindow.xaml.cs csharp using System; using System.Diagnostics; using System.IO; using System.Windows; using Microsoft.Win32;namespace ImageOCRRenamer {public partial class MainWindow : Window{private string imageFolder;private string saveFolder;public MainWindow(){InitializeComponent();}private void SelectImageFolder_Click(object sender, RoutedEventArgs e){var dialog new OpenFileDialog();dialog.Multiselect false;dialog.CheckFileExists false;dialog.CheckPathExists true;dialog.FileName Select Folder;dialog.Filter All files (*.*)|*.*;if (dialog.ShowDialog() true){imageFolder Path.GetDirectoryName(dialog.FileName);ImageFolderTextBox.Text imageFolder;}}private void SelectSaveFolder_Click(object sender, RoutedEventArgs e){var dialog new OpenFileDialog();dialog.Multiselect false;dialog.CheckFileExists false;dialog.CheckPathExists true;dialog.FileName Select Folder;dialog.Filter All files (*.*)|*.*;if (dialog.ShowDialog() true){saveFolder Path.GetDirectoryName(dialog.FileName);SaveFolderTextBox.Text saveFolder;}}private void StartProcessing_Click(object sender, RoutedEventArgs e){if (string.IsNullOrEmpty(imageFolder) || string.IsNullOrEmpty(saveFolder) || string.IsNullOrEmpty(RegionTextBox.Text)){MessageBox.Show(请选择图片文件夹、保存文件夹并指定识别区域。);return;}string regions RegionTextBox.Text;foreach (string file in Directory.GetFiles(imageFolder, *.jpg;*.png;*.jpeg, SearchOption.AllDirectories)){string result RunPythonScript(file, regions);if (!string.IsNullOrEmpty(result)){string newFileName ${result}{Path.GetExtension(file)};string newFilePath Path.Combine(saveFolder, newFileName);File.Copy(file, newFilePath, true);}}MessageBox.Show(处理完成。);}private string RunPythonScript(string imagePath, string regions){string pythonScriptPath path_to_your_python_script.py; // 替换为实际的Python脚本路径string pythonPath C:\Python39\python.exe; // 替换为实际的Python解释器路径ProcessStartInfo start new ProcessStartInfo();start.FileName pythonPath;start.Arguments $\{pythonScriptPath}\ \{imagePath}\ \{regions}\;start.UseShellExecute false;start.CreateNoWindow true;start.RedirectStandardOutput true;start.RedirectStandardError true;using (Process process Process.Start(start)){using (StreamReader reader process.StandardOutput){string result reader.ReadToEnd();string error process.StandardError.ReadToEnd();if (!string.IsNullOrEmpty(error)){MessageBox.Show($Python脚本执行出错{error});}return result.Trim();}}}} }Python 脚本path_to_your_python_script.py python import sys from paddleocr import PaddleOCRdef main():image_path sys.argv[1]regions sys.argv[2].split(;)ocr PaddleOCR(use_angle_clsTrue, langch)result_text for region in regions:x1, y1, x2, y2 map(int, region.split(,))cropped_image Image.open(image_path).crop((x1, y1, x2, y2))result ocr.ocr(cropped_image, clsTrue)for line in result[0]:result_text line[1][0]print(result_text)if __name__ __main__:main()代码解释 WPF 界面提供选择图片文件夹、保存文件夹、指定识别区域和开始处理的功能。C# 代码处理用户界面交互调用 Python 脚本进行 OCR 识别并根据识别结果对图片进行重命名和保存。Python 脚本使用飞桨 OCR 对指定区域进行识别并返回识别结果。 注意事项 请将pythonScriptPath和pythonPath替换为实际的 Python 脚本路径和 Python 解释器路径。确保 Python 环境和飞桨 OCR 库已正确安装。识别区域的格式为x1,y1,x2,y2;x3,y3,x4,y4;...其中(x1, y1)和(x2, y2)分别为矩形区域的左上角和右下角坐标。
http://www.hkea.cn/news/14485158/

相关文章:

  • 网站收银系统建设做软装找产品上哪个网站
  • 郑州专业网站制作费用报价保定高碑店网站建设
  • 网站开发需要数据库技术在家开网店怎么开
  • 在QQ上做cpa网站说是恶意的小程序appid格式
  • 建站平台上建设的网站可以融资吗岚山网站建设公司
  • 面试问你如何快速优化网站网站上传到空间
  • 自己的网站打不开百度seo快速见效方法
  • 张家港网站建设培训官网查询在哪里查
  • 门户网站部署方案淮南网络宾馆
  • 关于网站开发网页上传和网站发布网页制作官方网站
  • 企业seo网站推广seo规范培训
  • 免费手机h5模板网站模板长春网站制作教程
  • 石家庄手机模板建站建e室内设计网 周婷
  • 网站做优化得话从哪里优化做外国网站百度搜到
  • 无锡装饰网站建设排名做旅游的网站的要素
  • 北京网站设计制作关键词优化单页网站排名没有
  • 小企业网站建设查询凡科建设的网站如何
  • 大连城市建设网站上海注册公司流程及费用
  • 网站维护一般都是维护什么网站的类型有哪些
  • 西安有哪些网站建设外包公司机构ui设计培训
  • 建设银行网站登陆不了网站内部资源推广方法
  • 北京市教学名师奖建设项目网站建设哪里看额度
  • 郑州企业建站设计2021年11月最新新闻热点事件
  • PHP套模板做网站焦作住房和城乡建设厅网站
  • 怎么免费建商城网站吗淄博网站建设 熊掌号
  • 装修网站官网地区汽车修理网站建设
  • 做网站竞价怎么找客户阿里巴巴网站推广方式
  • 大连建设厅网站门户网站建设存在的问题和差距
  • 厦门专业网站建设建站购物网站app推广方案
  • 做流量网站吗南昌seo站外优化