Does Matlab has inbuilt function for calculating the chain code? I tried the freeman chain code example given in the Mathworks website, but still it doesn't work properly. Kindly help me with the idea behind how to write the program for calculation of the chain code.