Swahili OCR in C# and .NET
이 문서의 다른 버전
IronOCR은 .NET 개발자가 스와힐리어 등 126개 언어로 된 이미지와 PDF 문서에서 텍스트를 읽을 수 있도록 해주는 C# 소프트웨어 구성 요소입니다. 이는 .NET 개발자 전용으로 제작된 Tesseract의 고급 포크 버전으로, 속도와 정확도 면에서 다른 Tesseract 엔진보다 뛰어난 성능을 보여줍니다.
IronOcr의 내용.언어.스와힐리어
이 패키지에는 .NET용 OCR 언어 46개가 포함되어 있습니다.
- 스와힐리어
- 스와힐리어 베스트
- 스와힐리패스트
다운로드
스와힐리어 언어 팩 [키스와힐리어]
설치
먼저 스와힐리어 OCR 패키지를 .NET 프로젝트에 설치해야 합니다.
Install-Package IronOcr.Languages.Swahili
코드 예제
이 C# 코드 예제는 이미지 또는 PDF 문서에서 스와힐리어 텍스트를 읽습니다.
using IronOcr;
var Ocr = new IronTesseract();
// Set the OCR language to Swahili
Ocr.Language = OcrLanguage.Swahili;
// Create an OCR input for the image or PDF file
using (var Input = new OcrInput(@"images\Swahili.png"))
{
// Perform OCR on the input image
var Result = Ocr.Read(Input);
// Retrieve the recognized text
var AllText = Result.Text;
// Output the recognized text to the console (optional)
Console.WriteLine(AllText);
}
using IronOcr;
var Ocr = new IronTesseract();
// Set the OCR language to Swahili
Ocr.Language = OcrLanguage.Swahili;
// Create an OCR input for the image or PDF file
using (var Input = new OcrInput(@"images\Swahili.png"))
{
// Perform OCR on the input image
var Result = Ocr.Read(Input);
// Retrieve the recognized text
var AllText = Result.Text;
// Output the recognized text to the console (optional)
Console.WriteLine(AllText);
}
Imports IronOcr
Private Ocr = New IronTesseract()
' Set the OCR language to Swahili
Ocr.Language = OcrLanguage.Swahili
' Create an OCR input for the image or PDF file
Using Input = New OcrInput("images\Swahili.png")
' Perform OCR on the input image
Dim Result = Ocr.Read(Input)
' Retrieve the recognized text
Dim AllText = Result.Text
' Output the recognized text to the console (optional)
Console.WriteLine(AllText)
End Using
설명:
-
IronOcr 네임스페이스 사용: 우리는 OCR 작업을 위한 클래스와 메서드를 제공하는
IronOcr네임스페이스를 포함합니다. -
OCR 엔진 초기화: 우리는 OCR 엔진인
IronTesseract의 인스턴스를 생성합니다. 해당 언어를 스와힐리로 설정하면 스와힐리 텍스트를 인식할 수 있습니다. -
OCR 입력: 텍스트를 추출하고자 하는 파일(이미지 또는 PDF)을 지정하기 위해
OcrInput클래스를 사용합니다. -
OCR 읽기:
Read메서드는 입력을 처리하고 인식된 텍스트를 포함하는OcrResult객체를 반환합니다. - 출력: 인식된 텍스트는 필요에 따라 사용할 수 있는
AllText에 저장됩니다. 이 예시에서는 설명 목적으로 콘솔에 출력됩니다.

