I am using ABBYY FRE 11 with .Net.

I PreProcess/Analyze/Recognize/Synthesize input images/documents with recognizerParams (SaveCharacterRecognitionVariants, SaveWordRecognitionVariants, SaveCharacterRegions, and ExactConfidenceCalculation) set to true and ErrorHighlightLevel set to EHL_Thorough.

I then Loop through all paragraphs, get CharacterParams, and when a character is marked as suspicious, I set new parameters for the character that should change the text color to red (I tried changing the color and FontStyle.Color properties of CharacterParams). The CharacterParams for the suspicious characters are set like this:

prgh.SetCharParams(i, 1, charParams, 0x00000100, 0x100000); //CFL_IsSuspicious , StyleParamsEnum.SF_Color)
Where i is the index of the suspicious character.

When exporting to .PDF and .Docx formats, this does not happen. I have monochrome turned off and TextOnImage turned on for PDF Export. For RTF export, I turned on HighlightErrorsWithBackgroundColor set to true, so suspicious characters in exported .docx files will be highlighted green (this does happen).

How do I change the parameters/settings to change the textcolor of suspicious characters, or at least get highlighting to occur on PDF export? If more clarity is needed I will post code snippets.

asked 07 Nov '16, 18:26

dfsT's gravatar image

dfsT
21


Hi,

To check is a character was uncertainly recognized and to change its color, please use the following objects, properties and methods provided by the FineReader Engine API:

  • the IParagraph::GetCharParams() method, the CharParams object and its property ICharParams::IsSuspicious to check which characters were uncertainly recognized,
  • the IParagraph::SetCharParams() method and the ICharParams::Color property to set the color of the uncertainly recognized characters.

See the Developer’s Help file articles API Reference→Text-Related Objects→Paragraph and API Reference→Text-Related Objects→CharParams for more information.

Also I have just tested this usage scenario using the RecognizedTextProcessing standard C# sample, which you can find in the %ProgramData%\ABBYY\SDK\11\FineReader Engine\Samples\Visual CS\RecognizedTextProcessing folder. I have modified the code a little:

1) add export to the DOCX and PDF formats in the processImage() method:

private void processImage()
{
       // Create document
       FRDocument document = engineLoader.Engine.CreateFRDocument();

       try {
              …
              // Save results
              displayMessage("Saving results...");
              document.Export(Path.Combine(FreConfig.GetSamplesFolder(), @"SampleImages\Demo.docx"), FREngine.FileExportFormatEnum.FEF_DOCX, null);

              FREngine.PDFExportParams pdfParams = engineLoader.Engine.CreatePDFExportParams();
              pdfParams.TextExportMode = FREngine.PDFExportModeEnum.PEM_TextOnImage;
              document.Export(Path.Combine(FreConfig.GetSamplesFolder(), @"SampleImages\Demo.pdf"), FREngine.FileExportFormatEnum.FEF_PDF, pdfParams);

              //show calculated statistics
              displayStatistics();
       } catch( Exception error ) {
       …
       }
}

2) add changing of the color for the suspicious characters in the calculateStatisticsForChar() method:

void calculateStatisticsForChar( Paragraph paragraph, int charIndex )
{
       CharParams charParams = engineLoader.Engine.CreateCharParams();
       paragraph.GetCharParams( charIndex, charParams );
       if( charParams.IsSuspicious )
       {
              suspiciousSymbolsCount++;
              charParams.Color = 255;
              paragraph.SetCharParams(charIndex, 1, charParams, 0x00000100, 0x100000);
        }
…
}

And get the following results:

alt text

link

answered 09 Nov '16, 12:49

Oksana%20Serdyuk's gravatar image

Oksana Serdyuk ♦♦
1.5k16

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:

×49
×21
×3
×2

Asked: 07 Nov '16, 18:26

Seen: 241 times

Last updated: 09 Nov '16, 12:49

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