Layout File

  • 121 Views
  • Last Post 4 weeks ago
  • Topic Is Solved
PhilippWuelfing posted this 08 November 2017

Hello,

with Abbyy Corporate Edition you are able to load a image file and then define areas on it for the OCR.

You can save this layout into a layout file with the "blk" file extension.

 

It seems that there is no way to load this created layout file within the FineReader Engine API, is there?

Order By: Standard | Newest | Votes
Denis Gusak posted this 10 November 2017

Unfortunately, you cannot use .blk file in FRE.

But you can create a layout using FRE API, save it into a file and use it in other FRE applications (please, see Developer’s Help → API Reference → Layout-Related Objects → Layout). Also ImageViewer Visual Component is a good way to create a layout file via gui (see Developer’s Help → Visual Components Reference → ImageViewer)

PhilippWuelfing posted this 10 November 2017

Thank you for your answer.

I have tried the following to create the layout file via API as mentioned in the Developer's Help.

For example:

            Dim Region As FREngine.Region = Engine.CreateRegion()

            Region.AddRect(1974, 406, 2114, 442)

            Dim Block As FREngine.Block

            Block = abbLayout.AddBlock(FREngine.BlockTypeEnum.BT_Text, Region)

The coordinates of the rectangle i got from the AnalyzePage method.

It is from the first block of the analyzed Page.

There is a text "Seite 1" in it.

But nothing is recognized when calling the RecognizePage method.

 

 

 

 

 

 

PhilippWuelfing posted this 10 November 2017

Is the ImageViewer component included in the FineReader 10 Engine SDK?

PhilippWuelfing posted this 10 November 2017

But can you save the layout you created with ImageViewer?

In the sample it doesn't seem to be possible.

Denis Gusak posted this 4 weeks ago

First things first:

Did you defined type of block before recognition? I guess should use TextBlock.

 

About ImageViewer:

You should use Synchronizer object to sync document with ImageViewer. So your document layout will change according to changes in ImageViewer component. After that you can save the layout using the following code sample:

Document.Pages.Item(page_num).Layout.SaveToFile(path);

I would also recommend you to check our ImageComponents demo to better understand how to work with visual components.

To load the layout please use the following code:

Document.Pages.Item(page_num).Layout.LoadFromFile(path); 
Document.Pages.Item(page_num).Synthesize(null);

PhilippWuelfing posted this 4 weeks ago

First things first:

Did you defined type of block before recognition? I guess should use TextBlock.

 

I did as you can see above.

  Block = abbLayout.AddBlock(FREngine.BlockTypeEnum.BT_Text, Region)

 

Meanwhile I solved the problem: setting TextLanguage of RecognizerParams for the Textblock.

Before I only passed the RecognizerParams to the FRDocument.Recognize() method.

 

            Dim RP As FREngine.RecognizerParams = Engine.CreateRecognizerParams

            RP.TextLanguage = Engine.PredefinedLanguages.FindLanguage("German").TextLanguage

 

            Dim Textblock As FREngine.ITextBlock = Block.GetAsTextBlock

            Textblock.RecognizerParams = RP

 

 

 

Close