An efficient matlab implementation of a dynamic programming algorithm to extract contours from images.