Fill Contour
This function block fills a selected contour area on an input image. Use it to mask out or keep regions defined by a contour β either filling the inside of the shape or keeping everything outside it.
π₯ Inputs
Image Anyβ Source image where the contour will be applied.Contourβ List of contour points or a simple two-point rectangle definition.
π€ Outputs
Output Imageβ Resulting image with the contour area filled or the inverse applied, depending on the control setting.
πΉοΈ Controls
Fill Insideβ Checkbox. When checked the area inside the provided contour is preserved (everything else removed). When unchecked the inverse is preserved (inside removed, outside kept).
π― Features
Accepts both complex contours and a simple two-point rectangle definition for quick rectangular masks.
Lets you choose whether to keep the inside or the outside of the contour.
Produces a clean masked output suitable for further processing or visualization.
βοΈ Running mechanism
When executed the block reads the provided image and the contour points. If only two points are provided they are interpreted as opposite corners of a rectangle. The block then creates a mask from the contour and applies that mask to the input image, producing the filled/filtered result according to the Fill Inside selection.
π Usage instructions
Provide an image to
Image Any.Provide a contour to
Contour(either a point list or two points for a rectangle).Toggle
Fill Insidedepending on whether you want to keep the contour area or its complement.Use the
Output Imagefor visualization or feed it into downstream blocks.
π‘ Tips and Tricks
To obtain contour points from an image automatically, use
Find ContourorFeature Detectorbefore this block and feed the result intoContour.For quick manual selection of an area, pair with
Image ROI SelectorImage ROI Polygonto define the region and then use the resulting coordinates here.If you want to crop the filled area afterwards, connect the output to
Get ROIorContour to Image.For background removal workflows, combine
Fill ContourwithApply MaskorBackground Removal (RMBG-1.4)depending on your needs.Preview the result using
Show Imageto verify visually before further processing.Use
BlurorImage Thresholdbefore contour extraction to reduce noise and improve contour quality.
π οΈ Troubleshooting
If nothing changes, confirm the
Contourcontains valid points. Two points are treated as a rectangle; more points define a polygon.If the filled area looks inverted, toggle the
Fill Insidecheckbox.If the result includes unexpected regions, try preprocessing with
Image ThresholdorBlurand re-extract the contour withFind Contour.
Last updated
Was this helpful?