This method fills holes in regions. Holes are structures that have the gray scale value 0, and is completely surrounded by pixels with a gray value equal to 0. Of regions outside of the image, it is assumed that they are black. Black areas that touch the edge of the image are preserved, therefore, even if they are surrounded by a contour.