Normal vs. Continuous Mode
Normal Mode (default)
Continuous Mode
In continuous mode EasyObject can process an image whose height is unknown or infinite (e.g. coming from a line-scan camera). The image is split into several chunks that are fed into an image encoder. Objects that straddle several successive image chunks can be detected.
The image encoder encodes only the objects that contain no run touching the last row of the source image. Objects that touch the inferior border of the image are not written in the coded image because they are expected to continue in subsequent image chunks, but they are kept in memory and are processed when subsequent images are analyzed.
A large image is assumed to be divided into several chunks that are stored in the array EImageBW8 chunk[x].
Original image
Three chunks of the image
- Draw the objects encoded in a layer of a coded image. This code is essentially the same as in "Browsing Runs" code snippet. The only difference is that an offset can be applied along the Y-axis.
- Define a function to draw the objects of a layer. If a coded image contains objects that were started in a previous image: the runs of this object from the previous image are assigned with a negative Y-coordinate.
The zero Y-coordinate is the first row of the most recently encoded image. The convention is to assign the lowest Y-coordinate to the oldest run in the encoded objects.
The method EImageEncoder::.GetStartY obtains the Y-coordinate of this oldest run. It is necessary to define a function that displays the content of a layer of a coded image.
Each object can be displayed with a different color( computed by GetFadedColor). This function closely follows the function DrawRuns, but is adapted to continuous mode by taking GetStartY into account. - Enable continuous mode in property EImageEncoder::.SetContinuousModeEnabled. Additional variables can be declared, for example to store the successive encoded image, or to hold the output images.
- Analyze the successive chunks. To encode successive chunks use Encode(chunk[count], codedImage) and then DrawLayer. Note: The variable count spans integers 0, 1 and 2. When an object from a chunk is not complete it is kept in the internal memory of the image encoder.
Content of layerImage when count equals 0, after the application of DrawLayer.
Chunk of the large image that is under consideration.
Note that two objects in the lower-left of the image chunk are not encoded,
because they touch the border of the chunk.
When count reaches 1, one of these two objects becomes completed,
which leads to the encoding of the following image.
Two other objects are not encoded yet at this time.
Here is the result of the encoding of the last chunk (count = 2).
Three objects from the previous chunks have been closed, and have thus been encoded.
Flushing Continuous Mode
After encoding the three image chunks, there remains one object to be completed (in the bottom-right corner of the large image). However, as there are no more chunks, it is necessary to explicitly close this object and encode the remaining object using the flushing of the image encoder. The internal memory of the image encoder is then empty.
Result of the flush