IronOCR 操作指南 读取车牌 如何使用 IronOCR 在 C# 中读取车牌 Curtis Chau 已更新:六月 9, 2025 下载 IronOCR NuGet 下载 DLL 下载 Windows 安装程序 免费试用 法学硕士副本 法学硕士副本 将页面复制为 Markdown 格式,用于 LLMs 在 ChatGPT 中打开 向 ChatGPT 咨询此页面 在双子座打开 向 Gemini 询问此页面 在双子座打开 向 Gemini 询问此页面 打开困惑 向 Perplexity 询问有关此页面的信息 分享 在 Facebook 上分享 分享到 X(Twitter) 在 LinkedIn 上分享 复制链接 电子邮件文章 This article was translated from English: Does it need improvement? Translated View the article in English 在管理大量车辆图像时,手动读取车牌既费时又容易出错。 使用 IronOCR 等工具实现此过程的自动化,可以提供更高效、更准确的解决方案。 IronOCR 的ReadLicensePlate方法可以通过编程方式从图像中提取车牌号码,从而节省大量时间并提高数据准确性。 在本指南中,我们将演示如何使用 IronOCR 进行车牌识别,通过示例和可自定义的配置,使整个过程无缝衔接。 通过利用这些方法,开发人员可以自动读取车牌号码,从而提高停车管理、收费或安全监控等任务的效率。 要使用此功能,您还必须安装IronOcr.Extension.AdvancedScan软件包。 快速入门:立即提取车牌号码 只需调用 IronOCR 的ReadLicensePlate方法,即可通过编程方式从任何图像中提取车牌文本。 它已准备就绪——只需加载图像,调用该方法,即可立即获取车牌号码和置信度。 立即开始使用 NuGet 创建 PDF 文件: 使用 NuGet 包管理器安装 IronOCR PM > Install-Package IronOcr 复制并运行这段代码。 OcrLicensePlateResult result = new IronTesseract().ReadLicensePlate(new OcrInput("plate.jpg")); 部署到您的生产环境中进行测试 立即开始在您的项目中使用 IronOCR,免费试用! 免费试用30天 最小工作流程(5 个步骤) 下载用于读取车牌的 C# 库 导入车牌图像进行处理 确保文档仅包含车牌图像,且没有头部或尾部 使用ReadLicensePlate方法从图像中提取数据 访问OcrLicensePlateResult属性以查看和操作提取的许可证数据 读取车牌示例 要在 IronOCR 中读取车牌,我们需要执行以下步骤: 我们使用ReadLicensePlate方法,该方法接受OcrInput作为输入参数。 与库的标准Read方法相比,该方法对车牌的识别更加精确。 (可选)我们可以配置 IronOCR,使其仅允许车牌中存在的特定字符作为白名单,以加快车牌号码的处理速度。 [{i:( 目前该方法仅适用于英文、中文、日文、韩文和拉丁字母文字。 在 .NET Framework 上使用高级扫描功能需要项目在 x64 架构上运行。 @@--bracket-close--@@@ 车牌 !车牌 代码 :path=/static-assets/ocr/content-code-examples/how-to/read-license-plate-read-license-plate.cs using IronOcr; using System; var ocr = new IronTesseract(); ocr.Configuration.WhiteListCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_"; using var inputLicensePlate = new OcrInput(); inputLicensePlate.LoadImage("plate.jpeg"); // Read license plate OcrLicensePlateResult result = ocr.ReadLicensePlate(inputLicensePlate); // Retrieve license plate number and confidence value string output = $"{result.Text}\nResult Confidence: {result.Confidence}"; Console.WriteLine(output); Imports Microsoft.VisualBasic Imports IronOcr Imports System Private ocr = New IronTesseract() ocr.Configuration.WhiteListCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_" Dim inputLicensePlate = New OcrInput() inputLicensePlate.LoadImage("plate.jpeg") ' Read license plate Dim result As OcrLicensePlateResult = ocr.ReadLicensePlate(inputLicensePlate) ' Retrieve license plate number and confidence value Dim output As String = $"{result.Text}" & vbLf & "Result Confidence: {result.Confidence}" Console.WriteLine(output) $vbLabelText $csharpLabel 输出 该代码演示了如何将图像作为OcrInput导入,并将其与ReadLicensePlate方法一起使用,以从车牌中提取文本。 输出结果显示了与输入图像中显示的车牌匹配的提取文本,以及指示 OCR 准确性的置信度。 文本:从 OCR 输入中提取的文本。 置信度:一个"双精度"属性,表示每个字符平均值的统计准确性置信度,1 为最高,0 为最低。 从汽车图片中识别车牌 该方法对于包含车牌的汽车图像也同样有效。 这段代码与上面的代码完全相同,只是输入图像发生了变化。 您还可以提取车牌所在区域的像素坐标。 示例输入 !车牌 :path=/static-assets/ocr/content-code-examples/how-to/read-license-plate-read-from-car.cs using IronOcr; using IronSoftware.Drawing; using System; var ocr = new IronTesseract(); using var inputLicensePlate = new OcrInput(); inputLicensePlate.LoadImage("car_license.jpg"); // Read license plate OcrLicensePlateResult result = ocr.ReadLicensePlate(inputLicensePlate); // Retrieve license plate coordinates RectangleF rectangle = result.Licenseplate; // Write license plate value and coordinates in a string string output = $"License Plate Number:\n{result.Text}\n\n" + $"License Plate Area_\n" + $"Starting X: {rectangle.X}\n" + $"Starting Y: {rectangle.Y}\n" + $"Width: {rectangle.Width}\n" + $"Height: {rectangle.Height}"; Console.WriteLine(output); Imports Microsoft.VisualBasic Imports IronOcr Imports IronSoftware.Drawing Imports System Private ocr = New IronTesseract() Private inputLicensePlate = New OcrInput() inputLicensePlate.LoadImage("car_license.jpg") ' Read license plate Dim result As OcrLicensePlateResult = ocr.ReadLicensePlate(inputLicensePlate) ' Retrieve license plate coordinates Dim rectangle As RectangleF = result.Licenseplate ' Write license plate value and coordinates in a string Dim output As String = $"License Plate Number:" & vbLf & "{result.Text}" & vbLf & vbLf & $"License Plate Area_" & vbLf & $"Starting X: {rectangle.X}" & vbLf & $"Starting Y: {rectangle.Y}" & vbLf & $"Width: {rectangle.Width}" & vbLf & $"Height: {rectangle.Height}" Console.WriteLine(output) $vbLabelText $csharpLabel 输出 !车牌号搜索结果 该示例展示了如何将ReadLicensePlate方法应用于汽车图像。 该方法还会返回车牌在图像中所在的矩形坐标。 该方法经过优化,仅用于查找单个车牌,并且能够在图库图片中搜索车牌。 常见问题解答 如何在C#中自动化车牌识别? 您可以使用 IronOCR 的 ReadLicensePlate 方法在 C# 中自动识别车牌。此方法允许您从图像中提取车牌号码,与手动方法相比,提高了效率和准确性。 使用IronOCR读取车牌涉及哪些步骤? 要使用 IronOCR 读取车牌,请下载 C# 库,导入车牌图像作为 OcrInput,并使用 ReadLicensePlate 方法提取数据。然后,您可以访问 OcrLicensePlateResult 属性进行进一步处理。 IronOCR能处理带有可见车牌的汽车图像吗? 是的,IronOCR可以从汽车图像中读取车牌。它还可以提供车牌在图像中位置的像素坐标。 IronOCR支持哪些语言用于车牌阅读? IronOCR 的 ReadLicensePlate 方法支持英文字母、中文、日文、韩文和拉丁字母脚本的车牌读取。 如何通过配置字符白名单增强车牌识别? 通过配置IronOCR以白名单形式列出车牌中常见的特定字符,可以提高识别性能并加快车牌号码的处理。 高级车牌扫描需要哪些附加包? 有关高级扫描功能,您需要安装 IronOcr.Extensions.AdvancedScan 包。 车牌识别中的置信度有什么意义? 车牌识别中的置信度表示OCR过程的统计准确性,范围为0到1,1表示最高置信度。 IronOCR如何针对.NET Framework优化车牌阅读? 在x64架构上运行时,IronOCR针对.NET Framework进行了车牌阅读优化,确保高效的处理和识别性能。 Curtis Chau 立即与工程团队聊天 技术作家 Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。 准备开始了吗? Nuget 下载 5,167,857 | Version: 2025.11 刚刚发布 免费 NuGet 下载 总下载量:5,167,857 查看许可证