0
7.8kviews
Explain: The first difference makes the chain code invariant to rotation.
0
340views

Given a 8-chain code: 0 7 5 7 5 4 4 3 1 2 1

The first difference is calculated by taking two numbers at a time and counting the number of positions required to reach the second number from the first number in the counter clockwise direction.

Therefore, for 0-7(The first two elements of the chain-code counter)

It takes 7 steps to move from 0 to 7 in the anti-clockwise direction. Similarly, for 7 to 5, it takes 6 steps in the anti-clockwise direction (0,1,2,3,4,5)

For the given chain code,

     0     7      5     7     5     4      4      3      1     2      1
7     6     2     6      7     0      7      6      1      7


First difference: 7 6 2 6 7 0 7 6 1 7

This first difference of the chain code makes it invariant to rotation.

Example:

4- direction chain code: 0 3 0 3 2 2 1 1

First difference: 3 1 3 3 0 3 0