Question
How to recognize a region of an image with FineReader Engine 12?
Answer
There is AddRect Method of the Region Object that allows defining a new block area. It has the following parameters:
Left [in] - specifies coordinate of the left border of the area.
Top [in] - specifies coordinate of the top border of the area.
Right [in] - specifies coordinate of the right border of the area.
Bottom [in] - specifies coordinate of the bottom border of the area.
The values are in pixels. The coordinates are specified relative to the page edges. So the appropriate drawing is next:
It is implied that we already have the document object created and an image loaded. The C# code snippet that demonstrates general idea:
// Remove all the blocks from the collection
document.Pages[0].Layout.Blocks.DeleteAll();
// Create region and specify its coordinates
IRegion region = engineLoader.Engine.CreateRegion();
region.AddRect(Left, Top, Right, Bottom);
// Add blocks of required type to the layout of the first page.
//It is required to replace BT_Type with the appropriate BlockTypeEnum enumeration.
document.Pages[0].Layout.Blocks.AddNew(BlockTypeEnum.BT_Type, region);
// Processing document
document.Process();
...
//Saving the results
This approach is helpful once only some particular regions from the document should be recognized.
Comments
0 comments
Please sign in to leave a comment.