Run-length
coding

This technique is applied commonly to binary images, although it may in principle be applied to grey scale or colour image data if an associated property is stored along with the regional shape definition.If regions are completely uniform (binary/same grey-scale value) then information is preserved. If there is variation within regions then either poor coding will result or, if thresholded, the image is degraded but greater compression is possible.

The idea is to identify a uniform run of values and replace it with the start and end location or counts. This results in a list of maximum length N, the vertical image dimension, of lists of maximum length M, the horizontal image dimension.

 
Figure 4:   Run length coding of a simple image

For example the run-length code for the image illustrated in Figure 4 is

{ (2,4,6) , (4,4,4), (5,4,4,7,7) , (6,4,7) }

This uses starty, startx, endx: the first number in each sublist above is the y coordinate, followed by the x-coordinates of the entry and exit to the region defined in black. As an alternative counts of (off, on, off,...) can be used, i.e. the length of each run instead of the coordinates, starting from the bottom, say, in which case the code becomes,

{ (8) , (3,3,2) , (8), (3,1,4) , (3,1,2,1,1), (3,4,1) , (8) }

Some features to note are:


[ Regional representation | The medial axis transform ]

Comments to: Sarah Price at ICBL.