在實際環境中測試
在生產環境中測試無浮水印。
在任何需要的地方都能運作。
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
<p>IronOCR 支援 125 種國際語言。</p> <p>除了預設安裝的英語之外,還可以通過 NuGet 或從我們的網站下載添加到您的 .NET 項目的語言包。<a href="/csharp/ocr/languages/" target="_blank" rel="nofollow noopener noreferrer">語言頁面</a>.</p> <p>大多數語言都提供快速和標準版本。(推薦)及最佳品質。 更準確的可能會更慢。</p>
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
<p>IronOCR 使用 Tesseract 5 掃描每個頁面時,會返回一個進階的結果物件。 此包含每個項目的<strong>位置數據、圖像、文本、統計信心、替代符號選擇、字體名稱、字體大小裝飾、字體粗細和位置</strong>。</p> <ul> <li>頁面</li> <li>段落</li> <li>行文字</li> <li>Word</li> <li>個別字符</li> <li>和條碼</li> </ul>
無論是護照頁面、發票、銀行對帳單、郵件、名片或收據;光學字符識別 (OCR) 是一個基於模式識別、計算機視覺和機器學習的研究領域。公司在跨部門利用 OCR 提取文字,用於會計和金融系統、業務數位化、企業內容管理和數據報告系統。
除了建造其他 成功案例. IronOCR為Google Tesseract和Microsoft 2021 Azure Cognitive Services增值,搭配IronOCR——一個原生的C# OCR庫。
如果您正在尋找以99%的準確率轉換現實世界的圖片,請繼續閱讀,了解IronOCR如何讓您構建高效、準確、可擴展且接近人類的光學字符識別應用程式。
光學字符識別(OCR)被認為是一個已經解決的現象,因為不同的 API 對保護的信心巨大。然而,各種產品往往僵硬且不精確,在現實應用中失敗。同樣地,Tesseract OCR 僅適用於機器打印、高分辨率、完美的文本。
聽起來不錯?
只有現實世界中的文字並非總是完美打印和高解析度的手寫文字。相反,IronOCR 可以處理旋轉、傾斜、低解析度、背景噪音以及所有數位不完美的問題,包括從圖像文件中提取手寫文字。我們確保提供99.8% 到100%準確、可搜索的文檔,並支持跨平台,包括 Windows、Linux、macOS、Microsoft Azure、AWS 和 Docker - 這就是 C# 開發人員選擇的原因 IronOCR 超越(基本的)Tesseract OCR - 這完全是關於增加價值。
裝備自己最好的!
此外,IronOCR使您能夠迅速處理圖像文件。不止如此,IronOCR的API還具有以下功能:
從原生 .dll 或 exe 安裝轉換為單一真相來源 - 使用簡單的 C# API 開發單一、原生 .NET 元件庫,支持:
IronOCR API 的藝術不僅止於此,您可以繼續探索我們的技術優勢。 功能 進一步。我們通過開發可靠的解決方案,一步一步減少業務複雜性,以簡化文檔處理應用程式,並通過提供行業領先的功能來最大化業務收入。
我們的光學字符識別過程從自動圖像預處理開始,以增強圖像文件,提高提取響應速度。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 的工作效率,請從我們的免費版開始。 教程 文檔指南,帶您使用IronOCR。今天下載我們的NuGet包安裝程式,並使用免費試用密鑰進行探索,或者連繫我們的24/7個人支持。透過我們的終身授權來滿足您的需求。 授權, 不論你的團隊規模。
查看許可證C# Tesseract 光學字符識別
C# 光學字符識別 ASP.NET
Iron 團隊在 .NET 軟體元件市場有超過 10 年的經驗。