跳過到頁腳內容

開始使用 Azure 的 OCR

C# + VB.NET: 國際語言 國際語言
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
Install-Package IronOcr

IronOCR 語言支援

IronOCR 支援125種國際語言。 除了預設安裝的英語外,其他語言包可以通過NuGet添加到您的 .NET 專案中,或從我們的語言頁面下載。

大多數語言有快速、標準(推薦)和最佳品質可供選擇。 最佳品質選項可能提供更準確的結果,但處理時間也會較長。

探索使用 IronOCR 的多語言 OCR。

C# + VB.NET: 結果對象 結果對象
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
Install-Package IronOcr

IronOCR 為它使用 Tesseract 5 掃描的每個頁面返回一個先進的結果對象。 這包含位置數據、圖像、文本、統計置信度、替代符號選擇、字體名稱、字體大小裝飾、字體粗細和位置,每個項目如下:

  • 頁面
  • 段落
  • 文本行
  • 單詞
  • 個別字符
  • 條形碼

探索如何使用 IronOCR 讀取 OCR 結果

Human Support related to Azure OCR API

直接從我們的開發團隊獲得人性化支持

無論是產品、集成還是許可問題,Iron 產品開發團隊隨時支持您的所有問題。與 Iron 取得聯繫,開始對話,以便在項目中充分利用我們的庫。

提問
Image To Text related to Azure OCR API

Azure 上的 .NET OCR 讀取引擎

您的首選 Microsoft Azure OCR 解決方案來處理不完美的圖像

無論是護照頁面、發票、銀行對賬單、郵件、名片還是收據;光學字符識別 (OCR) 是一個基於模式識別、計算機視覺和機器學習的研究領域。公司利用 OCR 跨部門地從會計和金融系統、業務數字化、企業內容管理和數據報告系統中提取文本。

此外還構建其他成功案例。IronOCR 為 Google Tesseract 和 Microsoft 2021 Azure 認知服務增值,提供 IronOCR - 一個原生 C# OCR 庫。

如果您希望將真實的圖片轉換為 99% 的準確度,請繼續閱讀,看看 IronOCR 如何讓您構建一個高效、準確、可擴展、幾乎如人般的光學字符識別應用程序。

IronOCR 是市埸競爭與市埸領導光學字符識別之間的區別

光學字符識別 (OCR) 被認為是一種被解決的現象,由於不同的 API 在保護方面表現出巨大的信心。然而,許多產品通常僵硬且不準確,無法在現實世界中應用。同樣,Tesseract OCR 適用於機器打印、高清晰度、完美的文本。

聽起來不錯?

但真正的世界並不總是擁有完美印刷和書寫的高分辨率文本。相反,旋轉、扭曲、低 DPI、背景噪音和所有數字瑕疵的是由 IronOCR 處理,包括從圖像文件中提取手寫文本。我們能夠確保 99.8 - 100% 準確、可搜尋的文檔,支持多平台,包括 Windows、Linux、macOS、Microsoft Azure、AWS 和 Docker - 這就是為什麼 C# 開發者選擇IronOCR 而非(基礎)Tesseract OCR - 一切都是關於增值。

裝備最好的工具!

除了以上功能,IronOCR 還使您能夠迅速處理圖像文檔。如果這還不夠,IronOCR API 的功能還包括以下內容:

  • 通過 OCR 在幾乎任何文件、圖像或 PDF 上提取打印文本,具有卓越的準確度和超快速度
  • 將文本從 PDF 和圖片提取成搜索文件,具有完美的視覺和空間表現
  • 不需要 exes 或 C++ 代碼
  • 完整的 PDF OCR 支持
  • MVC、WebApp、Desktop、Console 及 Server 應用程序兼容
  • 完整的 .NET Core、Standard 和 FrameWork 支持
  • 使用 C# 及 VB .NET 進行讀取
  • 將 OCR 導出成 XHTML
  • 支持多線程處理
  • 支持 125 種國際語言 - 即用的語言包和自訂建構
  • 提取圖像、坐標、統計數據、字體等更多
  • 在商業和專有應用程序內重新分發 Tesseract OCR
  • 當地運行,無需 SaaS 支持
  • 微軟認知服務 OCR 服務的出色替代品

虛擬無限的功能 - IronOCR 是數字工作空間的光學字符識別(OCR)工具

從原生 .dll 或 exes 安裝轉變為單一的事實來源 —— 使用簡單的 C# API 開發一個原生 .NET 組件庫,支持:

  • .NET Framework 4.5 及更高版本
  • .NET Standard 2.0 及以上版本(包括 3.x 和 .NET 5 Beta)
  • .NET Core 2.0 及以上版本(包括 3.x 和 .NET 5 Beta)
  • .NET 5
  • 適用於 macOS 的 Xamarin

IronOCR API 的藝術不僅限於此;您可以繼續探索我們的技術優勢功能。我們通過開發可靠的解決方案來簡化文件處理應用程式,從而減少商業複雜性,並通過提供行業領先功能來最大化商業收入,已經嵌入:

  • 純 .NET OCR API 功能
  • 本地 OCR 運行,無雲意味著更多安全性
  • 創建優化低質量、噪音和變形的掃描資源
  • 讀取 PDFs、多頁面的 TIFFs
  • 可以將任何 OCR 掃描樣本保存為用戶可搜索的 PDF 文檔或 XHTML
  • 純文本,條形碼數據以及包含段落、行、單詞和字元的 OCR 結果類

IronOCR API Edge:實現計算機視覺?

我們的光學字符識別過程始於自動圖像預處理,以改善圖像文件,提高提取響應速度。IronOCR 為您的工作增值,因為它允許用戶將示例基礎圖像文件提取為最優版本。IronOCR 涵蓋所有基礎:

提高解析度

由於 IronOCR 服務在 300DPI(每英寸點數)的圖像文件上最佳運行,任何明顯超出 200-300 DPI 範圍的圖像將重新採樣以適合目標範圍。

這意味着將 600 DPI 圖像下採樣為 300 DPI 或將 100 DPI 圖像上採樣為 200 DPI,具有 99%的置信度。

二值化

由於 IronOCR 認知服務的設計是針對單色圖像運行的,因此任何彩色或灰度圖像將使用自適應二值化算法轉換為單色。

該算法比較區域內的像素密度,確定用於將像素轉換為單色的閾值。

自動旋轉和去扭曲

IronOCR 尋找文本行和字符模式,自動校正和旋轉輸入圖像資源至所需的方向。

自適應噪音移除

通過 IronOCR,圖像文件會自動分析噪聲的存在和數量。噪音基本上是掃描圖像上的“雜點”。我們的自適應算法然後根據噪音顆粒的大小移除噪音。

一旦樣本圖像文件被預處理,IronOCR 便將輸入圖像文件分解為不同的處理區域。

分區

另一個準備階段是將參考圖像分解為不同的邏輯區域。IronOCR 首先使用空白和模式在圖像中定位文本和圖片;文本區域與圖像分開。

然後將其分區為區段、列和文本塊。識別出來的圖像和剩餘的非文本像素在文本識別過程中被排除在外,並包括在智能輸出中。然後 IronOCR 使用網格線和文本塊將文本區域標識為表格。

文本識別能力

執行多個相互連接的步驟,將像素斑點轉換為用戶可搜索的單行文本。例如包含字符分割、自適應分類、字典參考和其他相關過程,這些過程促成了最佳提取文本。

經過驗證的多個參數

使用 IronOCR API 服務,我們通過多個數據文件範例在多種語言中對我們的工具進行了測試,包括單字級別、符號準確性和 Microsoft Office 格式中的佈局保留。雖然某些參數是自動測試的;其他包括視覺檢查。

連接 IronOCR - 理想的 OCR 認知服務解決方案

IronOCR 允許您跨平台添加 OCR 功能,使用多種輸入格式轉換為用户可搜索的純文本串。要提升生產力與 IronOCR,請通過我們的免費教程文檔開始使用,我們的教程將指引您使用 IronOCR。立即下載我們的 NuGet 包安裝程序,並通過免費試用密鑰探索或隨時連接 24/7 的個人支持。無論您的團隊規模如何,都可以使用我們的終身許可證來滿足您的需求。

兼容 .NET, VB.NET, C#

查看許可證
支持:
  • .NET Framework 4.0 及以上支持 C#、VB、F#
  • Microsoft Visual Studio. .NET 開發 IDE 圖標
  • NuGet 安装支持 Visual Studio
  • 兼容 JetBrains ReSharper C# 語言助手
  • 兼容 Microsoft Azure C# .NET 托管平台

授權與定價

免費 社區開發許可證。商業許可證從 $749 開始。

项目 C# + VB.NET 库许可

項目

開發者 C# + VB.NET 庫授權

開發者

組織 C# + VB.NET 庫授權

組織

代理 C# + VB.NET 庫授權

代理

SaaS C# + VB.NET 庫授權

SaaS

OEM C# + VB.NET 庫授權

OEM

查看完整的許可選項  

.NET 社群的 OCR 教學

.NET Tesseract 替代方案 | IronOCR

C# Tesseract OCR

Jim Baker 是 Iron 為 OCR 產品開發的開發工程師

IronOCR & Tesseract 在 .NET 中的比較

Jim 在 IronOCR 的開發中是一位領導人物。Jim 設計和構建影像處理算法及 OCR 的讀取方法。

查看比較
.NET 中的文本到圖像 | 教學

C# OCR ASP.NET

Gemma Beckford - 微軟解決方案工程師

.NET 的圖像文本

學習 Gemma 的團隊如何使用 IronOCR 從影像中讀取文本以用於他們的檔案存檔軟件。Gemma 分享了她自己的代碼樣本。

.NET 教程中的圖片到文本
數以千計的開發者使用 IronOcr 用於...

會計和財務系統

  • # 收據
  • # 報告
  • # 發票打印
向 ASP.NET 會計和財務系統添加 PDF 支持

商務數字化

  • # 文件
  • # 訂單和標籤
  • # 紙質替代
C# 商務數字化用例

企業內容管理

  • # 內容生產
  • # 文档管理
  • # 內容分發
.NET CMS PDF 支持

數據和報告應用

  • # 性能跟踪
  • # 趨勢映射
  • # 報告
C# PDF 報告
Iron Software 企業 .NET 組件開發者

數千個公司、政府、中小型企業和開發人員都信任 Iron 軟件產品。

Iron 的團隊有超過 10 年的 .NET 軟件組件市場經驗。

ANZ
GE
Foley
Equinor
Nexudus
Medcode
Marval
Vireq