Layout File Answered

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?

Was this article helpful?

0 out of 0 found this helpful

Comments

6 comments

  • Avatar
    Denis Gusak

    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)

    0
  • Avatar
    PhilippWuelfing

    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.

     

     

     

     

     

     

    0
  • Avatar
    PhilippWuelfing

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

    0
  • Avatar
    PhilippWuelfing

    But can you save the layout you created with ImageViewer?

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

    0
  • Avatar
    Denis Gusak

    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);
    0
  • Avatar
    PhilippWuelfing

    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

     

     

     

    0

Please sign in to leave a comment.