IronBarcode ハウツー バーコードの向きを修正 C#でバーコードの向きを修正する方法</#35; カーティス・チャウ 更新日:2026年1月10日 IronBarcode をダウンロード NuGet ダウンロード DLL ダウンロード 無料トライアル 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 IronBarcodeは、内蔵のAutoRotate機能によりバーコードの向きを自動的に補正し、手動で画像を回転させることなくあらゆる角度のバーコードを検出して読み取るため、傾いたり回転したりした画像からでもバーコードを正確に読み取ることができます。 バーコードの向きとは、製品や文書に印刷または表示される際の角度を指します。 さまざまなレイアウトやデザイン要件に合わせて、異なる角度に調整できます。 最も一般的な向きは水平で、これはバーコードが左から右に配置されるという標準で最も広く使われている形式です。 非ゼロの向きの角度は、ライブラリが値を検出して取得するための課題を引き起こします。 IronBarcodeは、バーコードとQRコードのために非ゼロの向きを自動検出して修正します。 . 。 。 クイックスタート: 一行でのオートローテーション画像修正 IronBarcodeのAutoRotateオプション(デフォルトで有効)を使用することで、画像が回転してもバーコードを正確に読み取ることができます。 今すぐ NuGet で PDF を作成してみましょう: NuGet パッケージ マネージャーを使用して IronBarcode をインストールします PM > Install-Package BarCode このコード スニペットをコピーして実行します。 var result = IronBarCode.BarcodeReader.Read("rotatedImage.png", new IronBarCode.BarcodeReaderOptions { AutoRotate = true }); 実際の環境でテストするためにデプロイする 今すぐ無料トライアルでプロジェクトに IronBarcode を使い始めましょう 30日間無料トライアル ### 最小限のワークフロー(5ステップ) バーコードの向きを修正するためのC#ライブラリをダウンロードする Set the `AutoRotate` property to true ターゲットのバーコードとQRコードをインポート 読み取りオプションでバーコードとQRコードを読む 結果のバーコードの値を取得 アプリケーションの BarCode の向きを修正するにはどうすればよいですか? 自動方向修正を適用するには、BarcodeReaderOptionsのAutoRotateプロパティをtrueに設定します。 このプロパティはデフォルトでtrueに設定されているため、何もする必要はありません。 非ゼロ向きのバーコード画像の読み取りは自動で機能するはずです。 AutoRotate 機能は、QR コード、データマトリックス、従来のリニアバーコードなど、さまざまなバーコード形式を扱う場合に特に便利です。 画像から BarCode を読み取る場合でも、PDFドキュメントからスキャンする場合でも、向きの補正は信頼できる結果を保証します。 以下の画像をサンプルとして使用しましょう。 Download the following 20° rotation and 45° rotation sample images. 20°回転 45°回転 自動回転を実装するにはどのようなコードが必要ですか? :path=/static-assets/barcode/content-code-examples/how-to/image-orientation-correct-autorotate.cs using IronBarCode; using System; BarcodeReaderOptions myOptionsExample = new BarcodeReaderOptions() { // Turn on auto rotation in ML detection AutoRotate = true, }; var results = BarcodeReader.Read("rotate20.png", myOptionsExample); // Print out the value Console.WriteLine(results[0].Value); Imports IronBarCode Imports System Private myOptionsExample As New BarcodeReaderOptions() With {.AutoRotate = True} Private results = BarcodeReader.Read("rotate20.png", myOptionsExample) ' Print out the value Console.WriteLine(results(0).Value) $vbLabelText $csharpLabel AutoRotate機能は、高度な機械学習アルゴリズムを活用し、バーコードの向きを自動的に検出します。 これは、単一の画像内の複数の BarCode を扱う場合や、向きが異なる画像のバッチを処理する場合に特に価値があります。 さまざまな回転角度を扱う IronBarcodeの方向補正は様々な回転角度をシームレスに処理します。 異なる回転角度で BarCode を読み取る例を示します: using IronBarCode; using System; using System.Collections.Generic; // Process multiple rotated images var rotatedImages = new List<string> { "rotate20.png", "rotate45.png", "rotate90.png" }; var options = new BarcodeReaderOptions { AutoRotate = true, // Combine with other reading optimizations Speed = ReadingSpeed.Balanced, ExpectMultipleBarcodes = false }; foreach (var imagePath in rotatedImages) { var results = BarcodeReader.Read(imagePath, options); if (results.Length > 0) { Console.WriteLine($"Image: {imagePath} - Barcode Value: {results[0].Value}"); Console.WriteLine($"Barcode Type: {results[0].BarcodeType}"); Console.WriteLine($"Rotation Applied: {results[0].WasRotated}"); } } using IronBarCode; using System; using System.Collections.Generic; // Process multiple rotated images var rotatedImages = new List<string> { "rotate20.png", "rotate45.png", "rotate90.png" }; var options = new BarcodeReaderOptions { AutoRotate = true, // Combine with other reading optimizations Speed = ReadingSpeed.Balanced, ExpectMultipleBarcodes = false }; foreach (var imagePath in rotatedImages) { var results = BarcodeReader.Read(imagePath, options); if (results.Length > 0) { Console.WriteLine($"Image: {imagePath} - Barcode Value: {results[0].Value}"); Console.WriteLine($"Barcode Type: {results[0].BarcodeType}"); Console.WriteLine($"Rotation Applied: {results[0].WasRotated}"); } } Imports IronBarCode Imports System Imports System.Collections.Generic ' Process multiple rotated images Dim rotatedImages As New List(Of String) From {"rotate20.png", "rotate45.png", "rotate90.png"} Dim options As New BarcodeReaderOptions With { .AutoRotate = True, ' Combine with other reading optimizations .Speed = ReadingSpeed.Balanced, .ExpectMultipleBarcodes = False } For Each imagePath In rotatedImages Dim results = BarcodeReader.Read(imagePath, options) If results.Length > 0 Then Console.WriteLine($"Image: {imagePath} - Barcode Value: {results(0).Value}") Console.WriteLine($"Barcode Type: {results(0).BarcodeType}") Console.WriteLine($"Rotation Applied: {results(0).WasRotated}") End If Next $vbLabelText $csharpLabel パフォーマンスの考慮事項 AutoRotateはデフォルトで有効になっていますが、そのパフォーマンスの意味を理解することは、バーコード読み取りワークフローの最適化に役立ちます。 この機能はIronBarcodeの読み取り速度オプションと効率的に連動し、アプリケーションのニーズに応じて精度とパフォーマンスのバランスをとることができます。 高速処理を必要とするアプリケーションでは、AutoRotate を他の最適化技術と組み合わせることができます: var fastReadOptions = new BarcodeReaderOptions { AutoRotate = true, Speed = ReadingSpeed.Faster, // Specify expected barcode types to improve performance ExpectBarcodeTypes = BarcodeEncoding.QRCode | BarcodeEncoding.Code128, // Define crop region if barcode location is predictable CropArea = new System.Drawing.Rectangle(100, 100, 300, 300) }; var fastReadOptions = new BarcodeReaderOptions { AutoRotate = true, Speed = ReadingSpeed.Faster, // Specify expected barcode types to improve performance ExpectBarcodeTypes = BarcodeEncoding.QRCode | BarcodeEncoding.Code128, // Define crop region if barcode location is predictable CropArea = new System.Drawing.Rectangle(100, 100, 300, 300) }; Dim fastReadOptions As New BarcodeReaderOptions With { .AutoRotate = True, .Speed = ReadingSpeed.Faster, ' Specify expected barcode types to improve performance .ExpectBarcodeTypes = BarcodeEncoding.QRCode Or BarcodeEncoding.Code128, ' Define crop region if barcode location is predictable .CropArea = New System.Drawing.Rectangle(100, 100, 300, 300) } $vbLabelText $csharpLabel 画像補正機能との統合 AutoRotateはIronBarcodeの画像補正フィルターとシームレスに動作します。 回転している画質の悪い画像を扱う場合、複数の補正をかけることができます: var advancedOptions = new BarcodeReaderOptions { AutoRotate = true, // Apply additional image corrections ImageFilters = new ImageFilterCollection { new AdaptiveThresholdFilter(), new BrightnessFilter(1.2f), new ContrastFilter(1.5f) } }; var results = BarcodeReader.Read("low-quality-rotated-barcode.jpg", advancedOptions); var advancedOptions = new BarcodeReaderOptions { AutoRotate = true, // Apply additional image corrections ImageFilters = new ImageFilterCollection { new AdaptiveThresholdFilter(), new BrightnessFilter(1.2f), new ContrastFilter(1.5f) } }; var results = BarcodeReader.Read("low-quality-rotated-barcode.jpg", advancedOptions); Imports System Dim advancedOptions As New BarcodeReaderOptions With { .AutoRotate = True, ' Apply additional image corrections .ImageFilters = New ImageFilterCollection From { New AdaptiveThresholdFilter(), New BrightnessFilter(1.2F), New ContrastFilter(1.5F) } } Dim results = BarcodeReader.Read("low-quality-rotated-barcode.jpg", advancedOptions) $vbLabelText $csharpLabel 方向修正のベストプラクティス 1.デフォルトの動作: AutoRotateはデフォルトで有効になっているため、以前に無効にした場合や確実に有効にしたい場合を除き、通常は明示的に設定する必要はありません。 2.クロップリージョンとの組み合わせ:パフォーマンスを向上させるためにクロップ領域を使用する場合、クロップ領域が回転した BarCode を収容するのに十分な大きさであることを確認してください。 3.マルチスレッド処理:AutoRotateはスレッドセーフであり、非同期処理やマルチスレッド処理に適しているため、大量のバーコード処理アプリケーションに適しています。 4.フォーマット固有の考慮事項:AutoRotate はサポートされているすべての BarCode フォーマットで動作しますが、PDF417 や Data Matrix などの一部のフォーマットでは、フォーマット固有のオプションが追加されます。 多くの場合、回転の修正は十分ではなく、フィルタが必要となることがあります。 以下の記事で、画像フィルタの使い方を学んでください:"画像補正フィルターの使い方". よくある質問 C# アプリケーションで回転した BarCode 画像を修正するにはどうすればよいですか? IronBarcodeは内蔵のAutoRotate機能を使って回転したバーコード画像を自動的に修正します。BarCodeReaderOptionsでAutoRotateをtrueに設定するだけで(デフォルトで有効になっています)、ライブラリは手動で回転させることなく、あらゆる角度のバーコードを検出し読み取ります。 どのようなバーコードの向きを自動的に修正できますか? IronBarcodeのAutoRotate機能は、20°、45°、90°、180°、270°の回転を含む、0度以外の向きを検出して修正することができます。この機能は、QRコード、データマトリックス、従来のリニアバーコードを含む様々なバーコードフォーマットで動作します。 傾いた BarCode を処理するために特別なコードを書く必要がありますか? 特別なコードは必要ありません。IronBarcodeのAutoRotateプロパティはデフォルトで有効になっているため、すぐに向きの修正が可能です。必要なコードは1行だけです: var result = IronBarcode.BarcodeReader.Read("rotatedImage.png"); オリエンテーション補正はPDF文書でも可能ですか? IronBarcodeの自動回転機能は、画像だけでなくPDFドキュメントからバーコードをスキャンする際にもシームレスに機能します。向きの補正は、ソース形式に関係なく信頼性の高い結果を保証します。 自動オリエンテーション検出の原動力となる技術は何ですか? IronBarcodeは高度な機械学習アルゴリズムを使用して、バーコードの向きを自動的に検出します。このインテリジェントなアプローチにより、傾いたり回転したりした画像からでも、手動で操作することなくバーコードを正確に読み取ることができます。 カーティス・チャウ 今すぐエンジニアリングチームとチャット テクニカルライター Curtis Chauは、カールトン大学でコンピュータサイエンスの学士号を取得し、Node.js、TypeScript、JavaScript、およびReactに精通したフロントエンド開発を専門としています。直感的で美しいユーザーインターフェースを作成することに情熱を持ち、Curtisは現代のフレームワークを用いた開発や、構造の良い視覚的に魅力的なマニュアルの作成を楽しんでいます。開発以外にも、CurtisはIoT(Internet of Things)への強い関心を持ち、ハードウェアとソフトウェアの統合方法を模索しています。余暇には、ゲームをしたりDiscordボットを作成したりして、技術に対する愛情と創造性を組み合わせています。 準備はできましたか? Nuget ダウンロード 2,070,733 | バージョン: 2026.2 リリース NuGet 無料版 総ダウンロード数: 2,070,733 ライセンスを見る