Hello I'm using the following code(FineReader 10 C#) to process an image given the path to the file. The problems is that the Words list is always empty. Most probably I am missing some code but I do not have any idea how to solve this. Can anybody suggest me something?

FREngine.PageProcessingParams pageParams = engine.CreatePageProcessingParams();
pageParams.RecognizerParams.SetPredefinedTextLanguage(sLanguage);
SynthesisParamsForPage synthesis = engine.CreateSynthesisParamsForPage();
synthesis.DetectBackgroundColor = detectFondoColor;
synthesis.DetectTextColor = detectTextoColor;
FREngine.Layout l = engine.CreateLayout();
FREngine.ImageDocument img = engine.PrepareAndOpenImage(sImgPath);
engine.AnalyzeAndRecognizePage(img, pageParams, synthesis, l);

asked 22 Aug '13, 21:03

Julio's gravatar image

Julio
112

edited 23 Aug '13, 12:10

Anastasia%20Galimova's gravatar image

Anastasia Ga... ♦♦
790112


Hello Julio!

You can use the code below (open Hello sample and replace the try block of the processImage method with it).

// Add image file to document
displayMessage( "Loading image..." );
string imagePath = Path.Combine( FreConfig.GetSamplesFolder(), @"SampleImages\Demo.tif" );

document.AddImageFile( imagePath, null, null );

FREngine.PageProcessingParams pageParams = engineLoader.Engine.CreatePageProcessingParams();
pageParams.RecognizerParams.SetPredefinedTextLanguage("English,French"); //specify the language here

FREngine.SynthesisParamsForPage synthesis = engineLoader.Engine.CreateSynthesisParamsForPage();
synthesis.DetectBackgroundColor = true; //specify the value here
synthesis.DetectTextColor = true; //specify the value here

//Recognize document
displayMessage( "Recognizing..." );
document.Process(pageParams, synthesis, null);

//get access to the first word
//be sure that Blocks[0] is a text block
string word = document.Pages[0].Layout.Blocks[0].GetAsTextBlock().Text.Paragraphs[0].Words[0].Text;
link

answered 23 Aug '13, 12:33

Anastasia%20Galimova's gravatar image

Anastasia Ga... ♦♦
790112

Thanks for your help Anastasia. I changed my code and that solved the problem. However, I would like to know what is wrong with the previous code. I think, it is lacking something simple.

(23 Aug '13, 18:53) Julio
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:

×100
×36

Asked: 22 Aug '13, 21:03

Seen: 1,293 times

Last updated: 23 Aug '13, 18:53

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