OCR 工具

Azure OCR 與 Google OCR(OCR 功能比較)

發佈 2024年4月3日
分享:

在當今的數位環境中,光學字符識別 (光學字符識別) 科技已成為企業提取圖像、PDF和其他文件中的文本時不可或缺的一部分。在眾多OCR解決方案的功能中,有Microsoft Azure OCR與Google OCR,以及 IronOCR 脫穎而出成為領先的競爭者,每個都提供獨特的功能和能力。在本文中,我們討論這些OCR服務、它們的功能以及如何選擇。

1. OCR 服務的介紹

OCR 服務是基於雲端的平台,利用先進的機器學習算法從圖片和文檔中提取文本。它們提供了一系列功能,包括多語言支持、佈局檢測和手寫識別。Azure OCR、Google OCR 和 IronOCR 是廣泛使用的 OCR 服務,每個都有各自的優勢和應用。

2. Azure OCR

Azure 光學字符識別 (光學字符識別) 該工具作為 Microsoft Azure 認知服務套件的一部分,為文本識別任務提供了可靠且可擴展的解決方案。它支持多種語言和文件格式,使其適合各種使用情景。Microsoft Azure OCR 利用深度學習模型實現高精準度的文本提取,幫助企業高效簡化文件處理流程。Azure 更像是一項計算機視覺服務。

2.1 Azure OCR 的主要功能

  • 語言支持:Microsoft Azure OCR 支持超過 70 種語言,包括阿拉伯語和中文等複雜的文字。
  • 文件格式:它可以處理各種文件格式,包括圖像、PDF 和掃描文件。
  • 可擴展性:Azure OCR 可以無縫擴展以處理大量的文字提取請求,使其適用於企業級應用程序。

2.2 範例程式碼 (C#)

using Microsoft.Azure.CognitiveServices.Vision.ComputerVision;
using Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models;
using System;
class Program
{
    static async Task Main(string [] args)
    {
        // Create an instance of the ComputerVisionClient
        ComputerVisionClient client = new ComputerVisionClient(new ApiKeyServiceClientCredentials("YOUR_API_KEY"))
        {
            Endpoint = "https://YOUR_REGION.api.cognitive.microsoft.com/"
        };
        // Specify the image URL
        string imageUrl = "https://example.com/image.jpg";
        // Perform OCR on the image
        OcrResult result = await client.RecognizePrintedTextAsync(true, imageUrl);
        // Display the extracted text
        foreach (var region in result.Regions)
        {
            foreach (var line in region.Lines)
            {
                foreach (var word in line.Words)
                {
                    Console.Write(word.Text + " ");
                }
                Console.WriteLine();
            }
        }
    }
}
using Microsoft.Azure.CognitiveServices.Vision.ComputerVision;
using Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models;
using System;
class Program
{
    static async Task Main(string [] args)
    {
        // Create an instance of the ComputerVisionClient
        ComputerVisionClient client = new ComputerVisionClient(new ApiKeyServiceClientCredentials("YOUR_API_KEY"))
        {
            Endpoint = "https://YOUR_REGION.api.cognitive.microsoft.com/"
        };
        // Specify the image URL
        string imageUrl = "https://example.com/image.jpg";
        // Perform OCR on the image
        OcrResult result = await client.RecognizePrintedTextAsync(true, imageUrl);
        // Display the extracted text
        foreach (var region in result.Regions)
        {
            foreach (var line in region.Lines)
            {
                foreach (var word in line.Words)
                {
                    Console.Write(word.Text + " ");
                }
                Console.WriteLine();
            }
        }
    }
}
Imports Microsoft.Azure.CognitiveServices.Vision.ComputerVision
Imports Microsoft.Azure.CognitiveServices.Vision.ComputerVision.Models
Imports System
Friend Class Program
	Shared Async Function Main(ByVal args() As String) As Task
		' Create an instance of the ComputerVisionClient
		Dim client As New ComputerVisionClient(New ApiKeyServiceClientCredentials("YOUR_API_KEY")) With {.Endpoint = "https://YOUR_REGION.api.cognitive.microsoft.com/"}
		' Specify the image URL
		Dim imageUrl As String = "https://example.com/image.jpg"
		' Perform OCR on the image
		Dim result As OcrResult = Await client.RecognizePrintedTextAsync(True, imageUrl)
		' Display the extracted text
		For Each region In result.Regions
			For Each line In region.Lines
				For Each word In line.Words
					Console.Write(word.Text & " ")
				Next word
				Console.WriteLine()
			Next line
		Next region
	End Function
End Class
VB   C#

2.2.1 輸出

Azure OCR 對比 Google OCR(OCR 功能比較):圖 1 - Azure OCR 程式碼的控制台輸出

3. Google OCR

Google OCR, 作為Google雲服務提供商的一部分,提供一個強大的文本識別和文件分析平台。利用Google先進的機器學習算法,它提供準確的文本提取功能,並通過雲計算提供圖像標註和對象檢測等附加功能。Google雲平台OCR廣泛應用於各行各業,如發票處理、表格識別和內容數字化等任務。

3.1 Google OCR 的主要功能

  • 多語言支援:Google OCR 支援超過200種語言,並且能辨識多種文字,包括拉丁字母、斯拉夫字母和漢字。
  • 影像分析:它提供先進的影像分析功能,如標籤檢測、人臉檢測和地標識別。
  • 與 Google Cloud 服務整合:Google OCR 無縫整合其他 Google 雲端視覺 API 服務,讓開發人員能夠為文件管理和分析構建全面的解決方案。

3.2 範例程式碼 (C#)

using Google.Cloud.Vision.V1;
using Google.Protobuf;
using System.IO;
using Google.Apis.Auth.OAuth2;
var clientBuilder = new ImageAnnotatorClientBuilder { CredentialsPath = "path-to-credentials.json" };
var client = clientBuilder.Build();
var image = Image.FromFile("path-to-your-image.jpg");
var response = client.DetectText(image);
foreach (var annotation in response)
{
    Console.WriteLine(annotation.Description);
}
using Google.Cloud.Vision.V1;
using Google.Protobuf;
using System.IO;
using Google.Apis.Auth.OAuth2;
var clientBuilder = new ImageAnnotatorClientBuilder { CredentialsPath = "path-to-credentials.json" };
var client = clientBuilder.Build();
var image = Image.FromFile("path-to-your-image.jpg");
var response = client.DetectText(image);
foreach (var annotation in response)
{
    Console.WriteLine(annotation.Description);
}
Imports Google.Cloud.Vision.V1
Imports Google.Protobuf
Imports System.IO
Imports Google.Apis.Auth.OAuth2
Private clientBuilder = New ImageAnnotatorClientBuilder With {.CredentialsPath = "path-to-credentials.json"}
Private client = clientBuilder.Build()
Private image = System.Drawing.Image.FromFile("path-to-your-image.jpg")
Private response = client.DetectText(image)
For Each annotation In response
	Console.WriteLine(annotation.Description)
Next annotation
VB   C#

3.2.1 輸出

Azure OCR與Google OCR(OCR功能比較):圖2 - Google OCR程式碼的控制台輸出

4. IronOCR

IronOCR由Iron Software開發,是一個多功能的OCR庫,適用於.NET應用程式,提供業界領先的OCR準確性和性能。與基於雲的OCR服務不同,IronOCR提供內部的文本提取功能,使其適用於需要數據隱私和安全性的應用程式。IronOCR在準確性方面表現出色,特別是在涉及複雜佈局、手寫文本和噪聲圖像的情況下,使其成為尋求可靠OCR功能的企業的首選。

4.1 IronOCR 主要特點

  • 高精準度:IronOCR 提供卓越的文字識別精準度,確保在各種文件類型和語言中提供可靠的結果。
  • 本地OCR:它提供本地文字提取功能,使企業能夠本地處理敏感文件,而無需依賴外部服務。
  • 多樣化語言支持:IronOCR 支持超過127種語言,並提供全面的語言包以實現流暢的多語種文字識別。

4.2 安裝IronPDF

IronOCR可以使用NuGet套件管理器來安裝,只需執行以下命令。

  1. 打開Visual Studio,並創建一個新專案或打開一個現有專案。

  2. 在工具欄中前往工具,然後選擇NuGet套件管理器。

Azure OCR vs Google OCR(OCR 功能比較):圖 3 - 在 Visual Studio 中找到 NuGet 套件管理員的地方

  1. 現在從新出現的列表中選擇套件管理器控制台。

  2. 現在控制台會出現,執行以下命令並按下 Enter 鍵。
Install-Package IronOcr

安裝 IronOCR 將需要一些時間,但一旦完成我們便可以開始進行編碼範例。

4.3 代碼範例 (C#)

using IronOcr;
using System;
class Program
{
    static void Main(string [] args)
    {
        // Specify the path to the image file
        string imagePath = "path-to-your-image.jpg";
        // Instantiate the IronTesseract OCR engine
        var ocr = new IronTesseract();
        // Set the language for text recognition
        ocr.Language = OcrLanguage.English;
        // Perform text recognition on the image
        var result = ocr.Read(imagePath);
        // Display the extracted text
        Console.WriteLine("Extracted Text:");
        Console.WriteLine(result.Text);
    }
}
using IronOcr;
using System;
class Program
{
    static void Main(string [] args)
    {
        // Specify the path to the image file
        string imagePath = "path-to-your-image.jpg";
        // Instantiate the IronTesseract OCR engine
        var ocr = new IronTesseract();
        // Set the language for text recognition
        ocr.Language = OcrLanguage.English;
        // Perform text recognition on the image
        var result = ocr.Read(imagePath);
        // Display the extracted text
        Console.WriteLine("Extracted Text:");
        Console.WriteLine(result.Text);
    }
}
Imports IronOcr
Imports System
Friend Class Program
	Shared Sub Main(ByVal args() As String)
		' Specify the path to the image file
		Dim imagePath As String = "path-to-your-image.jpg"
		' Instantiate the IronTesseract OCR engine
		Dim ocr = New IronTesseract()
		' Set the language for text recognition
		ocr.Language = OcrLanguage.English
		' Perform text recognition on the image
		Dim result = ocr.Read(imagePath)
		' Display the extracted text
		Console.WriteLine("Extracted Text:")
		Console.WriteLine(result.Text)
	End Sub
End Class
VB   C#

4.3.1 輸出

Azure OCR 與 Google OCR(OCR 功能比較):圖 4 - IronOCR 程式碼的主控台輸出

5 比較評估

5.1 準確性和性能

  • Microsoft Azure OCR 和 Google OCR 提供高準確度的文本提取,適用於各種應用場景。
  • IronOCR 在準確性方面表現出色,特別是在涉及複雜佈局、手寫文件和噪聲圖像的情況下。

5.2 易於整合

  • Microsoft Azure OCR 和 Google Cloud solutions OCR 提供基於雲端的 OCR 服務,為雲端應用程式和服務提供簡便的整合。
  • IronOCR 提供內部部署的 OCR 功能,並可與 .NET 應用程式無縫整合,具有直觀的 API 和豐富的文件說明。

5.3 可扩展性

  • Microsoft Azure OCR 和 Google OCR 无缝扩展以处理大量文本提取请求,使它们适用于企业级应用程序。
  • IronOCR 的可扩展性取决于应用程序的基础架构,因为它在本地操作。

6. 結論

在所有的OCR工具中,Azure OCR、Google Vision API 和 IronOCR 被認為是強大的光學字符識別(OCR)解決方案,提供高效能和準確的文本提取功能。儘管 Azure OCR 和 Google OCR 提供基於雲端的 OCR 服務,具有可擴展的基礎設施和廣泛的語言支持,但 IronOCR 以其卓越的準確性脫穎而出。

IronOCR 尤其適合需要本地文本提取和卓越準確性的應用。通過利用 IronOCR,企業可以精簡文件處理工作流程,提高資料提取的準確性,並從掃描的文件和圖像中獲取有價值的見解,成為首選的解決方案。

若要了解更多有關 IronOCR 及其服務,請訪問 IronOCR Documentation 頁面 授權,開始轉變您處理圖像的方式。

< 上一頁
Windows OCR 引擎與 Tesseract 的比較 (OCR 功能比較)
下一個 >
最佳免費 OCR 軟體(免費和付費工具比較)

準備開始了嗎? 版本: 2024.10 剛剛發布

免費 NuGet 下載 總下載次數: 2,433,305 查看許可證 >