跳至頁尾內容
OCR 工具

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

在今天的數位環境中,光學文字識別(OCR)技術已成為企業必不可少的工具,以便在從影像、PDF和其他文件中高效提取文字。 在眾多OCR解決方案中,Microsoft Azure OCR、Google OCR和IronOCR脫穎而出,成為領先的競爭者,各自提供獨特的功能和能力。 在本文中,我們將討論這些OCR服務及其功能,以及應選擇哪一個。

1. OCR服務介紹

OCR服務是一個基於雲端的平台,利用先進的機器學習算法從影像和文件中提取文字。 Azure OCR、Google OCR和IronOCR 是廣泛使用的OCR服務,各自在不同的應用中具有優勢。

2. Azure OCR

Azure OCR工具作為Microsoft Azure Cognitive Services套件的一部分,為文字識別任務提供可靠且可擴展的解決方案。 它支持各種語言和文件格式,適用於多種不同的使用情境。 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;
using System.Threading.Tasks;

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;
using System.Threading.Tasks;

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
Imports System.Threading.Tasks

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
$vbLabelText   $csharpLabel

2.2.1 輸出

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

3. Google OCR

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

3.1 Google OCR的主要特點

  • 多語言支持:Google OCR支持超過200種語言,並且能識別多種文字體系,包括拉丁文、西里爾文和漢字。
  • 影像分析:它提供先進的影像分析能力,如標籤檢測、人臉檢測和地標識別。
  • 與Google Cloud Services整合:Google OCR能夠無縫整合其他Google Cloud vision API服務,使開發者能夠構建完善的文件管理和分析解決方案。

3.2 程式碼範例(C#)

using System;
using Google.Cloud.Vision.V1;

class Program
{
    static void Main(string[] args)
    {
        // Configure the ImageAnnotator client with credentials
        var clientBuilder = new ImageAnnotatorClientBuilder { CredentialsPath = "path-to-credentials.json" };
        var client = clientBuilder.Build();

        // Load the image from file
        var image = Image.FromFile("path-to-your-image.jpg");

        // Perform text detection on the image
        var response = client.DetectText(image);

        // Display the detected text
        foreach (var annotation in response)
        {
            Console.WriteLine(annotation.Description);
        }
    }
}
using System;
using Google.Cloud.Vision.V1;

class Program
{
    static void Main(string[] args)
    {
        // Configure the ImageAnnotator client with credentials
        var clientBuilder = new ImageAnnotatorClientBuilder { CredentialsPath = "path-to-credentials.json" };
        var client = clientBuilder.Build();

        // Load the image from file
        var image = Image.FromFile("path-to-your-image.jpg");

        // Perform text detection on the image
        var response = client.DetectText(image);

        // Display the detected text
        foreach (var annotation in response)
        {
            Console.WriteLine(annotation.Description);
        }
    }
}
Imports System
Imports Google.Cloud.Vision.V1

Friend Class Program
	Shared Sub Main(ByVal args() As String)
		' Configure the ImageAnnotator client with credentials
		Dim clientBuilder = New ImageAnnotatorClientBuilder With {.CredentialsPath = "path-to-credentials.json"}
		Dim client = clientBuilder.Build()

		' Load the image from file
		Dim image As System.Drawing.Image = System.Drawing.Image.FromFile("path-to-your-image.jpg")

		' Perform text detection on the image
		Dim response = client.DetectText(image)

		' Display the detected text
		For Each annotation In response
			Console.WriteLine(annotation.Description)
		Next annotation
	End Sub
End Class
$vbLabelText   $csharpLabel

3.2.1 輸出

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

4. IronOCR

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

4.1 IronOCR的主要特點

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

4.2 安裝IronOCR

IronOCR可以使用NuGet Package Manager Console來安裝。 只需運行以下命令。

  1. 打開Visual Studio並建立新專案或打開現有專案。
  2. 在工具列中,轉到工具並選擇NuGet Package Manager。

Azure OCR與Google OCR(OCR功能比較):圖3 - 在哪裡找到Visual Studio NuGet package manager

  1. 現在,從新出現的列表中選擇Package Manager Console。
  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
            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
            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 With {.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
$vbLabelText   $csharpLabel

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解決方案提供基於雲的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 文件頁面以便開始改變您處理影像的方式。

Kannaopat Udonpant
軟體工程師
在成為軟體工程師之前,Kannapat在日本北海道大學完成了環境資源博士學位。在攻讀學位期間,Kannapat還成為車輛機器人實驗室的一員,該實驗室隸屬於生產工程系。在2022年,他憑藉C#技能加入了Iron Software的工程團隊,專注於IronPDF。Kannapat珍視他的工作,因為他能直接向撰寫大部分IronPDF程式碼的開發者學習。除了同儕學習,Kannapat還喜歡在Iron Software工作的社交方面。不寫程式碼或文件時,Kannapat通常在他的PS5上玩遊戲或重看The Last of Us。

Iron 支援團隊

我們線上24小時,每週5天。
聊天
電子郵件
給我打電話