3
1

Hello, i need to recognize only specified region of the image file as i think this will speed up recognition process. I have Top, Left, Right, Bottom coordinates. How can i do that using FREngine10 API for c#?

asked 05 Nov '13, 12:21

Alexander%20Smirnov's gravatar image

Alexander Sm...
6317


To recognize only specified region you can create a Layout object and add blocks manually:

  1. Create a Layout object with the help of the CreateLayout method of the Engine object or obtain the Layout object, which corresponds to the page, via the IFRPage::Layout property.
  2. Create a Region object for the block using the IEngine::CreateRegion method and add rectangles to it using the IRegion::AddRect method.
  3. Create a block of required type and add it into the collection using the AddBlock method of the Layout object.
  4. Set the required parameters of the block (use the block properties object corresponding to the type of block).

C# sample:

// Create document and open image
FREngine.FRDocument document = engineLoader.Engine.CreateFRDocument();
document.AddImageFile( imagePath, null, null );

// Remove all the blocks from the collection
document.Pages[0].Layout.Blocks.RemoveAll();

// Create region and specify its coordinates
FREngine.Region region = engineLoader.Engine.CreateRegion(); 
region.AddRect(Right,Top,Left,Bottom);

// Add blocks of required type to the layout
document.Pages[0].Layout.AddBlock(FREngine.BlockTypeEnum.BT_Barcode, region);

// Set the required parameters of the block
FREngine.TextOrientation textOrientation = engineLoader.Engine.CreateTextOrientation(); 
textOrientation.RotationType = FREngine.RotationTypeEnum.RT_Counterclockwise; 
document.Pages[0].Layout.Blocks[0].GetAsBarcodeBlock().TextOrientation = textOrientation;

//Recognize document
document.Recognize( null, null );

For detailed information about these methods please refer to Developer’s Help.

link
This answer is marked "community wiki".

answered 05 Nov '13, 19:44

Julia%20Anikushina's gravatar image

Julia Anikus... ♦♦
3628

wikified 05 Nov '13, 19:44

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×36

Asked: 05 Nov '13, 12:21

Seen: 3,869 times

Last updated: 05 Nov '13, 19:44

© 2016 ABBYY. All rights Reserved. www.ABBYY.com | Privacy Policy | Legal