跳過到頁腳內容
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

作為 Microsoft Azure 認知服務套件的一部分, Azure OCR工具為文字辨識任務提供了可靠且可擴展的解決方案。 它支援多種語言和文件格式,因此適用於各種不同的使用場景。 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 Cloud 服務提供者的一部分, Google OCR提供了一個強大的文字辨識和文件分析平台。 它利用Google先進的機器學習演算法,提供精確的文字擷取功能,並透過雲端運算提供影像標註和目標偵測等附加功能。 Google 雲端平台 OCR 被廣泛應用於各個行業,用於發票處理、表單識別和內容數位化等任務。

3.1 Google OCR 的主要功能

-多語言支援: Google OCR 支援 200 多種語言,可以辨識多種文字,包括拉丁文、西里爾文和漢字。 -影像分析:它提供高級影像分析功能,例如標籤偵測、臉部偵測和地標辨識。 -與 Google Cloud 服務整合: Google OCR 與其他 Google Cloud 視覺 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由 Iron Software 開發,是一款功能全面的 .NET 應用程式 OCR 庫,提供業界領先的 OCR 準確性和效能。 與基於雲端的 OCR 服務不同,IronOCR 提供本機文字擷取功能,使其適用於需要資料隱私和安全的應用。 IronOCR 在準確性方面表現出色,尤其是在複雜佈局和雜訊影像的情況下,因此成為尋求可靠 OCR 功能的企業的首選。

4.1 IronOCR 的主要特點

-高精確度: IronOCR 在文字辨識方面具有卓越的精確度,可確保在各種文件類型和語言中獲得可靠的結果。 -本地 OCR:它提供本地文本提取功能,使企業能夠在本地處理敏感文檔,而無需依賴外部服務。 -多功能語言支援: IronOCR 支援超過 125 種語言,並提供全面的語言包,以實現無縫的多語言文字識別。

4.2 安裝 IronOCR

可以使用 NuGet 套件管理器控制台安裝 IronOCR。 只需運行以下命令。

  1. 開啟 Visual Studio 並建立一個新專案或開啟一個現有專案。
  2. 在工具列中,前往"工具"並選擇"NuGet 套件管理員"。

Azure OCR 與 Google OCR(OCR 功能比較):圖 3 - Visual Studio NuGet 套件管理器位置

  1. 現在從新出現的清單中選擇"套件管理器控制台"。
  2. 現在將出現控制台,執行以下命令,然後按回車鍵。
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》。