A detection method based on image segmentation applied to insulators