Object Representation based on Run Length encoded Images. More...
Object labelling is done by assigning a unique number to each pixel of the same object, starting top left and going down in reading direction. Care must be taken by defining the exact fusion behaviour of the objects: In the 4-Connection model two pixel areas of the same color are treated as different objects, if they touch each other only on diagonal pixel directions. In the 8-Connection model they are treated as one and the same object. For each color such a model can be selected. The number before the slash sign determines the connection model type for the white pixels, while the number after the slash sign stands for the black pixel connection model, e.g. 4/8-Connection implies a 4-Connectedness for all white pixel areas and an 8-Connectedness for all pixels in a black color.
The Segment Label Code is an extension and part of the Run Length Code. When a labelling operation is performed, the SLC is normally stored right after the RLC Data in Memory, although there is no strict requirement for its memory location. A header at the beginning of the SLC stores the total count of found objects.
It is important to understand that there is an exact correspondence between Run Length Code entries and object numbers stored in SLC. Besides of the headers, the byte count of RLC and SLC are identical. This is depicted at the following table. For a better understanding, the RLC and SLC data is displayed side by side.
RLC Meaning | RLC Address (U16*) | SLC Address (U16*) | SLC Value/Meaning |
---|---|---|---|
SLC LSB | 0 + pRLC | — | — |
SLC MSB | 1 + pRLC | — | — |
dx | 2 + pRLC | — | — |
dy | 3 + pRLC | pSLC + 0 | Total Object Count. |
Line Start Color | 0 + 4 + pRLC | pSLC + 1 + 0 | Object Nr of corresponding RLC Line Segment. |
Color Toggle | 1 + 4 + pRLC | pSLC + 1 + 1 | Object Nr of corresponding RLC Line Segment. |
... | ... | ... | ... |
Color Toggle | n - 1 + 4 + pRLC | pSLC + 1 + n - 1 | Object Nr of corresponding RLC Line Segment. |
dx: End of Line | n + 4 + pRLC | pSLC + 1 + n | -to be ignored- |
Line Start Color | n + 1 + 4 + pRLC | pSLC + 1 + n + 1 | Object Nr of corresponding RLC Line Segment. |
... | ... | ... | ... |
Example Encoding for the 4/4 connection image ( 4×3 pixels), SLC at Address 12345678:
Head:
st+ | 0|– | 1|– | 2|– | 3|0 |
---|---|---|---|---|
RLC | 5678 | 1234 | 4 | 3 |
SLC | – | – | – | 6 |
Data:
st+ | 4|1 | 5|2 | 6|3 | 7|4 | 8|5 | 9|6 | 10|7 | 11|8 | 12|9 | 13|10 | 14|11 |
---|---|---|---|---|---|---|---|---|---|---|---|
RLC | -1 | 2 | 3 | 4 | 0 | 2 | 3 | 4 | 0 | 1 | 4 |
SLC | 0 | 1 | 2 | X | 3 | 4 | 5 | X | 3 | 4 | X |