IronOCR 如何使用 閱讀車牌 如何使用 IronOCR 在 C# 中讀取車牌 Curtis Chau 更新:6月 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 架構上運作。 @@--括號關閉--@@ 牌照 !車牌 程式碼 :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 上針對讀取車牌進行最佳化? IronOCR 在 x64 架構上執行時,已針對在 .NET Framework 上讀取車牌進行最佳化,可確保高效率的處理與辨識效能。 Curtis Chau 立即與工程團隊聊天 技術作家 Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。除了開發之外,Curtis 對物聯網 (IoT) 有著濃厚的興趣,探索將硬體和軟體結合的創新方式。在閒暇時間,他喜愛遊戲並構建 Discord 機器人,結合科技與創意的樂趣。 準備好開始了嗎? Nuget 下載 5,167,857 | Version: 2025.11 剛發表 免費下載 NuGet 下載總數:5,167,857 檢視授權