How to recognize handprinted Arabic digits

Question

How to recognize handprinted Arabic digits?

Answer

FineReader Engine does not currently support Arabic ICR. However, recognizing specifically Arabic digits is possible, and this article describes the necessary steps.

For Arabic digits' recognition, it is necessary to create a custom language with the alphabet consisting only of 10 digit symbols and set it as the recognition language for every block with digits.

Therefore, to recognize Arabic handprinted digits, do the following:

1. Create a new text language using the CreateTextLanguage method of the LanguageDatabase object.
2. Using the LetterSet property of the BaseLanguage object within the TextLanguage object, set the language alphabet containing the following characters: ٠١٢٣٤٥٦٧٨٩.
3. For each block containing handprinted Arabic digits, specify recognition parameters via the ITextBlock::RecognizerParams property:

  • Set the TextLanguage property of the RecognizerParams object to the language that is created in the previous step.
  • Set the TextTypes property of the RecognizerParams object to TT_Handprinted.
  • If the digits are enclosed in a frame, box, etc., set up the type of marking around the letters in the FieldMarkingType property of the RecognizerParams object. If each digit is written in a separate cell, use also the CellsCount property to set up the number of character cells in the block.

 

C# sample code:

// Global FineReader Engine object
FREngine.Engine engine;
...
// Open an image file
...

// Create a custom language
FREngine.LanguageDatabase languageDatabase = engine.CreateLanguageDatabase();
FREngine.TextLanguage textLanguage = languageDatabase.CreateTextLanguage();
FREngine.BaseLanguages baseLanguages = textLanguage.BaseLanguages;
FREngine.BaseLanguage baseLanguage = baseLanguages.AddNew();

// Set the alphabet
baseLanguage.set_LetterSet( FREngine.BaseLanguageLetterSetEnum.BLLS_Alphabet, "٠١٢٣٤٥٦٧٨٩" );

// Create a Layout object
FREngine.Layout layout = engine.CreateLayout();

// Set block region
FREngine.Region region = engine.CreateRegion();
region.AddRect( 491, 314, 2268, 404 );

// Create a new block
FREngine.IBlock newBlock = layout.Blocks.AddNew( FREngine.BlockTypeEnum.BT_Text, region, 0 );
FREngine.TextBlock textBlock = newBlock.GetAsTextBlock();
// Set the custom language
textBlock.RecognizerParams.TextLanguage = textLanguage;
// Specify the text type
textBlock.RecognizerParams.TextTypes = (int)FREngine.TextTypeEnum.TT_Handprinted;
// Specify the type of marking around the letters
textBlock.RecognizerParams.FieldMarkingType = FREngine.FieldMarkingTypeEnum.FMT_SimpleText;

// Recognition and export
...

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.