* Added back image thinning
* Change the logic for computing the chain code