UR Mask Processor
Feather it, expand it, preview it — make the mask worth trusting
- mask
- image
- mask
- mask_image
- preview
A raw mask is rarely the mask you want to run. Detector output is under-sized and hard-edged; hand-drawn regions are slightly too tight; both will leave seams you only notice after paying for a render. UR Mask Processor is the cleanup step: it expands a mask, blurs it, and shows you the result overlaid on your actual frame so you can judge it before anything expensive runs.
If you've done any inpainting you already know the theory - the KB's inpainting essay calls mask blur/feathering the standard fix for hard seams, and padding the mask is what keeps the re-render from cutting along a visible edge. This node is that advice, packaged as three dials and a preview.
How it works
Three operations, applied in order, all in pure torch (no extra models, no dependencies):
- expand_pixels - dilates the mask outward by N pixels. It's a max-pool over a
2N+1kernel, which is the cheap and standard way to inflate a binary mask. Use it when the detected or drawn region is tighter than the thing you're removing, or when you want the inpaint to have room to work. - blur_sigma - Gaussian-feathers the edges so the boundary fades instead of cutting. This is what kills the seam.
- blur_kernel - the kernel size for that blur. Leave it at 0 and the node derives it from sigma (
ceil(6*sigma)), which is a sensible default - you can usually forget this input exists.
blur_sigma = 0 and blur_kernel = 0 together means "no blur, just pass the mask through." Expanding to cover the target and then blurring to hide the seam is the standard remove move.
Inputs and outputs
mask is required; image is optional - it's only used as the backdrop for the preview overlay, which is honestly how you should use this node. The two preview dials, preview_color and preview_opacity, just style that overlay.
Three outputs:
- mask - the processed mask, ready for the next node.
- mask_image - the mask rendered as a 3-channel image, handy if you want to inspect or save it.
- preview - the overlay: your mask (or the mask image, if no image was fed in) tinted and blended onto the frame.
Wire it between any mask producer (UR Regions To Mask Batch, UR Boxes To Mask Batch, or any external segmenter) and UR Keyframe Prep.
Common issues
The biggest one is not looking at the preview. Expand and blur are cheap; the inpaint that runs downstream is not. Feed the optional image in, hover the preview, and judge the mask before spending a render. Second: feathering is a trade, not a free win - blur too far and the mask bleeds into pixels you wanted untouched, which changes content you meant to keep. Third, a common confusion: expand and blur do different jobs and people swap them. Expand makes sure the target is fully covered; blur makes the edge disappear. Doing one and not the other produces masks that either miss the edges or leave a hard seam. Do both, in that order, and your inpaint output will look dramatically better.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — | |
| expand_pixels | INT | 00–2048 | — |
| blur_sigma | FLOAT | 0.000–512 | — |
| blur_kernel | INT | 00–2049 | — |
| preview_color | STRING | #00FF00 | — |
| preview_opacity | FLOAT | 0.350–1 | — |
| imageopt | IMAGE | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |
| mask_image | IMAGE | — |
| preview | IMAGE | — |