Hangul Alphabet OCR in C# and .NET
Curtis Chau
已更新: 2026年8月2日
IronOCR 是一個 C# 軟體元件,允許 .NET 程式設計師從圖像和 PDF 文件中讀取 126 種語言的文字,包括韓文字母。
它是 Tesseract 的一個高級分支,專為 .NET 開發人員構建,在速度和準確性方面通常優於其他 Tesseract 引擎。
IronOcr.Languages.Hangul 的內容
此軟體包包含 156 種適用於 .NET 的 OCR 語言:
- HangulAlphabet
- HangulAlphabetBest
- HangulAlphabetFast
- 韓文垂直字母
- 韓文垂直字母Best
- 韓文垂直字母Fast
下載
韓文字母語言包 [韓文字母]
安裝
第一步是將韓文字母OCR 套件安裝到您的 .NET 專案中。
程式碼範例
這段 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
Imports IronOcr
Module Program
Sub Main()
' Create a new instance of IronTesseract for performing OCR
Dim Ocr As 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 As 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 Module' Ensure the IronOCR library is installed
' PM> Install-Package IronOcr.Languages.Hangul
Imports IronOcr
Module Program
Sub Main()
' Create a new instance of IronTesseract for performing OCR
Dim Ocr As 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 As 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 Module說明:
- IronTesseract: 這是用來執行OCR操作的主要類別。
- OcrLanguage.Hangul: 這指定OCR引擎應使用Hangul語言包,這優化了引擎的韓文文本識別功能。
- OcrInput: 這是要處理的圖像或PDF的容器。
Ocr.Read(): 此方法執行OCR操作並返回包含識別文本的結果對象。
Curtis Chau 擁有卡爾頓大學計算機科學學士學位,專注於前端開發,擅長於 Node.js、TypeScript、JavaScript 和 React。Curtis 熱衷於創建直觀且美觀的用戶界面,喜歡使用現代框架並打造結構良好、視覺吸引人的手冊。