Afrikaans OCR in C# and .NET
Other versions of this document:
IronOCR is a C# software component allowing .NET coders to read text from images and PDF documents in 126 languages, including Afrikaans.
It is an advanced fork of Tesseract, built exclusively for .NET developers and regularly outperforms other Tesseract engines for both speed and accuracy.
Contents of IronOcr.Languages.Afrikaans
This package contains 52 OCR languages for .NET:
- Afrikaans
- AfrikaansBest
- AfrikaansFast
Download
Afrikaans Language Pack [Afrikaans]
Installation
The first thing we have to do is install our Afrikaans OCR package to your .NET project.
Install-Package IronOCR.Languages.Afrikaans
Code Example
This C# code example reads Afrikaans text from an Image or PDF document.
// First, ensure the IronOcr.Languages.Afrikaans package is installed in your project.
// This example requires the IronOcr C# package to read text from images or PDFs.
using IronOcr;
var Ocr = new IronTesseract(); // Initialize the IronTesseract class
Ocr.Language = OcrLanguage.Afrikaans; // Set the language to Afrikaans
// Load the image or PDF document into an OcrInput object
using (var Input = new OcrInput(@"images\Afrikaans.png"))
{
// Perform OCR on the input document
var Result = Ocr.Read(Input);
// Retrieve the complete recognized text
var AllText = Result.Text;
// Output the recognized text (this step is customizable for your use-case)
Console.WriteLine(AllText);
}
// First, ensure the IronOcr.Languages.Afrikaans package is installed in your project.
// This example requires the IronOcr C# package to read text from images or PDFs.
using IronOcr;
var Ocr = new IronTesseract(); // Initialize the IronTesseract class
Ocr.Language = OcrLanguage.Afrikaans; // Set the language to Afrikaans
// Load the image or PDF document into an OcrInput object
using (var Input = new OcrInput(@"images\Afrikaans.png"))
{
// Perform OCR on the input document
var Result = Ocr.Read(Input);
// Retrieve the complete recognized text
var AllText = Result.Text;
// Output the recognized text (this step is customizable for your use-case)
Console.WriteLine(AllText);
}
' First, ensure the IronOcr.Languages.Afrikaans package is installed in your project.
' This example requires the IronOcr C# package to read text from images or PDFs.
Imports IronOcr
Private Ocr = New IronTesseract() ' Initialize the IronTesseract class
Ocr.Language = OcrLanguage.Afrikaans ' Set the language to Afrikaans
' Load the image or PDF document into an OcrInput object
Using Input = New OcrInput("images\Afrikaans.png")
' Perform OCR on the input document
Dim Result = Ocr.Read(Input)
' Retrieve the complete recognized text
Dim AllText = Result.Text
' Output the recognized text (this step is customizable for your use-case)
Console.WriteLine(AllText)
End Using
Explanation:
- IronTesseract: This class is part of the IronOCR library and is used for setting up the OCR process.
- OcrLanguage: This property sets the language for OCR. Here it's set to Afrikaans.
- OcrInput: This class encapsulates the input file for the OCR process. It supports various image formats and PDF files.
- Ocr.Read(): This method executes the OCR process and returns the recognized text wrapped in a result object.
- Result.Text: This property contains the text extracted from the input document.