ComfyUI Node
BD Fill Mask Holes
Fill interior holes in a binary mask. Uses scipy binary_fill_holes to flood-fill any enclosed region inside the mask boundary. Optional morphological closing first connects near-touching edges so enclosed regions are fully closed before filling. Use after SAM3 when the perimeter is detected but interior pixels are missing.
BD Fill Mask Holes
- mask
- filled_mask
- status
◄threshold0.50►
◄closing_radius4►
◄smooth_edges0►
Category🧠BrainDead/Segmentation
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — | |
| thresholdopt | FLOAT | 0.500–1 | Binarize the input mask at this value before filling. 0.5 = standard binary threshold. |
| closing_radiusopt | INT | 40–64 | Morphological closing radius (pixels) applied BEFORE fill_holes. Closing = dilate then erode — it bridges small gaps in the mask perimeter so that enclosed regions are properly sealed before filling. 0 = skip closing (only fill_holes). 4–8 = good for SAM3 lip/teeth gaps. |
| smooth_edgesopt | INT | 00–16 | Gaussian blur radius applied to the filled mask for soft edges. 0 = hard binary output. 2–4 = slight feathering at boundaries. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| filled_mask | MASK | — |
| status | STRING | — |