跳過到頁腳內容
OCR 工具

Microsoft OCR 工具(C# 替代方案)

光學字符識別(OCR)是各種規模企業的關鍵技術。 它能有效掃描、存儲和分析數據,否則這將是一個耗時且復雜的工作。

Microsoft的OCR工具提供強大的選擇來簡化您的數字化轉型過程。 這些工具允許更快且更有效的文件處理,讓您專注於拓展業務的重要任務上。 在本文中,我們將探討如何利用強大的Microsoft OCR工具來簡化您的操作。

OneNote:Microsoft工具

如果您需要從圖像中提取文本,Microsoft OneNote是個有用的工具。 OneNote是一個多功能的筆記應用程序,可以捕捉、存儲並組織各種形式的信息,如文本、圖片、音頻和視頻。 它也是從圖片或文件打印件中複製文本的有價值工具,讓您無需手動打字而節省時間和精力。

使用OneNote提取文本

要使用OneNote從圖像中提取文本,請按照以下步驟操作:

  1. 啟動OneNote應用程式。
  2. 使用“插入”選項插入圖像文件,或直接拖放圖像文件到OneNote窗口。

    class="content-img-align-center"> OneNote插入功能區

    class="content__image-caption">OneNote插入功能區

  3. 右鍵單擊圖像,從菜單中選擇“從圖片複製文本”。

    class="content-img-align-center"> 從右鍵單擊菜單複製文本

    class="content__image-caption">從右鍵單擊菜單複製文本

  4. 最後,將複製的文本粘貼到任何希望的位置以訪問從掃描圖像中提取的文本。

    class="content-img-align-center"> 從圖像複製文本來源的文本

    class="content__image-caption">從圖像複製文本來源的文本

這就是如何使用OneNote掃描任意圖像。

Microsoft Vision Studio

Microsoft認知服務提供一項“從圖像提取文本”的功能,用於利用AI掃描圖像並準確識別文本。 這項服務易於使用,僅需上傳圖像或PDF文件即可。然後信息將被轉錄成高精度,以確保提取的文本準確反映圖像或PDF文件的內容。

此外,提取的文本可以是多種語言,這使得服務向全球用戶開放。 有了Microsoft認知服務的“從圖像提取文本”功能,從圖像中提取有價值的數據變得簡單並能夠高效分析和有效完成任務。

使用Microsoft Vision Studio提取文本

要使用“從圖像提取文本”功能,您可以訪問Microsoft Azure的Vision Studio網站。 但是,此服務需要訂閱Azure。 一旦購買了訂閱,您將可訪問從掃描文檔中提取的文本。 以下是用於參考的示例輸出圖片。

class="content-img-align-center"> 掃描其文本的圖像

class="content__image-caption">掃描其文本的圖像

A9T9 Microsoft免費OCR軟件

A9T9免費OCR軟件是一款多功能的工具,使Windows用戶能夠輕鬆地將紙質文檔轉換為數字文本。 其簡單的拖放功能允許即時識別多種語言的文本,包括英語、德語、漢語、韓語和印度語。 這款軟件可從掃描圖像或PDF文件中提取數據,並將其轉換為可編輯、可搜尋的格式。

這款軟件支持多種輸出格式,如富文本、TXT或CSV,還有圖像格式如BMP、TIF或PDF。 它還具有自動文件去角度功能。 這款軟件在識別各種語言的圖像文本中速度快且準確,即便是背景透明的。 A9T9的高準確率、經濟實惠及易於安裝,使之成為Windows用戶尋找免費OCR軟件解決方案的首選。

使用A9T9複製文本

您可以從Microsoft Store下載A9T9軟件。 安裝後,打開A9T9軟件並上傳圖像或PDF文件。

class="content-img-align-center"> 掃描其文本的圖像

class="content__image-caption">使用A9T9複製文本

一旦圖像或文檔加載,點擊“開始 OCR”按鈕。 這將從掃描文檔或圖像中提取文本並將其顯示在右側的文本區域中。

class="content-img-align-center"> 文本顯示在右側

class="content__image-caption">文本顯示在右側

您可以選擇OCR語言,可以複製文本或保存為Word文檔。

Office Lens

Office Lens是一款專為捕捉和整理筆記、白板、菜單、標誌及其他類型書面或視覺信息而設計的精密工具。 這款應用提供了一個優於傳統筆記的選擇,避免了手寫筆記和丟失重要信息的可能性。

Office Lens允許用戶輕鬆捕捉草圖、手寫筆記、圖畫和方程式,並糾正圖像的影子和傾斜角度以改善可讀性。 它還具備OCR(光學字符識別)功能,使用戶可以數字化和編輯圖像中的文本。

不幸的是,Microsoft已停止Windows版本的Office Lens。 現在僅在移動設備上可用。 此外,Microsoft Office文檔成像在Microsoft Word 2010中被移除。

IronOCR: C# OCR 函式庫

IronOCR是一款為.NET開發者提供的強大OCR庫。 它能夠在掃描文檔和圖像上實現完整的OCR功能,讓開發人員能夠自動化文檔工作流。 借助其簡單的API和最少的配置,IronOCR很容易集成到現有系統中。

這個庫提供了一個簡單的API,易於以最少的配置集成到現有系統中。 它支持廣泛的輸入文件格式,包括JPEG、TIFF、GIF、BMP、PDF、多頁TIFF及多個文檔掃描,並能從不同方向的圖像中讀取文本。

IronOCR的高級功能包括噪音去除,有助於減少圖像失真並提高文本提取結果的準確性。 該庫支持超過125種語言,包括英語、法語、德語、西班牙語和日語,適用於幾乎任何需要高質量OCR結果而不需手動干預的應用程序。

使用IronOCR提取文本

讓您能輕鬆從PDF文件中提取文本,可以指定具體頁碼或從文件的所有頁面提取文本。 使用合適的工具可以簡化且提高過程的效率。

using IronOcr;
using System;

var ocrTesseract = new IronTesseract();

using (var ocrInput = new OcrInput())
{
    // Add the entire PDF for OCR processing
    ocrInput.AddPdf("example.pdf");

    // Alternatively, OCR selected page numbers from a password-protected PDF
    ocrInput.AddPdfPages("example.pdf", new [] { 1, 2, 3 }, "password");

    // Perform OCR and get the result
    var ocrResult = ocrTesseract.Read(ocrInput);

    // Output the extracted text
    Console.WriteLine(ocrResult.Text);
}
using IronOcr;
using System;

var ocrTesseract = new IronTesseract();

using (var ocrInput = new OcrInput())
{
    // Add the entire PDF for OCR processing
    ocrInput.AddPdf("example.pdf");

    // Alternatively, OCR selected page numbers from a password-protected PDF
    ocrInput.AddPdfPages("example.pdf", new [] { 1, 2, 3 }, "password");

    // Perform OCR and get the result
    var ocrResult = ocrTesseract.Read(ocrInput);

    // Output the extracted text
    Console.WriteLine(ocrResult.Text);
}
Imports IronOcr
Imports System

Private ocrTesseract = New IronTesseract()

Using ocrInput As New OcrInput()
	' Add the entire PDF for OCR processing
	ocrInput.AddPdf("example.pdf")

	' Alternatively, OCR selected page numbers from a password-protected PDF
	ocrInput.AddPdfPages("example.pdf", { 1, 2, 3 }, "password")

	' Perform OCR and get the result
	Dim ocrResult = ocrTesseract.Read(ocrInput)

	' Output the extracted text
	Console.WriteLine(ocrResult.Text)
End Using
$vbLabelText   $csharpLabel

這是輸出:

class="content-img-align-center"> Visual Studio調試控制台的輸出

class="content__image-caption">Visual Studio調試控制台的輸出

您還可以在從PDF文件提取文本的同時輕鬆讀取條碼。 該庫提供了一個簡單的代碼實現來讀取條碼,使其成為各種以文檔為基礎的工作流的多功能工具。 請參考以下代碼:

using IronOcr;
using System;

var ocrTesseract = new IronTesseract();
ocrTesseract.Configuration.ReadBarCodes = true;

// Read barcodes from an image file
using (var ocrInput = new OcrInput(@"images\imageWithBarcode.png"))
{
    var ocrResult = ocrTesseract.Read(ocrInput);

    // Iterate through the detected barcodes and print their values
    foreach (var barcode in ocrResult.Barcodes)
    {
        Console.WriteLine(barcode.Value);
    }
}
using IronOcr;
using System;

var ocrTesseract = new IronTesseract();
ocrTesseract.Configuration.ReadBarCodes = true;

// Read barcodes from an image file
using (var ocrInput = new OcrInput(@"images\imageWithBarcode.png"))
{
    var ocrResult = ocrTesseract.Read(ocrInput);

    // Iterate through the detected barcodes and print their values
    foreach (var barcode in ocrResult.Barcodes)
    {
        Console.WriteLine(barcode.Value);
    }
}
Imports IronOcr
Imports System

Private ocrTesseract = New IronTesseract()
ocrTesseract.Configuration.ReadBarCodes = True

' Read barcodes from an image file
Using ocrInput As New OcrInput("images\imageWithBarcode.png")
	Dim ocrResult = ocrTesseract.Read(ocrInput)

	' Iterate through the detected barcodes and print their values
	For Each barcode In ocrResult.Barcodes
		Console.WriteLine(barcode.Value)
	Next barcode
End Using
$vbLabelText   $csharpLabel
class="content-img-align-center"> 代碼的輸入/輸出

class="content__image-caption">代碼的輸入/輸出

IronOCR能夠通過在處理前增強降低DPI和噪聲的圖像來支持這些圖像。

using IronOcr;
using System;

var ocrTesseract = new IronTesseract();

// Process a noisy image by deskewing and denoising it
using (var ocrInput = new OcrInput(@"images\image.png"))
{
    ocrInput.Deskew(); // Corrects for skewness in the image
    ocrInput.DeNoise(); // Reduces visual noise for better recognition

    // Perform OCR and print the text
    var ocrResult = ocrTesseract.Read(ocrInput);
    Console.WriteLine(ocrResult.Text);
}
using IronOcr;
using System;

var ocrTesseract = new IronTesseract();

// Process a noisy image by deskewing and denoising it
using (var ocrInput = new OcrInput(@"images\image.png"))
{
    ocrInput.Deskew(); // Corrects for skewness in the image
    ocrInput.DeNoise(); // Reduces visual noise for better recognition

    // Perform OCR and print the text
    var ocrResult = ocrTesseract.Read(ocrInput);
    Console.WriteLine(ocrResult.Text);
}
Imports IronOcr
Imports System

Private ocrTesseract = New IronTesseract()

' Process a noisy image by deskewing and denoising it
Using ocrInput As New OcrInput("images\image.png")
	ocrInput.Deskew() ' Corrects for skewness in the image
	ocrInput.DeNoise() ' Reduces visual noise for better recognition

	' Perform OCR and print the text
	Dim ocrResult = ocrTesseract.Read(ocrInput)
	Console.WriteLine(ocrResult.Text)
End Using
$vbLabelText   $csharpLabel

結論

總之,光學字符識別(OCR)是一種對各種規模的企業大有裨益的工具,能夠有效掃描、存儲和處理信息,否則這會是一種複雜且耗時的手工管理工作。 Microsoft提供多種OCR工具,包括OneNote、Microsoft Vision Studio和A9T9免費OCR軟件,可以簡化過程並節省時間。

IronOCR是一個功能齊全的OCR庫,是現有OCR工具中的佼佼者。 它易於與C#和VB.NET應用整合,提供優秀的精度及對多種語言和圖像格式的識別功能,並具有免費試用期,許可證成本從$799開始。 IronOCR是希望提升數字化轉型的企業的有價值投資。 這些OCR工具中的每一個都提供獨特的功能且能滿足不同需求,使其成為希望改進數字化轉型的企業的寶貴資產。

Kannaopat Udonpant
軟體工程師
在成為软件工程師之前,Kannapat 從日本北海道大學完成了環境資源博士學位。在追逐學位期间,Kannapat 還成為了生產工程系一部份——汽車机器人实验室的成員。2022 年,他利用他的 C# 技能加入 Iron Software 的工程團隊, 專注於 IronPDF。Kannapat 珍惜他的工作,因为他直接向编写大部分 IronPDF 使用的代码的开发者学习。除了同行学习,Kannapat 还喜欢在 Iron Software 工作的社交十环。当他不编写代码或文档时,Kannapat 通常在他的 PS5 上打游戏或重看《The Last of Us》。