Skeletonizing by compressed line adjacency graph in two directions