Chain Coding – Defining the Exterior Boundary
Chain coding defines the outer boundary using relative positions from a start point. The sequence of the exterior is stored where the endpoint finishes at the start point.
During the encoding, the direction is stored as an integer. However, in this example we use cardinal directions for simplicity. For example, the value 0 is north and 1 is east.
In the example, we start at position (5,2). From here we define the border using cardinal directions and number of movements. We move east 3 positions until we hit the edge. At this location, we move south 4 positions. This process continues until the end point hits the start point.
Note: Only for the purpose of this exercise, we used north, east, south and west as alphabetical values. When encoded, it is a numerical value.