Hello, i need to recognize only specified region of the image file as i think this will speed up recognition process. I have Top, Left, Right, Bottom coordinates. How can i do that using FREngine10 API for c#?
Community
-
To recognize only specified region you can create a Layout object and add blocks manually:
- Create a Layout object with the help of the CreateLayout method of the Engine object or obtain the Layout object, which corresponds to the page, via the IFRPage::Layout property.
- Create a Region object for the block using the IEngine::CreateRegion method and add rectangles to it using the IRegion::AddRect method.
- Create a block of required type and add it into the collection using the AddBlock method of the Layout object.
- Set the required parameters of the block (use the block properties object corresponding to the type of block).
C# sample:
// Create document and open image FREngine.FRDocument document = engineLoader.Engine.CreateFRDocument(); document.AddImageFile( imagePath, null, null ); // Remove all the blocks from the collection document.Pages[0].Layout.Blocks.RemoveAll(); // Create region and specify its coordinates FREngine.Region region = engineLoader.Engine.CreateRegion(); region.AddRect(Right,Top,Left,Bottom); // Add blocks of required type to the layout document.Pages[0].Layout.AddBlock(FREngine.BlockTypeEnum.BT_Barcode, region); // Set the required parameters of the block FREngine.TextOrientation textOrientation = engineLoader.Engine.CreateTextOrientation(); textOrientation.RotationType = FREngine.RotationTypeEnum.RT_Counterclockwise; document.Pages[0].Layout.Blocks[0].GetAsBarcodeBlock().TextOrientation = textOrientation; //Recognize document document.Recognize( null, null );
For detailed information about these methods please refer to Developer’s Help.
4 -
What could be the reason if no text is recognized?
I have a simple pdf file with 2 words of text.
I am trying for days to get any text recognized.
I already tried all possible ways using Engine, FRDocument and DocumentAnalyzer.
0 -
I don't know about FRE10 but in FRE11 it's not
region.AddRect(Right,Top,Left,Bottom);
but
region.AddRect(Left,Top,Right,Bottom);
0 -
Hi!
We need a little bit more information in order to help you.
Can you please provide images you are trying to recognize and a piece of code that demonstrates how are you using FineReader Engine? You can post it here or send it to SDK_Support@abbyy.com.
Also have you tried samples that comes with FineReader Engine with your pdf?
0 -
Hi,
I solved this issue as described in this thread:
https://forum.ocrsdk.com/thread/layout-file/?order=all#comment-ae93f5d9-9057-4c68-82f9-a82d00a71632
Solution was to set the language for the RecognizerParams of the TextBlock.
0
Please sign in to leave a comment.