Freeman code
The Freeman code (also chain code or chain code ) is the pixel-by-pixel coding of a contour or line by specifying
in which direction the next pixel is. It is named after its inventor Herbert Freeman . There are different variants for defining the code.
Starting from the current position
Based on the current position, the directions east, northeast, north etc. are assigned a value from 0 to 7:
3 2 1
4 * 0
5 6 7
With a central pixel
The current pixel is set to 0, whereby the directions are then determined by the numbers 1 to 8 using the following matrix:
4 3 2
5 0 1
6 7 8