使用 C# 和 .NET 實作韓文字母 OCR
This article was translated from English: Does it need improvement?
TranslatedView the article in English
IronOCR 是一個 C# 軟體元件,允許 .NET 程式設計師從圖像和 PDF 文件中讀取 126 種語言的文本,包括韓文字母。
它是 Tesseract 的一個高級分支,專為 .NET 開發人員構建,在速度和準確性方面通常優於其他 Tesseract 引擎。
IronOcr.Languages.Hangul 的內容
此軟體包包含 156 種適用於 .NET 的 OCR 語言:
韓文字母 韓文字母Best 韓文字母Fast
- 韓文垂直字母
- 韓文垂直字母Best
- 韓文垂直字母Fast
下載
韓文字母語言包 [韓文字母]
下載為Zip 檔案
- 使用NuGet安裝
安裝
第一步是將韓文字母OCR 套件安裝到您的 .NET 專案中。
Install-Package IronOCR.Languages.Hangul
程式碼範例
這段 C# 程式碼範例從圖像或 PDF 文件中讀取韓文字母文字。
// Ensure the IronOCR library is installed
// PM> Install-Package IronOcr.Languages.Hangul
using IronOcr;
class Program
{
static void Main()
{
// Create a new instance of IronTesseract for performing OCR
var Ocr = new IronTesseract();
// Specify the Hangul language pack for better accuracy with Korean texts
Ocr.Language = OcrLanguage.Hangul;
// Load the image or PDF you want to read
using (var Input = new OcrInput(@"images\Hangul.png"))
{
// Perform OCR to read the text from the image
var Result = Ocr.Read(Input);
// Extract the recognized text
var AllText = Result.Text;
// Output the text to the console
Console.WriteLine(AllText);
}
}
}// Ensure the IronOCR library is installed
// PM> Install-Package IronOcr.Languages.Hangul
using IronOcr;
class Program
{
static void Main()
{
// Create a new instance of IronTesseract for performing OCR
var Ocr = new IronTesseract();
// Specify the Hangul language pack for better accuracy with Korean texts
Ocr.Language = OcrLanguage.Hangul;
// Load the image or PDF you want to read
using (var Input = new OcrInput(@"images\Hangul.png"))
{
// Perform OCR to read the text from the image
var Result = Ocr.Read(Input);
// Extract the recognized text
var AllText = Result.Text;
// Output the text to the console
Console.WriteLine(AllText);
}
}
}' Ensure the IronOCR library is installed
' PM> Install-Package IronOcr.Languages.Hangul
Imports IronOcr
Friend Class Program
Shared Sub Main()
' Create a new instance of IronTesseract for performing OCR
Dim Ocr = New IronTesseract()
' Specify the Hangul language pack for better accuracy with Korean texts
Ocr.Language = OcrLanguage.Hangul
' Load the image or PDF you want to read
Using Input = New OcrInput("images\Hangul.png")
' Perform OCR to read the text from the image
Dim Result = Ocr.Read(Input)
' Extract the recognized text
Dim AllText = Result.Text
' Output the text to the console
Console.WriteLine(AllText)
End Using
End Sub
End Class$vbLabelText $csharpLabel
說明:
- IronTesseract :這是用於執行 OCR 操作的主要類別。
- OcrLanguage.Hangul :此設定指定 OCR 引擎應使用韓語語言包,該語言包針對韓語文字辨識優化了引擎。
- OcrInput :這是要處理的映像或 PDF 的容器。
- Ocr.Read() :此方法執行 OCR 操作並傳回包含辨識文字的結果物件。





