can't recognize handprinted image

  • 786 Views
  • Last Post 22 June 2015
bennetchang posted this 20 June 2015

I have tried to recognize handprinted img by FRengine but failed to get correct result. however cloud SDK works fine. I think the api call sequence is not correct. anyone who can check it is very appreciate.

code:

engineLoader.Engine.LoadPredefinedProfile("FieldLevelRecognition");
string imagePath = "f:\\icr\\7.jpg" ;

        FREngine.FRDocument frDocument = engineLoader.Engine.CreateFRDocumentFromImage( imagePath, null );

        // Create a Layout object
        FREngine.Layout layout = engineLoader.Engine.CreateLayout();

        // Set block region
        FREngine.Region region = engineLoader.Engine.CreateRegion();
        region.AddRect( 0, 0, 100, 48);

        // Create a new block
        FREngine.IBlock newBlock = layout.Blocks.AddNew( FREngine.BlockTypeEnum.BT_Text, region, 0 );
        FREngine.TextBlock textBlock = newBlock.GetAsTextBlock();
        // Specify the text type
        textBlock.RecognizerParams.TextTypes = (int)FREngine.TextTypeEnum.TT_Handprinted;
        // Specify the type of marking around the letters
        textBlock.RecognizerParams.FieldMarkingType = FREngine.FieldMarkingTypeEnum.FMT_SimpleText;

        textBlock.RecognizerParams.SetPredefinedTextLanguage("English");

                  frDocument.Recognize(null, null);

        // Save results to rtf with default parameters

        frDocument.Export("f:\\icr\\output.txt",
                          FREngine.FileExportFormatEnum.FEF_TextUnicodeDefaults, null );

Oksana Serdyuk posted this 22 June 2015

After you set the required parameters of the block, it is necessary to assign the configured layout to the IFRPage::Layout property of the corresponding page. For example, add the following line before the recognition process:

 // Assign the configured layout to the IFRPage::Layout property of the corresponding page. 
 frDocument.Pages.Item(0).Layout = layout;

Close