Modified 8-connectedness chain code. The first
approach for representing digital curves using chain code was
introduced by Freeman (Freeman, 1961; Gonzales and Woods,
2002). The direction of each segmented region is encoded using
a numbering scheme. A chain code is generated by following
the outline of an object and assigning a direction associated
with each sequential pair of pixels. A reasonable modification
for 8-directional chain code is introduced as following