Extraction of the adjacency graph from a binary image