good work man, but I have a problem in using snakes algorithm.
what I want is to get the contour of a mountain given only the top of the mountain.
I tried it using your implementation and gave it the surrounding indices of the top pixel but it was keeping smaller and smaller till vanishing. I know that is the idea of the algorithm, minimizing the area of the snake.
I want to give it the surrounding pixels of the top of the mountain and the region grows up till the stoppage point.