Image Encoder
The class representing the objects (EObject) derives from an abstract class ECodedElement.
Object building
The segmentation methods (see Image Segmenters) determine which layer(s) to encode by default, and do not encode pixels from the other layers.
Function GetMaxLayerIndex returns the highest Layer Index value . It is available for all segmenters.
Enabling/disabling layer encoding for each layer individually
The following tables list, for each layer, the Set/Get function and the default enable/disable value.
Two-layer segmenters
Layer |
Set LayerEncoded function |
Get LayerEncoded function |
Default value |
---|---|---|---|
Black layer |
SetBlackLayerEncoded |
IsBlackLayerEncoded |
FALSE |
White layer |
SetWhiteLayerEncoded |
IsWhiteLayerEncoded |
TRUE |
The following tables list, for each layer, the Set/Get function and the default value.
Two-layer segmenters
Layer |
Set LayerEncoded function name |
Get LayerEncoded function name |
Default value |
---|---|---|---|
Black layer |
SetBlackLayerIndex |
IsBlackLayerIndex |
0 |
White layer |
SetWhiteLayerIndex |
IsWhiteLayerIndex |
1 |
For the sake of computational efficiency, the objects are described as lists of runs. A run is a sequence of adjacent pixels that share homogeneous properties (such as being above a given threshold). These runs are merged in objects by the image encoder.
A single object with five enhanced runs
EasyObject can work at object level, and at run level which allows faster processing in critical cases. This is useful to compute custom features on objects then list all runs belonging to a given object as shown in this example of working at run level, with colored runs in the output image.
- Declare a new ECodedImage2 object.
- Declare an EImageEncoder and, if applicable, select the appropriate segmenter. Setup the segmenter and choose appropriate layer(s) to encode.
- Setup an output image.
- Encode the image.
- Color the runs in the output image. Iterate over the objects of a specific layer by constructing a loop and then a RunsIterator object. This iterator allows to browse runs of the considered object. Once the iterator has finished a run of the considered object, the inner loop processes the pixels spanned by this run in the output image.
- Select a specific layer.
Source image (left) with the white layer rendered (right)
Pixels can touch each other along an edge or by a corner. In Four Connexity only pixels touching by an edge are considered neighbors. In Eight Connexity (the default) pixels touching by a corner are also considered neighbors.
Multiple images can be encoded in continuous mode.