IronOCRでC#のナンバープレートを読む方法
IronOCRのReadLicensePlateメソッドは、高度なOCR技術を使用して車両画像からナンバープレート番号を自動的に抽出します。 この単一のメソッド呼び出しは、ナンバープレートを高精度で処理し、自動車両管理システムのためにプレートテキストと信頼度スコアの両方を返すことができます。
大量の車両画像を管理する場合、ナンバープレートを手動で読み取るのは時間がかかり、人為的エラーが発生しやすくなります。 IronOCR のようなツールを使用してこのプロセスを自動化すると、より効率的で正確なソリューションが得られます。 IronOCRのReadLicensePlateメソッドは、画像からナンバープレート番号をプログラムによって抽出することができ、データの正確性を向上させつつ大幅な時間を節約します。
このガイドでは、IronOCRを使用したナンバープレート認識の方法を例とカスタマイズ可能な設定を通じて説明し、プロセスをスムーズにする手法を紹介します。 これらの方法を活用することで、開発者はナンバープレートの読み取りを自動化し、駐車場管理、通行料徴収、セキュリティ監視などのタスクをより効率的に行うことができます。
この機能を使用するには、IronOcr.Extensions.AdvancedScanパッケージをインストールする必要があります。
IronOCRのReadLicensePlateを使用することで、単一のメソッドコールで任意の画像からプログラムによってナンバープレートのテキストを抽出できます。 すぐに使用可能です - 画像を読み込み、メソッドを呼び出して、プレート番号と信頼度を即座に取得します。
-
1IronOCR を NuGet Package Manager でインストールします
-
2このコード スニペットをコピーして実行します。
var input = new OcrInput(); input.LoadImage("plate.jpg"); OcrLicensePlateResult result = new IronTesseract().ReadLicensePlate(input);Dim input = New OcrInput() input.LoadImage("plate.jpg") Dim result As OcrLicensePlateResult = New IronTesseract().ReadLicensePlate(input)Dim input = New OcrInput() input.LoadImage("plate.jpg") Dim result As OcrLicensePlateResult = New IronTesseract().ReadLicensePlate(input) -
3実際の環境でテストするためにデプロイする
今日からご自身のプロジェクトでIronOCRを使い始めるには、無料トライアルをお試しください。
最小限のワークフロー(5ステップ)
- ナンバープレートを読むためのC#ライブラリをダウンロード
- 処理のためにナンバープレート画像をインポート
- 文書にはヘッダーやフッターなしにナンバープレート画像のみが含まれていることを確認
ReadLicensePlateメソッドを使用して画像からデータを抽出します- OcrLicensePlateResultプロパティにアクセスして、抽出されたライセンス データを表示および操作します。
ナンバープレートをC#でどのように読み取りますか?
IronOCRでナンバープレートを読むには、以下のステップを適用します:
- 入力には、
OcrInputをパラメーターとして取るReadLicensePlateメソッドを使用します。 このメソッドは、ライブラリの標準的なReadよりもナンバープレートに対して最適化されています。 - オプションとして、IronOCRがナンバープレート中に存在しうる特定の文字をホワイトリストに登録し、ナンバープレート番号の処理を高速化するように設定することができます。
入力ナンバープレートはどのように見えますか?

ナンバープレート用のOCRをどのように設定しますか?
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);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)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)どのような結果を期待できますか?

このコードは OcrInput として画像をインポートし、ReadLicensePlate メソッドを使ってナンバープレートからテキストを抽出する方法を示しています。 出力には、入力画像に表示されているナンバープレートに一致する抽出されたテキストと、OCR の精度を示す信頼度レベルが表示されます。
テキスト: OCR入力から抽出されたテキスト。
信頼度: 各文字の統計的な正確性の信頼度を示すdoubleプロパティで、1が最高で0が最低です。
OCRプロセスをより正確に制御するためには、文字認識設定を微調整するための高度な設定オプションを探ってください。
車の画像からナンバープレートをどのように抽出しますか?
この方法は、ナンバープレートの付いた車が写っている画像にも有効です。 コードは上のものと同じですが、入力画像が変更されています。 画像内でナンバープレートが配置されている領域のピクセル座標を抽出することもできます。
どのような種類の車の画像が最適ですか?

最適な結果を得るためには、車の画像に以下のような特徴があることを確認してください:
- ナンバープレートの明確な視認性
- 良好な照明条件(まぶしさや影を避けること)
- 最小限の角度の歪み
- 十分な解像度(低解像度の画像にはDPI設定を調整することを考慮してください)
ナンバープレートの位置情報をどのように取得しますか?
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);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)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)結果に含まれる情報は何ですか?

この例は、ReadLicensePlateメソッドを車の画像に適用する方法を示しています。 このメソッドは、画像内でナンバープレートが配置されている場所の長方形座標も返します。
この方法は、単一のナンバープレートのみを見つけるために最適化されており、ストック画像内で検索することができます。
複数のナンバープレートをどのように処理しますか?
複数の車両画像を扱う場合、バッチ処理を使用すると効率的に処理できます:
using IronOcr;
using System.IO;
using System.Threading.Tasks;
public async Task ProcessMultipleLicensePlates(string[] imagePaths)
{
var ocr = new IronTesseract();
// Configure for optimal performance
ocr.Configuration.WhiteListCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
ocr.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.SingleBlock;
var tasks = imagePaths.Select(async path =>
{
using var input = new OcrInput();
input.LoadImage(path);
var result = await Task.Run(() => ocr.ReadLicensePlate(input));
return new {
FilePath = path,
PlateNumber = result.Text,
Confidence = result.Confidence
};
});
var results = await Task.WhenAll(tasks);
// Process results
foreach (var result in results)
{
Console.WriteLine($"File: {result.FilePath}");
Console.WriteLine($"Plate: {result.PlateNumber} (Confidence: {result.Confidence:P})");
}
}using IronOcr;
using System.IO;
using System.Threading.Tasks;
public async Task ProcessMultipleLicensePlates(string[] imagePaths)
{
var ocr = new IronTesseract();
// Configure for optimal performance
ocr.Configuration.WhiteListCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
ocr.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.SingleBlock;
var tasks = imagePaths.Select(async path =>
{
using var input = new OcrInput();
input.LoadImage(path);
var result = await Task.Run(() => ocr.ReadLicensePlate(input));
return new {
FilePath = path,
PlateNumber = result.Text,
Confidence = result.Confidence
};
});
var results = await Task.WhenAll(tasks);
// Process results
foreach (var result in results)
{
Console.WriteLine($"File: {result.FilePath}");
Console.WriteLine($"Plate: {result.PlateNumber} (Confidence: {result.Confidence:P})");
}
}Imports IronOcr
Imports System.IO
Imports System.Threading.Tasks
Public Async Function ProcessMultipleLicensePlates(imagePaths As String()) As Task
Dim ocr = New IronTesseract()
' Configure for optimal performance
ocr.Configuration.WhiteListCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
ocr.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.SingleBlock
Dim tasks = imagePaths.Select(Async Function(path)
Using input = New OcrInput()
input.LoadImage(path)
Dim result = Await Task.Run(Function() ocr.ReadLicensePlate(input))
Return New With {
Key .FilePath = path,
Key .PlateNumber = result.Text,
Key .Confidence = result.Confidence
}
End Using
End Function)
Dim results = Await Task.WhenAll(tasks)
' Process results
For Each result In results
Console.WriteLine($"File: {result.FilePath}")
Console.WriteLine($"Plate: {result.PlateNumber} (Confidence: {result.Confidence:P})")
Next
End FunctionImports IronOcr
Imports System.IO
Imports System.Threading.Tasks
Public Async Function ProcessMultipleLicensePlates(imagePaths As String()) As Task
Dim ocr = New IronTesseract()
' Configure for optimal performance
ocr.Configuration.WhiteListCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
ocr.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.SingleBlock
Dim tasks = imagePaths.Select(Async Function(path)
Using input = New OcrInput()
input.LoadImage(path)
Dim result = Await Task.Run(Function() ocr.ReadLicensePlate(input))
Return New With {
Key .FilePath = path,
Key .PlateNumber = result.Text,
Key .Confidence = result.Confidence
}
End Using
End Function)
Dim results = Await Task.WhenAll(tasks)
' Process results
For Each result In results
Console.WriteLine($"File: {result.FilePath}")
Console.WriteLine($"Plate: {result.PlateNumber} (Confidence: {result.Confidence:P})")
Next
End Function大規模な処理を行う場合は、パフォーマンスを最大化するためにマルチスレッド機能を実装することを検討してください。
ナンバープレート認識の精度をどのように向上させますか?
ナンバープレート検出の精度を高めるには、以下の最適化テクニックを検討してください:
画像前処理フィルターを適用
using IronOcr;
var ocr = new IronTesseract();
using var input = new OcrInput();
// Load and preprocess the image
input.LoadImage("blurry_plate.jpg");
input.Deskew(); // Correct image rotation
input.DeNoise(); // Remove background noise
input.EnhanceResolution(225); // Upscale for better clarity
input.Sharpen(); // Enhance edge definition
var result = ocr.ReadLicensePlate(input);using IronOcr;
var ocr = new IronTesseract();
using var input = new OcrInput();
// Load and preprocess the image
input.LoadImage("blurry_plate.jpg");
input.Deskew(); // Correct image rotation
input.DeNoise(); // Remove background noise
input.EnhanceResolution(225); // Upscale for better clarity
input.Sharpen(); // Enhance edge definition
var result = ocr.ReadLicensePlate(input);Imports IronOcr
Dim ocr As New IronTesseract()
Using input As New OcrInput()
' Load and preprocess the image
input.LoadImage("blurry_plate.jpg")
input.Deskew() ' Correct image rotation
input.DeNoise() ' Remove background noise
input.EnhanceResolution(225) ' Upscale for better clarity
input.Sharpen() ' Enhance edge definition
Dim result = ocr.ReadLicensePlate(input)
End UsingImports IronOcr
Dim ocr As New IronTesseract()
Using input As New OcrInput()
' Load and preprocess the image
input.LoadImage("blurry_plate.jpg")
input.Deskew() ' Correct image rotation
input.DeNoise() ' Remove background noise
input.EnhanceResolution(225) ' Upscale for better clarity
input.Sharpen() ' Enhance edge definition
Dim result = ocr.ReadLicensePlate(input)
End Using入力画像を最適化するための画像フィルターおよび画像補正技術についてさらに知ってください。
異なる照明条件に対処する
困難な照明シナリオについては、適切な補正を適用します:
using IronOcr;
var ocr = new IronTesseract();
using var input = new OcrInput();
input.LoadImage("dark_plate.jpg");
input.Contrast(1.5f); // Increase contrast
input.Binarize(); // Convert to black and white for clarity
var result = ocr.ReadLicensePlate(input);using IronOcr;
var ocr = new IronTesseract();
using var input = new OcrInput();
input.LoadImage("dark_plate.jpg");
input.Contrast(1.5f); // Increase contrast
input.Binarize(); // Convert to black and white for clarity
var result = ocr.ReadLicensePlate(input);Imports IronOcr
Dim ocr As New IronTesseract()
Using input As New OcrInput()
input.LoadImage("dark_plate.jpg")
input.Contrast(1.5F) ' Increase contrast
input.Binarize() ' Convert to black and white for clarity
Dim result = ocr.ReadLicensePlate(input)
End UsingImports IronOcr
Dim ocr As New IronTesseract()
Using input As New OcrInput()
input.LoadImage("dark_plate.jpg")
input.Contrast(1.5F) ' Increase contrast
input.Binarize() ' Convert to black and white for clarity
Dim result = ocr.ReadLicensePlate(input)
End UsingOCRのパフォーマンスをどのように監視しますか?
大量のナンバープレートを処理する場合、進捗状況を追跡することで、システムリソースの管理に役立ちます:
using IronOcr;
var ocr = new IronTesseract();
// Subscribe to progress events
ocr.OcrProgress += (sender, e) =>
{
Console.WriteLine($"Processing: {e.ProgressPercent}% complete");
};
using var input = new OcrInput();
input.LoadImage("large_parking_lot.jpg");
var result = ocr.ReadLicensePlate(input);using IronOcr;
var ocr = new IronTesseract();
// Subscribe to progress events
ocr.OcrProgress += (sender, e) =>
{
Console.WriteLine($"Processing: {e.ProgressPercent}% complete");
};
using var input = new OcrInput();
input.LoadImage("large_parking_lot.jpg");
var result = ocr.ReadLicensePlate(input);Imports IronOcr
Dim ocr As New IronTesseract()
' Subscribe to progress events
AddHandler ocr.OcrProgress, Sub(sender, e)
Console.WriteLine($"Processing: {e.ProgressPercent}% complete")
End Sub
Using input As New OcrInput()
input.LoadImage("large_parking_lot.jpg")
Dim result = ocr.ReadLicensePlate(input)
End UsingImports IronOcr
Dim ocr As New IronTesseract()
' Subscribe to progress events
AddHandler ocr.OcrProgress, Sub(sender, e)
Console.WriteLine($"Processing: {e.ProgressPercent}% complete")
End Sub
Using input As New OcrInput()
input.LoadImage("large_parking_lot.jpg")
Dim result = ocr.ReadLicensePlate(input)
End Using詳細なパフォーマンスのモニタリングには、IronOCRの進捗追跡機能を探ってください。
これを他のドキュメントリーディングとどのように比較しますか?
IronOCRの専門的な文書読み取り能力は、ナンバープレートだけにとどまりません。 ナンバープレート検出を可能にする同じコンピュータビジョン技術は、以下に適用可能です。
- 旅行と身分証明確認のためのパスポート読み取り
- 銀行アプリケーションのためのMICRチェック処理
- デジタル化プロジェクトのための一般文書スキャン
一般的な使用ケースは何ですか?
IronOCRによるナンバープレート認識は様々なアプリケーションを可能にします:
- 駐車管理: 入退場のログ記録と支払い処理の自動化
- 料金収受: 料金所での車両識別のスピードアップ
- セキュリティ監視: 制限区域での車両移動の追跡
- フリート管理: 会社の車両と物流を監視
- 法執行: 興味のある車両を素早く特定
IronOCRは高精度でリアルタイムに画像を処理できるため、バッチ処理にもライブアプリケーションにも適しています。
よくある質問
C#で車のナンバープレートを読み取るにはどうすればいいですか?
IronOCRのReadLicensePlateメソッドを利用することで、C#を使ってナンバープレートを読み取ることができます。このメソッドは高度なOCR技術で車の画像を処理し、プレートテキストと信頼度スコアの両方を提供します。
ナンバープレート認識にIronOCRを使用するために必要なものは何ですか?
ナンバープレート認識にIronOCRを使用するには、IronOCRライブラリとそのIronOcr.Extensions.AdvancedScanパッケージをインストールし、ReadLicensePlateメソッドを使用して画像からナンバープレート番号を抽出します。
ナンバープレート認識にIronOCRを使用する利点は何ですか?
IronOCRをナンバープレート認識に使用することは効率的で正確であり、手作業の処理に比べて時間を節約します。テキスト抽出の高精度により、駐車場管理や料金徴収などのタスクを自動化します。
より良いナンバープレート認識のためにIronOCRを最適化するにはどうすればいいですか?
IronOCRを最適化するには、典型的なナンバープレートの文字に合った文字ホワイトリストを設定し、Deskew、DeNoise、およびEnhanceResolutionのような画像前処理フィルタを利用して入力画像の品質を改善します。
IronOCRはナンバープレート認識でどの言語をサポートしていますか?
IronOCRのナンバープレート認識は現在、英語、中国語、日本語、韓国語、およびラテンアルファベットをサポートしています。
IronOCRはバッチ処理で複数のナンバープレート画像を処理できますか?
はい、IronOCRはReadLicensePlateメソッドを最適なパフォーマンスに設定することで、バッチ処理において複数の車両画像を非同期に処理することができます。
IronOCRを使用してナンバープレートの位置座標を取得するにはどうすればいいですか?
IronOCRを使用して、OcrLicensePlateResultのLicenseplateプロパティにアクセスすることで、画像内のプレート領域のピクセル座標と寸法を提供するナンバープレートの位置座標を取得できます。
IronOCRを使用したナンバープレート認識の一般的な使用例は何ですか?
一般的な使用例には、駐車場管理、料金徴収、セキュリティ監視、車両管理、および法執行が含まれます。これらはすべて、IronOCRの高精度とリアルタイム処理能力の恩恵を受けています。
どのようなタイプの画像がIronOCRにとって最良の結果をもたらしますか?
ナンバープレートがはっきりと見える画像、良好な照明条件、角度の歪みが最小限で、十分な解像度がある画像が、IronOCRを使用したナンバープレート認識において最良の結果をもたらします。
ナンバープレート認識中にIronOCRのパフォーマンスを監視するにはどうすればいいですか?
IronOCRのOcrProgressイベントを購読することで、大規模なナンバープレート画像のバッチ処理中にリアルタイムの進捗情報を提供し、パフォーマンスを監視することができます。
Curtis Chauは、カールトン大学でコンピュータサイエンスの学士号を取得し、Node.js、TypeScript、JavaScript、およびReactに精通したフロントエンド開発を専門としています。直感的で美しいユーザーインターフェースを作成することに情熱を持ち、Curtisは現代のフレームワークを用いた開発や、構造の良い視覚的に魅力的なマニュアルの作成を楽しんでいます。