Fill Holes

Function

This Step is used to fill the holes in the non-zero pixel regions in the input binary image.

  • The binary image means that each pixel on the image has only two possible values. Common binary images include black and white images and monochrome images.

  • In this step, the non-zero pixel is a pixel with a pixel value of 255.

Usage Scenario

This step is usually used for image segmentation. It obtains a complete image of the target area and avoids interference caused by missing images in the hole section.

Input and Output

fill holes input and output

Parameter Description

Holes

Description: This parameter is used to select the type of holes to be filled.

Options: CompleteHoles, AllHoles.

  • CompleteHoles: Only the complete holes surrounded by non-zero pixels will be filled. Please refer to Parameter tuning examples for more information.

  • AllHoles: Both the complete holes surrounded by non-zero pixels and incomplete holes that are not entirely surrounded by non-zero pixels will be filled. Please refer to the tuning example for the corresponding result.

Default setting: CompleteHoles.

Instruction: Select the type of hole according to the actual situation.

Parameter tuning examples

Fill Complete Holes

The effect of filling complete holes is shown in the right figure below. Only complete holes surrounded by non-zero pixels are filled, and incomplete holes at the edge of the image (as shown in the yellow frame) that are not entirely surrounded by non-zero pixels are not filled.

fill holes fill complete hole

Fill All Holes

The effect of filling all holes is shown in the right figure below. Both complete holes surrounded by non-zero pixels and incomplete holes at the edge of the image that are not entirely surrounded by non-zero pixels are filled.

fill holes fill all hole

We Value Your Privacy

We use cookies to provide you with the best possible experience on our website. By continuing to use the site, you acknowledge that you agree to the use of cookies. If you decline, a single cookie will be used to ensure you're not tracked or remembered when you visit this website.