Block Object (IBlock Interface)
This object represents a single block. When recognizing a page, ABBYY FineReader Engine first analyzes its layout and detects blocks of various types on the page. Blocks determine how the image areas are recognized and contain recognized information after recognition.
Each block on the page belongs to one of the nine types: text, table, raster picture, vector picture, barcode, checkmark, checkmarks group, separator, and separators group. The type of the block is defined by the Type property. The Block object exposes methods which typecast it to the one of its child objects and thereby provide access to the extended attributes of a block of specific type.
The position of the block on an image is defined by its region (the Region property) and the layer to which the block belongs (the BlockLayerType property).
Properties
Name | Type | Description |
---|---|---|
Application | Engine, read-only | Returns the Engine object. |
Main attributes | ||
Region | Region |
Provides access to the block region. A region is a collection of rectangles. Unlike other types of blocks, a table block may have no more than one rectangle in its region, that is why an attempt to assign a region with more than one rectangle to a table block will result in an error. The region is defined by coordinates of its rectangles (in pixels) upon the deskewed black-and-white plane of the corresponding image. Note: The property returns a constant object. To change the block region, you must at first obtain an intermediate Region object using the IEngine::CreateRegion method, change the necessary parameters, and then assign the obtained object to the property. |
Type | BlockTypeEnum, read-only |
ABBYY FineReader Engine uses the following types of blocks: text, table, raster picture, vector picture, barcode, checkmark, checkmarks group, separator, separators group, and autoanalysis. (Autoanalysis blocks are used only in Visual Components). Each type of block has its own specific properties.
The block type is defined during creation and cannot be changed. If you need to change the block type, you will have to delete the block and create another block of the necessary type in exactly the same place:
|
Additional attributes | ||
BackgroundColor | int, read-only |
Specifies the background color of the block.
Note: The int value is calculated from the RGB triplet using the formula: (red value) + (256 x green value) + (65536 x blue value), where red value is the first triplet component, green value is the second triplet component, blue value is the third triplet component. For example, the int value of the color white equals 16777215. By default, the value of this property is -1, which means that the color is transparent. |
BlockLayerType | BlockLayerTypeEnum, read-only |
Specifies the layer of the block: background, foreground, or hidden. Blocks may be overlaid, for example, a text block may lay over a background picture block. Note: For RasterPictureBlock and VectorPictureBlock, you can change layer using the SetBlockLayerType method. By default, the value of this property is BLT_Foreground. |
Description | BSTR |
Stores the description of the block. By default, the value of this property is an empty string. |
Name | BSTR |
Stores the name of the block. It may be an arbitrary string. By default, the value of this property is an empty string. |
UserProperty | VARIANT | Allows you to associate some user-defined information of any type with an object of the Block type. |
Methods
Name | Description |
---|---|
GetAsBarcodeBlock | Returns the block as the BarcodeBlock object. If the block is not a barcode block, NULL is returned. |
GetAsCheckmarkBlock | Returns the block as the CheckmarkBlock object. If the block is not a checkmark block, NULL is returned. |
GetAsCheckmarkGroup | Returns the block as the CheckmarkGroup object. If the block is not a checkmark group block, NULL is returned. |
GetAsRasterPictureBlock | Returns the block as the RasterPictureBlock object. If the block is not a raster picture block, NULL is returned. |
GetAsSeparatorBlock | Returns the block as the SeparatorBlock object. If the block is not a separator block, NULL is returned. |
GetAsSeparatorGroup | Returns the block as the SeparatorGroup object. If the block is not a separator group block, NULL is returned. |
GetAsTableBlock | Returns the block as the TableBlock object. If the block is not a table block, NULL is returned. |
GetAsTextBlock | Returns the block as the TextBlock object. If the block is not a text block, NULL is returned. |
GetAsVectorPictureBlock | Returns the block as the VectorPictureBlock object. If the block is not a vector picture block, NULL is returned. |
Move | Offsets block region by some vector. |
Related objects
Output parameter
This object is the output parameter of the Item, AddNew methods of the LayoutBlocks object.
Samples
C# code
The object is used in the following code samples: RecognizedTextProcessing, CustomLanguage, CommandLineInterface; and demo tools: Camera OCR, Engine Predefined Processing Profiles, Image Preprocessing.
See also
17.09.2024 15:14:40