觀看David Jones, Agorus, 使用Iron Suite創造新效能
觀看Milan Jovanović使用IronPDF
觀看我們的團隊產品演示
using IronOcr; string imageText = new IronTesseract().Read(@"images\image.png").Text;
Imports IronOcr Private imageText As String = (New IronTesseract()).Read("images\image.png").Text
Install-Package IronOcr
IronOCR 的獨特之處在於它能夠自動偵測和讀取掃描不完美的影像和 PDF 文件中的文字。 IronTesseract類別提供了最簡單的 API。
IronTesseract
嘗試其他程式碼範例,以獲得對 C# OCR 操作的更精細控制。
IronOCR 提供目前已知最先進的 Tesseract 版本,可在任何平台上運行,速度更快、精度更高,並具有原生 DLL 和 API。
支援適用於 .NET Framework、Standard、Core、Xamarin 和 Mono 的 Tesseract 3、Tesseract 4 和 Tesseract 5。
Read
Text
探索 IronTesseract C# OCR 使用指南
using IronOcr; using System; var ocrTesseract = new IronTesseract(); ocrTesseract.Language = OcrLanguage.Arabic; using (var ocrInput = new OcrInput()) { ocrInput.LoadImage(@"images\arabic.gif"); var ocrResult = ocrTesseract.Read(ocrInput); Console.WriteLine(ocrResult.Text); } // Example with a Custom Trained Font Being used: var ocrTesseractCustomerLang = new IronTesseract(); ocrTesseractCustomerLang.UseCustomTesseractLanguageFile("custom_tesseract_files/custom.traineddata"); ocrTesseractCustomerLang.AddSecondaryLanguage(OcrLanguage.EnglishBest); using (var ocrInput = new OcrInput()) { ocrInput.LoadPdf(@"images\mixed-lang.pdf"); var ocrResult = ocrTesseractCustomerLang.Read(ocrInput); Console.WriteLine(ocrResult.Text); }
Imports IronOcr Imports System Private ocrTesseract = New IronTesseract() ocrTesseract.Language = OcrLanguage.Arabic Using ocrInput As New OcrInput() ocrInput.LoadImage("images\arabic.gif") Dim ocrResult = ocrTesseract.Read(ocrInput) Console.WriteLine(ocrResult.Text) End Using ' Example with a Custom Trained Font Being used: Dim ocrTesseractCustomerLang = New IronTesseract() ocrTesseractCustomerLang.UseCustomTesseractLanguageFile("custom_tesseract_files/custom.traineddata") ocrTesseractCustomerLang.AddSecondaryLanguage(OcrLanguage.EnglishBest) Using ocrInput As New OcrInput() ocrInput.LoadPdf("images\mixed-lang.pdf") Dim ocrResult = ocrTesseractCustomerLang.Read(ocrInput) Console.WriteLine(ocrResult.Text) End Using
IronOCR 語言支持 IronOCR 支援 125 種國際語言。 除了預設安裝的英文之外,還可以透過 NuGet 將其他語言套件新增至您的 .NET 專案中,或從我們的語言頁面下載其他語言套件。 大多數語言都提供快速、標準(建議)和最佳品質三種版本。 最佳品質選項可能提供更準確的結果,但處理時間也會更慢。 使用 IronOCR 探索多種語言的 OCR 技術。
IronOCR 支援 125 種國際語言。 除了預設安裝的英文之外,還可以透過 NuGet 將其他語言套件新增至您的 .NET 專案中,或從我們的語言頁面下載其他語言套件。
大多數語言都提供快速、標準(建議)和最佳品質三種版本。 最佳品質選項可能提供更準確的結果,但處理時間也會更慢。
使用 IronOCR 探索多種語言的 OCR 技術。
using IronOcr; using IronSoftware.Drawing; // We can delve deep into OCR results as an object model of // Pages, Barcodes, Paragraphs, Lines, Words and Characters // This allows us to explore, export and draw OCR content using other APIs/ var ocrTesseract = new IronTesseract(); ocrTesseract.Configuration.ReadBarCodes = true; using var ocrInput = new OcrInput(); var pages = new int[] { 1, 2 }; ocrInput.LoadImageFrames("example.tiff", pages); OcrResult ocrResult = ocrTesseract.Read(ocrInput); foreach (var page in ocrResult.Pages) { // Page object int PageNumber = page.PageNumber; string PageText = page.Text; int PageWordCount = page.WordCount; // null if we dont set Ocr.Configuration.ReadBarCodes = true; OcrResult.Barcode[] Barcodes = page.Barcodes; AnyBitmap PageImage = page.ToBitmap(ocrInput); double PageWidth = page.Width; double PageHeight = page.Height; double PageRotation = page.Rotation; // angular correction in degrees from OcrInput.Deskew() foreach (var paragraph in page.Paragraphs) { // Pages -> Paragraphs int ParagraphNumber = paragraph.ParagraphNumber; string ParagraphText = paragraph.Text; AnyBitmap ParagraphImage = paragraph.ToBitmap(ocrInput); int ParagraphX_location = paragraph.X; int ParagraphY_location = paragraph.Y; int ParagraphWidth = paragraph.Width; int ParagraphHeight = paragraph.Height; double ParagraphOcrAccuracy = paragraph.Confidence; OcrResult.TextFlow paragrapthText_direction = paragraph.TextDirection; foreach (var line in paragraph.Lines) { // Pages -> Paragraphs -> Lines int LineNumber = line.LineNumber; string LineText = line.Text; AnyBitmap LineImage = line.ToBitmap(ocrInput); int LineX_location = line.X; int LineY_location = line.Y; int LineWidth = line.Width; int LineHeight = line.Height; double LineOcrAccuracy = line.Confidence; double LineSkew = line.BaselineAngle; double LineOffset = line.BaselineOffset; foreach (var word in line.Words) { // Pages -> Paragraphs -> Lines -> Words int WordNumber = word.WordNumber; string WordText = word.Text; AnyBitmap WordImage = word.ToBitmap(ocrInput); int WordX_location = word.X; int WordY_location = word.Y; int WordWidth = word.Width; int WordHeight = word.Height; double WordOcrAccuracy = word.Confidence; foreach (var character in word.Characters) { // Pages -> Paragraphs -> Lines -> Words -> Characters int CharacterNumber = character.CharacterNumber; string CharacterText = character.Text; AnyBitmap CharacterImage = character.ToBitmap(ocrInput); int CharacterX_location = character.X; int CharacterY_location = character.Y; int CharacterWidth = character.Width; int CharacterHeight = character.Height; double CharacterOcrAccuracy = character.Confidence; // Output alternative symbols choices and their probability. // Very useful for spellchecking OcrResult.Choice[] Choices = character.Choices; } } } } }
Imports IronOcr Imports IronSoftware.Drawing ' We can delve deep into OCR results as an object model of ' Pages, Barcodes, Paragraphs, Lines, Words and Characters ' This allows us to explore, export and draw OCR content using other APIs/ Private ocrTesseract = New IronTesseract() ocrTesseract.Configuration.ReadBarCodes = True Dim ocrInput As New OcrInput() Dim pages = New Integer() { 1, 2 } ocrInput.LoadImageFrames("example.tiff", pages) Dim ocrResult As OcrResult = ocrTesseract.Read(ocrInput) For Each page In ocrResult.Pages ' Page object Dim PageNumber As Integer = page.PageNumber Dim PageText As String = page.Text Dim PageWordCount As Integer = page.WordCount ' null if we dont set Ocr.Configuration.ReadBarCodes = true; Dim Barcodes() As OcrResult.Barcode = page.Barcodes Dim PageImage As AnyBitmap = page.ToBitmap(ocrInput) Dim PageWidth As Double = page.Width Dim PageHeight As Double = page.Height Dim PageRotation As Double = page.Rotation ' angular correction in degrees from OcrInput.Deskew() For Each paragraph In page.Paragraphs ' Pages -> Paragraphs Dim ParagraphNumber As Integer = paragraph.ParagraphNumber Dim ParagraphText As String = paragraph.Text Dim ParagraphImage As AnyBitmap = paragraph.ToBitmap(ocrInput) Dim ParagraphX_location As Integer = paragraph.X Dim ParagraphY_location As Integer = paragraph.Y Dim ParagraphWidth As Integer = paragraph.Width Dim ParagraphHeight As Integer = paragraph.Height Dim ParagraphOcrAccuracy As Double = paragraph.Confidence Dim paragrapthText_direction As OcrResult.TextFlow = paragraph.TextDirection For Each line In paragraph.Lines ' Pages -> Paragraphs -> Lines Dim LineNumber As Integer = line.LineNumber Dim LineText As String = line.Text Dim LineImage As AnyBitmap = line.ToBitmap(ocrInput) Dim LineX_location As Integer = line.X Dim LineY_location As Integer = line.Y Dim LineWidth As Integer = line.Width Dim LineHeight As Integer = line.Height Dim LineOcrAccuracy As Double = line.Confidence Dim LineSkew As Double = line.BaselineAngle Dim LineOffset As Double = line.BaselineOffset For Each word In line.Words ' Pages -> Paragraphs -> Lines -> Words Dim WordNumber As Integer = word.WordNumber Dim WordText As String = word.Text Dim WordImage As AnyBitmap = word.ToBitmap(ocrInput) Dim WordX_location As Integer = word.X Dim WordY_location As Integer = word.Y Dim WordWidth As Integer = word.Width Dim WordHeight As Integer = word.Height Dim WordOcrAccuracy As Double = word.Confidence For Each character In word.Characters ' Pages -> Paragraphs -> Lines -> Words -> Characters Dim CharacterNumber As Integer = character.CharacterNumber Dim CharacterText As String = character.Text Dim CharacterImage As AnyBitmap = character.ToBitmap(ocrInput) Dim CharacterX_location As Integer = character.X Dim CharacterY_location As Integer = character.Y Dim CharacterWidth As Integer = character.Width Dim CharacterHeight As Integer = character.Height Dim CharacterOcrAccuracy As Double = character.Confidence ' Output alternative symbols choices and their probability. ' Very useful for spellchecking Dim Choices() As OcrResult.Choice = character.Choices Next character Next word Next line Next paragraph Next page
IronOCR 使用 Tesseract 5 掃描每一頁,並傳回一個進階結果物件。 這包含位置資料、圖像、文字、統計置信度、替代符號、字體名稱、字號裝飾、字體粗細以及每個元素的位置:
探索如何使用 IronOCR 讀取 OCR 結果
如對產品或 License 有疑問,Iron Team 隨時為您提供支援。請將您的問題傳送給我們,我們將確保 Iron 有適當的人員為您解答。
可以向 IronOCR 發送一個或多個頁面。 您將因此收到所有的文字、Barcode 及 QR 內容。 將 OCR 功能加入 .NET Console、Web 或 Desktop Apps。圖片可以 PDF、JPG、PNG、GIF、BMP 和 TIFF 格式提交。
製作對象 VB.NET, .NET, C#
光學字元識別軟體以多種字體樣式檢視內容,以達到精確的文字 OCR。使用矩形讀取區域來提高速度和精確度。多核心多執行緒可提高 OCR 讀取速度。
IronOCR 真正與眾不同之處,在於它能夠讀取嚴重掃描的文件。 其獨特的預處理庫可減少背景雜訊、旋轉、扭曲和傾斜排列,並簡化顏色和增強解析度與對比度。Iron 的 AutoOCR 與進階 OCR 設定可為開發人員提供工具,讓他們每次都能達到最佳效果。
語言包可用於阿拉伯文、簡體中文、繁體中文、丹麥文、英文、芬蘭文、法文、德文、希伯來文、義大利文、日文、韓文、葡萄牙文、俄文、西班牙文和瑞典文。 其他語言可依需求支援。
IronOCR 以純文字和 BarCode 資料的形式輸出內容。 另一種結構化資料物件模型可讓開發人員以結構化標題、段落、行、字詞和字元的格式接收所有內容,以便直接輸入到 .NET 應用程式中。
免費社群開發授權。商業授權 749 美元起。
C# Tesseract OCR
Jim 一直是 IronOCR 開發的領導人物。 Jim 設計並建立 OCR 的影像處理演算法與讀取方法。
C# OCR ASP.NET
瞭解 Gemma 的團隊如何使用 IronOCR 來為他們的歸檔軟體讀取影像中的文字。Gemma 分享她自己的程式碼範例。
Iron 的團隊在 .NET 軟體元件市場擁有超過 10 年的經驗。
直接與我們的開發團隊交談
以簡明的英文撰寫清晰的線上手冊。
免費開發授權。商業版 749 美元起。
使用 NuGet 或 DLL 只需數分鐘即可上手。
無需信用卡
試用表單已提交成功。您的試用密鑰應該在電子郵件裡。如果沒有,請聯繫support@ironsoftware.com
您的試用密鑰應該在電子郵件裡。如果沒有,請聯繫support@ironsoftware.com
在生產環境中測試而不帶水印。適用於您所需的任何地方。
獲得 30 天完整功能產品。幾分鐘內即可運行。
在您的產品試用期間全面訪問我們的支持技術團隊
產品與其關鍵功能的即時展示
獲取項目特定的功能建議
我們會回答您所有的問題,以確保您掌握所有需要的資訊。(絕無承諾)。
請檢查您的電子郵件以取得試用授權金鑰。
如果您沒有收到電子郵件,請啟動 support@ironsoftware.com
預約無需承諾的諮詢
完成以下表單或發送電子郵件至 sales@ironsoftware.com
您的詳細信息將始終保密。
預訂 30 分鐘的個人演示。
無須合約、無須卡號、無任何長期綁約。
版權所有 © Iron Software 2013-2025