Introduction - If you have any usage issues, please Google them yourself
Edge following algorithm
If it is known that an object in an image has a discrete edge all around it, it is then possible to follow the edge around the object and get back to the beginning. It is assumed that a position on the edge of a region has been identified (i, j) which is the starting point of the algorithm. A simple edge following algorithm based on Sobel gradients