Hi, I try to recognize only one region on an image(actually many regions, but I simplified the code sample). Code below tries to remove all blocks from page before processing, adds block with defined coordinates and then performs processing. It writes to console a number of blocks on the first page before and after processing. I expect that after processing it outputs 1, but when I run the code, I get 1 and 22. So why do I get all blocks after processing instead of only one? I hope the question is clear.

var engineLoader = new FREngine.OutprocLoader();

var processControl = (FREngine.IHostProcessControl) engineLoader; processControl.SetClientProcessId(Process.GetCurrentProcess().Id);

var engine = engineLoader.GetEngineObjectEx("SWAT-XXXX-XXXX-XXXX-XXXX-XXXX", null, null, true);

var frDocument = engine.CreateFRDocument(); frDocument.AddImageFile(Environment.CurrentDirectory + @"/Images/Test.jpg");

// Remove all the blocks from the collection
var pages = frDocument.Pages; // Select the first page of your input pdf document var frPage = pages[0]; var layout = frPage.Layout; var blocks = layout.Blocks; blocks.DeleteAll();

var region = engine.CreateRegion();
region.AddRect(1423, 740, 2175, 867);

// Add blocks of required type to the layout var block = blocks.AddNew(BlockTypeEnum.BT_Text, region, 0); var recognizerParams = engine.CreateRecognizerParams(); recognizerParams.SetPredefinedTextLanguage("English");

// Set the required parameters of the block var textBlock = block.GetAsTextBlock(); textBlock.RecognizerParams = recognizerParams;

block.Name = "test";




Thanks in advance, Kirill

asked 03 Oct '14, 17:51

kirill's gravatar image


You are doing practically everything correct, except one moment: IFRDocument::Process method includes Preprocess, Analyze, Recognize and Synthesize methods calls. So in case your intend is to add block or blocks manually you do not need to call after adding blocks Analyze method included into IFRDocument::Process - while automatic analysis your blocks will be deleted.

So all that you need after adding blocks is to call IFRDocument::Recognize method.


answered 06 Oct '14, 12:05

Anastasiya%20Medvedeva's gravatar image

Anastasiya M... ♦♦

edited 06 Oct '14, 14:11

Your answer
toggle preview

Follow this question

By Email:

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



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



Asked: 03 Oct '14, 17:51

Seen: 1,860 times

Last updated: 06 Oct '14, 14:11

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