Replace dilation by dilation after erosion for better results when binarized contours are not closed