VCLib Documentation  6.12.2

Run Length encoded Images (RLC)

Run Length encoded Images (RLC)

Modules

 Segment Label Code (SLC)
 Object Representation based on Run Length encoded Images.
 
 Color Label Code (CLC)
 Color Representation based on Run Length encoded Images.
 

Detailed Description

It is not necessary to understand the structure of the run length code to use the functions which operate on it. Think of the run length code like a fast processable binary(!) image, where one can additionally label the image areas and get various information about these labelled 'objects'. The main advantage is that processing in run length code is mostly incredibly fast.

Probably the best known use of the run length code (RLC) is for telefax. In contrast, RLC is used in image processing not to reduce the amount of information but rather due to the execution speed of the RLC-based programs. For this reason, the run length code used in image process has a slightly different structure than for telefax.

Although it is possible to encode more than one color in RLC, all functions described here will assume RLC for a pure binary image. The RLC is created by proceeding from left to right, line by line. Each change from dark to bright or from bright to dark produces an entry in the run length code. The pixel position where the change occured is stored. If a line begins with white, the first entry for the line is -1 (0xFFFF), 0 otherwise. An end-of-line mark is entered at the end of each line, independent from the number of changes. Since the last color change can happen on position dx-1, the value dx will be used as an end-of-line mark added at the end of every row.

image_rlc.png

A header at the beginning of the RLC stores the memory address for corresponding segment label code at the first two entries followed by the width dx (the end-of-line mark!) and the height dy of the run length encoded image.

Address (U16*) Value Meaning
pRLC + 0 0xXXXX SLC Address as Value: LSB (0, if unlabelled).
pRLC + 1 0xXXXX SLC Address as Value: MSB (0, if unlabelled).
pRLC + 2 dx The RLC Image Width.
pRLC + 3 dy The RLC Image Height.
pRLC + 4 + 0 0xXXXX Color (0=Black, 0xFFFF=-1=White) of the Leftmost Pixel in the First Line.
pRLC + 4 + 1 0xXXXX Position of Color Change.
... ... ...
pRLC + 4 + n - 10xXXXX Position of Color Change.
pRLC + 4 + n dx Marks the End of the First Line.
pRLC + 4 + n + 10xXXXX Color of the Leftmost Pixel in the Second Line.
... ... ...