IronOCR チュートリアル .NET で画像からテキストを読み取る方法 C# OCR Image to Text Tutorial: Convert Images to Text Without Tesseract Jacob Mellor 更新日:2026年1月20日 IronOCR をダウンロード NuGet ダウンロード DLL ダウンロード Windows 版 無料トライアル LLM向けのコピー LLM向けのコピー LLM 用の Markdown としてページをコピーする ChatGPTで開く このページについてChatGPTに質問する ジェミニで開く このページについてGeminiに問い合わせる Grokで開く このページについてGrokに質問する 困惑の中で開く このページについてPerplexityに問い合わせる 共有する Facebook で共有 Xでシェア(Twitter) LinkedIn で共有 URLをコピー 記事をメールで送る This article was translated from English: Does it need improvement? Translated View the article in English 複雑な Tesseract 構成の手間をかけずに、C# で画像をテキストに変換したいとお考えですか? この包括的な IronOCR C# チュートリアルでは、わずか数行のコードで .NET アプリケーションに強力な光学式文字認識を実装する方法を説明します。 クイックスタート: 画像から 1 行でテキストを抽出する この例では、IronOCR を理解するのがいかに簡単かを示しています。たった 1 行の C# で画像がテキストに変換されます。 OCR エンジンを初期化し、複雑な設定なしですぐにテキストを読み取って取得する方法を示します。 IronOCR をNuGetパッケージマネージャでインストール PM > Install-Package IronOcr このコード スニペットをコピーして実行します。 string text = new IronTesseract().Read("image.png").Text; 実際の環境でテストするためにデプロイする 今日プロジェクトで IronOCR を使い始めましょう無料トライアル Free 30 Day Trial ### 最小限のワークフロー(5ステップ) IronOCRをダウンロード - 画像からテキストへの変換用C#OCRライブラリ `IronTesseract`クラスを使用して画像からテキストを即座に読み取ります 画像フィルターを適用して、低品質のスキャンの OCR 精度を高めます ダウンロード可能な言語パックを使用して複数の言語を処理 結果を検索可能なPDFとしてエクスポートするか、テキスト文字列を抽出します .NET アプリケーションで画像からテキストを読み取るにはどうすればよいでしょうか? .NET アプリケーションで C# OCR 画像からテキストへの機能を実現するには、信頼性の高い OCR ライブラリが必要です。 IronOCR は、外部依存関係を必要とせずに精度と速度の両方を最大化する IronOcr.IronTesseract クラスを使用した管理ソリューションを提供します。 まず、Visual Studio プロジェクトに IronOCR をインストールします。 IronOCR DLL を直接ダウンロードするか、 NuGet パッケージ マネージャーを使用することができます。 Install-Package IronOcr Tesseract なしの C# OCR に IronOCR を選択する理由 C# で画像をテキストに変換する必要がある場合、IronOCR は従来の Tesseract 実装に比べて大きな利点を提供します。 純粋な.NET環境ですぐに動作します Tesseractのインストールや設定は不要 最新のエンジンを実行: Tesseract 5 (および Tesseract 4 と 3) .NET Framework 4.5+、.NET Standard 2+、.NET Core 2、3、5、6、7、8、9、10 と互換性があります バニラのTesseractと比較して精度と速度が向上します Xamarin、Mono、Azure、Docker のデプロイメントをサポート NuGet パッケージを通じて複雑な Tesseract 辞書を管理します PDF、マルチフレームTIFF、およびすべての主要な画像形式を自動的に処理します 低品質や歪んだスキャンを補正して最適な結果を実現します 基本的な OCR に IronOCR C# チュートリアルを使用するにはどうすればよいでしょうか? この Iron Tesseract C# の例では、IronOCR を使用して画像からテキストを読み取る最も簡単な方法を示します。 IronOcr.IronTesseract クラスはテキストを抽出し、それを文字列として返します。 // Basic C# OCR image to text conversion using IronOCR // This example shows how to extract text from images without complex setup using IronOcr; using System; try { // Initialize IronTesseract for OCR operations var ocrEngine = new IronTesseract(); // Path to your image file - supports PNG, JPG, TIFF, BMP, and more var imagePath = @"img\Screenshot.png"; // Create input and perform OCR to convert image to text using (var input = new OcrInput(imagePath)) { // Read text from image and get results OcrResult result = ocrEngine.Read(input); // Display extracted text Console.WriteLine(result.Text); } } catch (OcrException ex) { // Handle OCR-specific errors Console.WriteLine($"OCR Error: {ex.Message}"); } catch (Exception ex) { // Handle general errors Console.WriteLine($"Error: {ex.Message}"); } // Basic C# OCR image to text conversion using IronOCR // This example shows how to extract text from images without complex setup using IronOcr; using System; try { // Initialize IronTesseract for OCR operations var ocrEngine = new IronTesseract(); // Path to your image file - supports PNG, JPG, TIFF, BMP, and more var imagePath = @"img\Screenshot.png"; // Create input and perform OCR to convert image to text using (var input = new OcrInput(imagePath)) { // Read text from image and get results OcrResult result = ocrEngine.Read(input); // Display extracted text Console.WriteLine(result.Text); } } catch (OcrException ex) { // Handle OCR-specific errors Console.WriteLine($"OCR Error: {ex.Message}"); } catch (Exception ex) { // Handle general errors Console.WriteLine($"Error: {ex.Message}"); } $vbLabelText $csharpLabel このコードは鮮明な画像に対して 100% の精度を実現し、表示されているとおりにテキストを抽出します。 IronOCR Simple Example In this simple example we test the accuracy of our C# OCR library to read text from a PNG Image. This is a very basic test, but things will get more complicated as the tutorial continues. The quick brown fox jumps over the lazy dog IronTesseract クラスは、複雑な OCR 操作を内部的に処理します。 自動的に位置合わせをスキャンし、解像度を最適化し、AI を使用して IronOCR で人間レベルの精度で画像からテキストを読み取ります。 画像分析、エンジン最適化、インテリジェントなテキスト認識などの高度な処理がバックグラウンドで行われているにもかかわらず、OCR プロセスは人間の読み取り速度に匹敵し、並外れた精度レベルを維持しています。 IronOCR が PNG 画像から完璧な精度でテキストを抽出できることを示すスクリーンショット Tesseract 構成なしで高度な C# OCR を実装する方法 C# でイメージをテキストに変換するときに最適なパフォーマンスを必要とする運用アプリケーションでは、OcrInput クラスと IronTesseract クラスを一緒に使用します。 このアプローチにより、OCR プロセスをきめ細かく制御できます。 OcrInputクラスの機能 複数の画像形式を処理: JPEG、TIFF、GIF、BMP、PNG PDF全体または特定のページをインポートします コントラスト、解像度、画質を自動的に向上します 回転、スキャンノイズ、傾き、ネガティブイメージを修正します IronTesseractクラスの機能 125以上のパッケージ言語にアクセス可能 Tesseract 5、4、3エンジン搭載 ドキュメントタイプの指定(スクリーンショット、スニペット、または完全なドキュメント) 統合バーコード読み取り機能 複数の出力形式: 検索可能なPDF、HOCR HTML、DOMオブジェクト、文字列 OcrInput と IronTesseract を使い始めるにはどうすればいいですか? ほとんどのドキュメント タイプで適切に機能する、この IronOCR C# チュートリアルの推奨構成は次のとおりです。 using IronOcr; // Initialize IronTesseract for advanced OCR operations IronTesseract ocr = new IronTesseract(); // Create input container for processing multiple images using (OcrInput input = new OcrInput()) { // Process specific pages from multi-page TIFF files int[] pageIndices = new int[] { 1, 2 }; // Load TIFF frames - perfect for scanned documents input.LoadImageFrames(@"img\Potter.tiff", pageIndices); // Execute OCR to read text from image using IronOCR OcrResult result = ocr.Read(input); // Output the extracted text Console.WriteLine(result.Text); } using IronOcr; // Initialize IronTesseract for advanced OCR operations IronTesseract ocr = new IronTesseract(); // Create input container for processing multiple images using (OcrInput input = new OcrInput()) { // Process specific pages from multi-page TIFF files int[] pageIndices = new int[] { 1, 2 }; // Load TIFF frames - perfect for scanned documents input.LoadImageFrames(@"img\Potter.tiff", pageIndices); // Execute OCR to read text from image using IronOCR OcrResult result = ocr.Read(input); // Output the extracted text Console.WriteLine(result.Text); } $vbLabelText $csharpLabel この構成では、中品質のスキャンでほぼ完璧な精度が一貫して達成されます。 LoadImageFrames メソッドは複数ページのドキュメントを効率的に処理するため、バッチ処理のシナリオに最適です。 IronOCR の複数ページテキスト抽出機能を示すサンプル TIFF ドキュメント TIFF などのスキャンされたドキュメント内の画像やバーコードからテキストを読み取る機能は、IronOCR が複雑な OCR タスクをいかに簡素化するかを示しています。 このライブラリは実際のドキュメントに優れており、複数ページの TIFF とPDF テキスト抽出をシームレスに処理します。 IronOCR は低品質のスキャンをどのように処理しますか? IronOCRが画像フィルターを使用して正確に処理できるノイズのある低解像度の文書 歪みやデジタル ノイズを含む不完全なスキャンを処理する場合、 IronOCR は他の C# OCR ライブラリよりも優れたパフォーマンスを発揮します。 これは、純粋なテスト画像ではなく、現実世界のシナリオ向けに特別に設計されています。 // Advanced Iron Tesseract C# example for low-quality images using IronOcr; using System; var ocr = new IronTesseract(); try { using (var input = new OcrInput()) { // Load specific pages from poor-quality TIFF var pageIndices = new int[] { 0, 1 }; input.LoadImageFrames(@"img\Potter.LowQuality.tiff", pageIndices); // Apply deskew filter to correct rotation and perspective input.Deskew(); // Critical for improving accuracy on skewed scans // Perform OCR with enhanced preprocessing OcrResult result = ocr.Read(input); // Display results Console.WriteLine("Recognized Text:"); Console.WriteLine(result.Text); } } catch (Exception ex) { Console.WriteLine($"Error during OCR: {ex.Message}"); } // Advanced Iron Tesseract C# example for low-quality images using IronOcr; using System; var ocr = new IronTesseract(); try { using (var input = new OcrInput()) { // Load specific pages from poor-quality TIFF var pageIndices = new int[] { 0, 1 }; input.LoadImageFrames(@"img\Potter.LowQuality.tiff", pageIndices); // Apply deskew filter to correct rotation and perspective input.Deskew(); // Critical for improving accuracy on skewed scans // Perform OCR with enhanced preprocessing OcrResult result = ocr.Read(input); // Display results Console.WriteLine("Recognized Text:"); Console.WriteLine(result.Text); } } catch (Exception ex) { Console.WriteLine($"Error during OCR: {ex.Message}"); } $vbLabelText $csharpLabel Input.Deskew() を使用すると、低品質のスキャンでも精度が99.8%に向上し、高品質の結果とほぼ同等になります。 これは、Tesseract の複雑さがなく、C# OCR に IronOCR が最適な選択肢である理由を示しています。 画像フィルターにより処理時間がわずかに長くなる可能性がありますが、全体的な OCR の所要時間が大幅に短縮されます。 適切なバランスを見つけるには、ドキュメントの品質が重要になります。 ほとんどのシナリオでは、Input.Deskew() と Input.DeNoise() により、OCR パフォーマンスが確実に向上します。 画像前処理技術について詳しく学びます。 OCR のパフォーマンスと速度を最適化するにはどうすればよいでしょうか? C# で画像をテキストに変換するときに OCR 速度に影響を与える最も重要な要素は、入力品質です。 ノイズが最小限で DPI がより高い (約 200 dpi) 場合、最も高速かつ正確な結果が得られます。 IronOCR は不完全な文書の修正に優れていますが、この機能強化には追加の処理時間が必要になります。 圧縮アーティファクトが最小限の画像形式を選択します。 TIFF と PNG は通常、デジタル ノイズが少ないため、JPEG よりも結果が速くなります。 どの画像フィルターが OCR 速度を向上させるのでしょうか? 次のフィルターを使用すると、C# OCR 画像からテキストへのワークフローのパフォーマンスを大幅に向上できます。 OcrInput.Rotate(double degrees):画像を時計回りに回転します(負の値は反時計回り) OcrInput.Binarize():白黒に変換し、コントラストが低いシナリオでのパフォーマンスを向上します OcrInput.ToGrayScale():速度向上のためグレースケールに変換します OcrInput.Contrast():コントラストを自動調整して精度を向上 OcrInput.DeNoise():ノイズが予想される場合にデジタルアーティファクトを除去します OcrInput.Invert():黒地に白のテキストの色を反転します OcrInput.Dilate():テキスト境界を拡張します OcrInput.Erode():テキストの境界を縮小します OcrInput.Deskew():配置を修正します - 傾いた文書に必須 OcrInput.DeepCleanBackgroundNoise():積極的なノイズ除去 OcrInput.EnhanceResolution:低解像度の画像品質を改善します IronOCR を最高速度で設定するにはどうすればいいですか? 高品質のスキャンを処理する際の速度を最適化するには、次の設定を使用します。 using IronOcr; // Configure for speed - ideal for clean documents IronTesseract ocr = new IronTesseract(); // Exclude problematic characters to speed up recognition ocr.Configuration.BlackListCharacters = "~`$#^*_{[]}|\\"; // Use automatic page segmentation ocr.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.Auto; // Select fast English language pack ocr.Language = OcrLanguage.EnglishFast; using (OcrInput input = new OcrInput()) { // Load specific pages from document int[] pageIndices = new int[] { 1, 2 }; input.LoadImageFrames(@"img\Potter.tiff", pageIndices); // Read with optimized settings OcrResult result = ocr.Read(input); Console.WriteLine(result.Text); } using IronOcr; // Configure for speed - ideal for clean documents IronTesseract ocr = new IronTesseract(); // Exclude problematic characters to speed up recognition ocr.Configuration.BlackListCharacters = "~`$#^*_{[]}|\\"; // Use automatic page segmentation ocr.Configuration.PageSegmentationMode = TesseractPageSegmentationMode.Auto; // Select fast English language pack ocr.Language = OcrLanguage.EnglishFast; using (OcrInput input = new OcrInput()) { // Load specific pages from document int[] pageIndices = new int[] { 1, 2 }; input.LoadImageFrames(@"img\Potter.tiff", pageIndices); // Read with optimized settings OcrResult result = ocr.Read(input); Console.WriteLine(result.Text); } $vbLabelText $csharpLabel この最適化された設定により、デフォルト設定と比較して35% の速度向上を実現しながら、 99.8% の精度が維持されます。 C# OCR を使用して画像の特定の領域を読み取るにはどうすればよいでしょうか? 以下の Iron Tesseract C# の例は、System.Drawing.Rectangle を使用して特定の領域をターゲットにする方法を示しています。 この手法は、テキストが予測可能な場所に表示される標準化されたフォームを処理する場合に非常に役立ちます。 IronOCR は切り取られた領域を処理してより速く結果を得ることができますか? ピクセルベースの座標を使用すると、OCR を特定の領域に制限できるため、速度が大幅に向上し、不要なテキストの抽出を防ぐことができます。 using IronOcr; using IronSoftware.Drawing; // Initialize OCR engine for targeted region processing var ocr = new IronTesseract(); using (var input = new OcrInput()) { // Define exact region for OCR - coordinates in pixels var contentArea = new System.Drawing.Rectangle( x: 215, y: 1250, width: 1335, height: 280 ); // Load image with specific area - perfect for forms and invoices input.AddImage("img/ComSci.png", contentArea); // Process only the defined region OcrResult result = ocr.Read(input); Console.WriteLine(result.Text); } using IronOcr; using IronSoftware.Drawing; // Initialize OCR engine for targeted region processing var ocr = new IronTesseract(); using (var input = new OcrInput()) { // Define exact region for OCR - coordinates in pixels var contentArea = new System.Drawing.Rectangle( x: 215, y: 1250, width: 1335, height: 280 ); // Load image with specific area - perfect for forms and invoices input.AddImage("img/ComSci.png", contentArea); // Process only the defined region OcrResult result = ocr.Read(input); Console.WriteLine(result.Text); } $vbLabelText $csharpLabel このターゲットを絞ったアプローチにより、関連するテキストのみを抽出しながら、速度が 41% 向上します。 請求書、小切手、フォームなどの構造化された文書に最適です。 同じ切り取り手法は、PDF OCR 操作でもシームレスに機能します。 IronOCRの長方形選択を使用した正確な領域ベースのテキスト抽出を示すドキュメント IronOCR はいくつの言語をサポートしていますか? IronOCR は、便利な言語パックを通じて125 の国際言語を提供します。 当社の Web サイトまたはNuGet パッケージ マネージャーから DLL としてダウンロードします。 NuGet インターフェイス ( "IronOcr.Languages"を検索) を通じて言語パックをインストールするか、完全な言語パックのリストにアクセスしてください。 サポートされている言語には、アラビア語、中国語(簡体字/繁体字)、日本語、韓国語、ヒンディー語、ロシア語、ドイツ語、フランス語、スペイン語など 115 以上の言語があり、それぞれ正確なテキスト認識が最適化されています。 複数の言語で OCR を実装するにはどうすればよいでしょうか? この IronOCR C# チュートリアルの例では、アラビア語のテキスト認識を示します。 Install-Package IronOcr.Languages.Arabic IronOCRはGIF画像からアラビア語のテキストを正確に抽出します // Install-Package IronOcr.Languages.Arabic using IronOcr; // Configure for Arabic language OCR var ocr = new IronTesseract(); ocr.Language = OcrLanguage.Arabic; using (var input = new OcrInput()) { // Load Arabic text image input.AddImage("img/arabic.gif"); // IronOCR handles low-quality Arabic text that standard Tesseract cannot var result = ocr.Read(input); // Save to file (console may not display Arabic correctly) result.SaveAsTextFile("arabic.txt"); } // Install-Package IronOcr.Languages.Arabic using IronOcr; // Configure for Arabic language OCR var ocr = new IronTesseract(); ocr.Language = OcrLanguage.Arabic; using (var input = new OcrInput()) { // Load Arabic text image input.AddImage("img/arabic.gif"); // IronOCR handles low-quality Arabic text that standard Tesseract cannot var result = ocr.Read(input); // Save to file (console may not display Arabic correctly) result.SaveAsTextFile("arabic.txt"); } $vbLabelText $csharpLabel IronOCR は複数言語の文書を処理できますか? ドキュメントに混合言語が含まれている場合は、IronOCR を多言語サポート用に設定します。 Install-Package IronOcr.Languages.ChineseSimplified // Multi-language OCR configuration using IronOcr; var ocr = new IronTesseract(); // Set primary language ocr.Language = OcrLanguage.ChineseSimplified; // Add secondary languages as needed ocr.AddSecondaryLanguage(OcrLanguage.English); // Custom .traineddata files can be added for specialized recognition // ocr.AddSecondaryLanguage("path/to/custom.traineddata"); using (var input = new OcrInput()) { // Process multi-language document input.AddImage("img/MultiLanguage.jpeg"); var result = ocr.Read(input); result.SaveAsTextFile("MultiLanguage.txt"); } // Multi-language OCR configuration using IronOcr; var ocr = new IronTesseract(); // Set primary language ocr.Language = OcrLanguage.ChineseSimplified; // Add secondary languages as needed ocr.AddSecondaryLanguage(OcrLanguage.English); // Custom .traineddata files can be added for specialized recognition // ocr.AddSecondaryLanguage("path/to/custom.traineddata"); using (var input = new OcrInput()) { // Process multi-language document input.AddImage("img/MultiLanguage.jpeg"); var result = ocr.Read(input); result.SaveAsTextFile("MultiLanguage.txt"); } $vbLabelText $csharpLabel C# OCR を使用して複数ページのドキュメントを処理する方法 IronOCR は、複数のページまたは画像を 1 つの OcrResult にシームレスに結合します。 この機能により、検索可能な PDF の作成やドキュメント セット全体からのテキストの抽出などの強力な機能が可能になります。 1 回の OCR 操作で、画像、TIFF フレーム、PDF ページなど、さまざまなソースを組み合わせて使用できます。 // Multi-source document processing using IronOcr; IronTesseract ocr = new IronTesseract(); using (OcrInput input = new OcrInput()) { // Add various image formats input.AddImage("image1.jpeg"); input.AddImage("image2.png"); // Process specific frames from multi-frame images int[] frameNumbers = { 1, 2 }; input.AddImageFrames("image3.gif", frameNumbers); // Process all sources together OcrResult result = ocr.Read(input); // Verify page count Console.WriteLine($"{result.Pages.Count} Pages processed."); } // Multi-source document processing using IronOcr; IronTesseract ocr = new IronTesseract(); using (OcrInput input = new OcrInput()) { // Add various image formats input.AddImage("image1.jpeg"); input.AddImage("image2.png"); // Process specific frames from multi-frame images int[] frameNumbers = { 1, 2 }; input.AddImageFrames("image3.gif", frameNumbers); // Process all sources together OcrResult result = ocr.Read(input); // Verify page count Console.WriteLine($"{result.Pages.Count} Pages processed."); } $vbLabelText $csharpLabel TIFF ファイルのすべてのページを効率的に処理します。 using IronOcr; IronTesseract ocr = new IronTesseract(); using (OcrInput input = new OcrInput()) { // Define pages to process (0-based indexing) int[] pageIndices = new int[] { 0, 1 }; // Load specific TIFF frames input.LoadImageFrames("MultiFrame.Tiff", pageIndices); // Extract text from all frames OcrResult result = ocr.Read(input); Console.WriteLine(result.Text); Console.WriteLine($"{result.Pages.Count} Pages processed"); } using IronOcr; IronTesseract ocr = new IronTesseract(); using (OcrInput input = new OcrInput()) { // Define pages to process (0-based indexing) int[] pageIndices = new int[] { 0, 1 }; // Load specific TIFF frames input.LoadImageFrames("MultiFrame.Tiff", pageIndices); // Extract text from all frames OcrResult result = ocr.Read(input); Console.WriteLine(result.Text); Console.WriteLine($"{result.Pages.Count} Pages processed"); } $vbLabelText $csharpLabel TIFF または PDF を検索可能な形式に変換します。 using System; using IronOcr; IronTesseract ocr = new IronTesseract(); using (OcrInput input = new OcrInput()) { // Set document metadata input.Title = "Quarterly Report"; // Combine multiple sources input.AddImage("image1.jpeg"); input.AddImage("image2.png"); // Add specific frames from animated images int[] gifFrames = new int[] { 1, 2 }; input.AddImageFrames("image3.gif", gifFrames); // Create searchable PDF OcrResult result = ocr.Read(input); result.SaveAsSearchablePdf("searchable.pdf"); } using System; using IronOcr; IronTesseract ocr = new IronTesseract(); using (OcrInput input = new OcrInput()) { // Set document metadata input.Title = "Quarterly Report"; // Combine multiple sources input.AddImage("image1.jpeg"); input.AddImage("image2.png"); // Add specific frames from animated images int[] gifFrames = new int[] { 1, 2 }; input.AddImageFrames("image3.gif", gifFrames); // Create searchable PDF OcrResult result = ocr.Read(input); result.SaveAsSearchablePdf("searchable.pdf"); } $vbLabelText $csharpLabel 既存の PDF を検索可能なバージョンに変換します。 using IronOcr; var ocr = new IronTesseract(); using (var input = new OcrInput()) { // Set PDF metadata input.Title = "Annual Report 2024"; // Process existing PDF input.LoadPdf("example.pdf", "password"); // Generate searchable version var result = ocr.Read(input); result.SaveAsSearchablePdf("searchable.pdf"); } using IronOcr; var ocr = new IronTesseract(); using (var input = new OcrInput()) { // Set PDF metadata input.Title = "Annual Report 2024"; // Process existing PDF input.LoadPdf("example.pdf", "password"); // Generate searchable version var result = ocr.Read(input); result.SaveAsSearchablePdf("searchable.pdf"); } $vbLabelText $csharpLabel 同じ手法を TIFF 変換に適用します。 using IronOcr; var ocr = new IronTesseract(); using (var input = new OcrInput()) { // Configure document properties input.Title = "Scanned Archive Document"; // Select pages to process var pageIndices = new int[] { 1, 2 }; input.LoadImageFrames("example.tiff", pageIndices); // Create searchable PDF from TIFF OcrResult result = ocr.Read(input); result.SaveAsSearchablePdf("searchable.pdf"); } using IronOcr; var ocr = new IronTesseract(); using (var input = new OcrInput()) { // Configure document properties input.Title = "Scanned Archive Document"; // Select pages to process var pageIndices = new int[] { 1, 2 }; input.LoadImageFrames("example.tiff", pageIndices); // Create searchable PDF from TIFF OcrResult result = ocr.Read(input); result.SaveAsSearchablePdf("searchable.pdf"); } $vbLabelText $csharpLabel OCR の結果を HOCR HTML としてエクスポートするにはどうすればいいですか? IronOCR は HOCR HTML エクスポートをサポートしており、レイアウト情報を保持しながら構造化されたPDF から HTMLおよびTIFF から HTML への変換を可能にします。 using IronOcr; var ocr = new IronTesseract(); using (var input = new OcrInput()) { // Set HTML title input.Title = "Document Archive"; // Process multiple document types input.AddImage("image2.jpeg"); input.AddPdf("example.pdf", "password"); // Add TIFF pages var pageIndices = new int[] { 1, 2 }; input.AddTiff("example.tiff", pageIndices); // Export as HOCR with position data OcrResult result = ocr.Read(input); result.SaveAsHocrFile("hocr.html"); } using IronOcr; var ocr = new IronTesseract(); using (var input = new OcrInput()) { // Set HTML title input.Title = "Document Archive"; // Process multiple document types input.AddImage("image2.jpeg"); input.AddPdf("example.pdf", "password"); // Add TIFF pages var pageIndices = new int[] { 1, 2 }; input.AddTiff("example.tiff", pageIndices); // Export as HOCR with position data OcrResult result = ocr.Read(input); result.SaveAsHocrFile("hocr.html"); } $vbLabelText $csharpLabel IronOCR はテキストと一緒にバーコードも読み取ることができますか? IronOCR はテキスト認識とバーコード読み取り機能を独自に組み合わせており、個別のライブラリを必要としません。 // Enable combined text and barcode recognition using IronOcr; var ocr = new IronTesseract(); // Enable barcode detection ocr.Configuration.ReadBarCodes = true; using (var input = new OcrInput()) { // Load image containing both text and barcodes input.AddImage("img/Barcode.png"); // Process both text and barcodes var result = ocr.Read(input); // Extract barcode data foreach (var barcode in result.Barcodes) { Console.WriteLine($"Barcode Value: {barcode.Value}"); Console.WriteLine($"Type: {barcode.Type}, Location: {barcode.Location}"); } } // Enable combined text and barcode recognition using IronOcr; var ocr = new IronTesseract(); // Enable barcode detection ocr.Configuration.ReadBarCodes = true; using (var input = new OcrInput()) { // Load image containing both text and barcodes input.AddImage("img/Barcode.png"); // Process both text and barcodes var result = ocr.Read(input); // Extract barcode data foreach (var barcode in result.Barcodes) { Console.WriteLine($"Barcode Value: {barcode.Value}"); Console.WriteLine($"Type: {barcode.Type}, Location: {barcode.Location}"); } } $vbLabelText $csharpLabel 詳細な OCR 結果とメタデータにアクセスするにはどうすればよいでしょうか? IronOCR 結果オブジェクトは、上級開発者が高度なアプリケーションに活用できる包括的なデータを提供します。 各 OcrResult には、ページ、段落、行、単語、文字などの階層的なコレクションが含まれています。 すべての要素には、場所、フォント情報、信頼スコアなどの詳細なメタデータが含まれます。 個々の要素 (段落、単語、バーコード) は、画像またはビットマップとしてエクスポートして、さらに処理することができます。 using System; using IronOcr; using IronSoftware.Drawing; // Configure with barcode support IronTesseract ocr = new IronTesseract { Configuration = { ReadBarCodes = true } }; using OcrInput input = new OcrInput(); // Process multi-page document int[] pageIndices = { 1, 2 }; input.LoadImageFrames(@"img\Potter.tiff", pageIndices); OcrResult result = ocr.Read(input); // Navigate the complete results hierarchy foreach (var page in result.Pages) { // Page-level data int pageNumber = page.PageNumber; string pageText = page.Text; int pageWordCount = page.WordCount; // Extract page elements OcrResult.Barcode[] barcodes = page.Barcodes; AnyBitmap pageImage = page.ToBitmap(); double pageWidth = page.Width; double pageHeight = page.Height; foreach (var paragraph in page.Paragraphs) { // Paragraph properties int paragraphNumber = paragraph.ParagraphNumber; string paragraphText = paragraph.Text; double paragraphConfidence = paragraph.Confidence; var textDirection = paragraph.TextDirection; foreach (var line in paragraph.Lines) { // Line details including baseline information string lineText = line.Text; double lineConfidence = line.Confidence; double baselineAngle = line.BaselineAngle; double baselineOffset = line.BaselineOffset; foreach (var word in line.Words) { // Word-level data string wordText = word.Text; double wordConfidence = word.Confidence; // Font information (when available) if (word.Font != null) { string fontName = word.Font.FontName; double fontSize = word.Font.FontSize; bool isBold = word.Font.IsBold; bool isItalic = word.Font.IsItalic; } foreach (var character in word.Characters) { // Character-level analysis string charText = character.Text; double charConfidence = character.Confidence; // Alternative character choices for spell-checking OcrResult.Choice[] alternatives = character.Choices; } } } } } using System; using IronOcr; using IronSoftware.Drawing; // Configure with barcode support IronTesseract ocr = new IronTesseract { Configuration = { ReadBarCodes = true } }; using OcrInput input = new OcrInput(); // Process multi-page document int[] pageIndices = { 1, 2 }; input.LoadImageFrames(@"img\Potter.tiff", pageIndices); OcrResult result = ocr.Read(input); // Navigate the complete results hierarchy foreach (var page in result.Pages) { // Page-level data int pageNumber = page.PageNumber; string pageText = page.Text; int pageWordCount = page.WordCount; // Extract page elements OcrResult.Barcode[] barcodes = page.Barcodes; AnyBitmap pageImage = page.ToBitmap(); double pageWidth = page.Width; double pageHeight = page.Height; foreach (var paragraph in page.Paragraphs) { // Paragraph properties int paragraphNumber = paragraph.ParagraphNumber; string paragraphText = paragraph.Text; double paragraphConfidence = paragraph.Confidence; var textDirection = paragraph.TextDirection; foreach (var line in paragraph.Lines) { // Line details including baseline information string lineText = line.Text; double lineConfidence = line.Confidence; double baselineAngle = line.BaselineAngle; double baselineOffset = line.BaselineOffset; foreach (var word in line.Words) { // Word-level data string wordText = word.Text; double wordConfidence = word.Confidence; // Font information (when available) if (word.Font != null) { string fontName = word.Font.FontName; double fontSize = word.Font.FontSize; bool isBold = word.Font.IsBold; bool isItalic = word.Font.IsItalic; } foreach (var character in word.Characters) { // Character-level analysis string charText = character.Text; double charConfidence = character.Confidence; // Alternative character choices for spell-checking OcrResult.Choice[] alternatives = character.Choices; } } } } } $vbLabelText $csharpLabel まとめ IronOCR は、Windows、Linux、Mac プラットフォームでシームレスに実行される最も高度なTesseract API 実装を C# 開発者に提供します。 IronOCR を使用して、不完全なドキュメントからでも画像からテキストを正確に読み取ることができる機能は、基本的な OCR ソリューションとは一線を画しています。 ライブラリの独自の機能には、統合バーコード読み取り機能や、結果を検索可能な PDF または HOCR HTML としてエクスポートする機能などがあり、これらの機能は標準の Tesseract 実装では利用できません。 前進 IronOCR の習得を続けるには: -包括的なスタートガイドをご覧ください -実用的なC#コード例を参照する -詳細なAPIドキュメントを参照してください ソースコードのダウンロード GitHubリポジトリ 完全なソースをダウンロード アプリケーションに C# OCR 画像からテキストへの変換を実装する準備はできていますか? 今すぐIronOCR をダウンロードして無料トライアルを開始してください。 よくある質問 Tesseract を使用せずに C# で画像をテキストに変換するにはどうすればよいですか? IronOCR を使用して C# で画像をテキストに変換できます。IronOCR は、画像からテキストへの変換を直接処理する組み込みメソッドでこのプロセスを簡素化します。 低品質画像での OCR 精度を向上させるにはどうすればよいですか? IronOCR には、Input.Deskew() および Input.DeNoise() などの画像フィルターが用意されており、傾きを補正し、ノイズを軽減することで低品質の画像を強化し、OCR の精度を大幅に向上させることができます。 C# で OCR を使用して複数ページのドキュメントからテキストを抽出する手順は何ですか? 複数ページのドキュメントからテキストを抽出するには、IronOCR を使用すると、LoadPdf() などのメソッドを使用して各ページをロードおよび処理し、各ページを効果的にテキストに変換できます。 画像からバーコードとテキストを同時に読み取ることは可能ですか? はい、IronOCR は 1 つの画像からテキストとバーコードの両方を読み取ることができます。ocr.Configuration.ReadBarCodes = true を有効にすることで、テキストとバーコード データの両方を抽出できます。 複数の言語でドキュメントを処理するための OCR をセットアップするにはどうすればよいですか? IronOCR は 125 を超える言語をサポートしており、ocr.Language コマンドを使用して主要な言語を設定し、ocr.AddSecondaryLanguage() コマンドを使用して追加言語を追加することで、多言語ドキュメントの処理を可能にします。 OCR 結果をさまざまな形式でエクスポートするために利用可能なメソッドは何ですか? IronOCR は複数のメソッドを提供して OCR 結果をエクスポートできます。たとえば、PDF の場合は SaveAsSearchablePdf()、プレーンテキストの場合は SaveAsTextFile()、HOCR HTML 形式の場合は SaveAsHocrFile() があります。 大型画像ファイルの OCR 処理速度を最適化するにはどうすればよいですか? OCR処理速度を最適化するには、IronOCR の OcrLanguage.EnglishFast を使用して高速な言語認識を実現し、System.Drawing.Rectangle を使用して 特定の領域を定義し、処理時間を短縮します。 保護されたPDFファイルのOCR処理をどのように扱うべきですか? 保護された PDF を処理する際は、正しいパスワードと共に LoadPdf() メソッドを使用します。IronOCR は、ページを画像に自動的に変換して、画像ベースの PDF を処理します。 OCR 結果が正確でない場合はどうすればよいですか? OCR 結果が正確でない場合は、IronOCR の Input.Deskew() や Input.DeNoise() などの画像強化機能を使用し、正しい言語パックがインストールされていることを確認してください。 OCR プロセスをカスタマイズして特定の文字を除外することはできますか? はい、IronOCR を利用して、BlackListCharacters プロパティを使用して特定の文字を除外することにより、精度とプロセス速度を改善し、関連するテキストにのみ焦点を当てるように OCR プロセスをカスタマイズできます。 Jacob Mellor 今すぐエンジニアリングチームとチャット 最高技術責任者(CTO) ジェイコブ・メラーはIron Softwareの最高技術責任者(CTO)であり、C# PDFテクノロジーを開拓する先見的なエンジニアです。Iron Softwareのコアコードベースを支えるオリジナル開発者として、彼は創業以来、会社の製品アーキテクチャを形成し、CEOのCameron Rimingtonとともに、会社をNASA、Tesla、および世界的な政府機関にサービスを提供する50人以上の会社に変えました。1999年にロンドンで最初のソフトウェアビジネスを開業し、2005年に最初 for .NETコンポーネントを作成した後、Microsoftのエコシステム全体で複雑な問題を解決することを専門としました。彼の主要なIronPDFとIron Suite .NETライブラリは、世界中で3000万以上のNuGetインストールを達成し、彼の基礎となるコードは世界中で使用されている開発者ツールに力を与え続けています。25年の商業経験と41年のコーディングの専門知識を持つJacobは、次世代の技術リーダーを指導しながら、エンタープライズグレードのC#、Java、Python PDFテクノロジーにおけるイノベーションの推進に注力しています。 レビュー済み Jeffrey T. Fritz プリンシパルプログラムマネージャー - .NETコミュニティチーム Jeffはまた、.NETとVisual Studioチームのプリンシパルプログラムマネージャーです。彼は.NET Conf仮想会議シリーズのエグゼクティブプロデューサーであり、週に二回放送される開発者向けライブストリーム『Fritz and Friends』のホストを務め、テクノロジーについて話すことや視聴者と一緒にコードを書くことをしています。Jeffはワークショップ、プレゼンテーション、およびMicrosoft Build、Microsoft Ignite、.NET Conf、Microsoft MVPサミットを含む最大のMicrosoft開発者イベントのコンテンツを企画しています。 準備はできましたか? Nuget ダウンロード 5,554,905 | バージョン: 2026.3 リリース 無料トライアル NuGet 無料ダウンロード 総ダウンロード数: 5,554,905 ライセンスを見る まだスクロールしていますか? すぐに証拠が欲しいですか? PM > Install-Package IronOcr サンプルを実行 あなたの画像が検索可能なテキストになるのをご覧ください。 NuGet 無料ダウンロード 総ダウンロード数: 5,554,905 ライセンスを見る