Extracting the components' contours