Recognizing Pages with Multiple Text Orientations

To recognize pages that contain text with different orientations (like on image below), you can explicitly specify the text orientation and its coordinates.

orientations.PNG

To implement this:

  1. Create text blocks for the text in the image.
  2. Specify the text orientation using TextOrientation object.
  3. Call the Recognize method of the FRDocument object.

C# sample:

//add your image to the FRDocument
string imagePath = @"D:\SampleImages\orientations.png";
document.AddImageFile(imagePath, null, null);

//create regions that correspond to the text
FREngine.Region verticalRegion = engineLoader.Engine.CreateRegion();
verticalRegion.AddRect(88,110,128,245); //specify vertical text coordinates
FREngine.Region horizontalRegion = engineLoader.Engine.CreateRegion();
horizontalRegion.AddRect(90,354,252,390); //specify horizontal text coordinates

//add text blocks to document layout
document.Pages[0].Layout.AddBlock(FREngine.BlockTypeEnum.BT_Text, horizontalRegion);
document.Pages[0].Layout.AddBlock(FREngine.BlockTypeEnum.BT_Text, verticalRegion);

//specify orientation for vertical text
FREngine.TextOrientation textOrientation = engineLoader.Engine.CreateTextOrientation();
textOrientation.RotationType = FREngine.RotationTypeEnum.RT_Counterclockwise;
document.Pages[0].Layout.Blocks[1].GetAsTextBlock().TextOrientation = textOrientation;

//recognize, synthesize, export
document.Recognize();
document.Synthesize();
document.Export(@"D:\Results\exp.rtf", FREngine.FileExportFormatEnum.FEF_RTF, null);

 

To run this sample, you can insert the code above into the try block of the processImage method in C# Hello sample and specify the path to the attached image.

Was this article helpful?

1 out of 3 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.

Recently viewed