FloodFill
This function block fills enclosed regions in an image starting from a seed point, based on color similarity. It works with grayscale or color images and provides an easy slider to control how permissive the fill should be.
π₯ Inputs (sockets)
Input Image The source image to apply the fill on (grayscale or color).
Seed Point (X,Y) Optional. The starting coordinate for the fill. If not provided, the block will use the image center.
Fill Color (R,G,B) Optional. The color used to fill the selected region. If left empty, a default green fill is used.
π€ Outputs (sockets)
Image The resulting image with the filled area applied.
πΉοΈ Controls (widgets)
Fill Range Horizontal range slider to set lower and upper tolerance for color differences. Increasing the range makes the fill accept larger color variations around the seed; decreasing it restricts fill to pixels very similar to the seed.
π― Features
Works with both grayscale and color inputs β grayscale images are automatically handled so you can use the block in either case.
Optional seed point and fill color allow quick interactive use or fully automated pipelines.
Visual output includes the filled region overlaid on the original image so you can immediately inspect results.
Simple, single-slider control for fine-tuning how aggressively the region grows.
βοΈ Running mechanism
When the block runs it:
Uses the provided seed point to start a region fill. If no seed is supplied it defaults to the image center.
Uses the
Fill Rangevalues to decide which neighboring pixels are similar enough to be included in the fill.Applies the chosen fill color (or default) to the selected region and outputs the modified image.
π Usage
Connect your image to
Input Image.Optionally provide a
Seed Point (X,Y)to target a specific region; otherwise let it use the center.Optionally provide
Fill Color (R,G,B)to choose the fill color, or leave empty for the default.Adjust
Fill Rangeuntil the filled region matches your expectation.Inspect the result from the
Imageoutput.
π‘ Tips and Tricks
Use
Blurbefore this block to smooth noise so small variations do not interrupt fill growth.Use
Image ThresholdorHSV Filterto isolate the target region first β this can make fill results more reliable on noisy or multi-colored backgrounds.Crop to a region of interest using
Image ROI SelectorImage ROIbefore filling to limit operations and speed up processing.After filling, preview results with
Show Imageand save them withImage WriteorImage Loggerif needed.If the fill spreads too far, reduce the tolerance using
Fill Range. If it does not reach the full region, increase the tolerance.For color targets, try converting or isolating colors with
HSV Filterthen feed the result to this block for a more consistent fill.
π οΈ Troubleshooting
No visible change: check the seed point placement and ensure the target region is within image boundaries; preview the input with
Show Image.Fill leaks into unwanted areas: lower the
Fill Rangetolerance or pre-process withImage Threshold/Blurto reduce similar colors outside the intended region.Unexpected color result: verify the
Fill Color (R,G,B)values and preview the color on a sample image before running the full pipeline.
Last updated
Was this helpful?