Apply Mask

This function block filters an image using a mask image (black/white or grayscale) to keep or remove specific parts of the input image. It is intended for simple segmentation and masking workflows in AugeLab Studio.

πŸ“₯ Inputs

  • Image β€” Main image to be filtered (input socket).

  • Mask β€” Mask image used to define preserved areas (input socket). Accepts a binary, grayscale or color image. The block will treat white/bright mask pixels as kept areas and dark pixels as removed areas.

πŸ“€ Outputs

  • Filtered β€” Resulting image after applying the mask (output socket).

πŸ•ΉοΈ Controls

This block has no extra controls or widget settings. It performs masking based on the two provided inputs.

🎨 Features

  • Works with color (RGB) and grayscale images.

  • Accepts masks in grayscale or color; the mask is interpreted as a keep/remove map.

  • Keeps image pixels where mask is bright/white and hides pixels where mask is dark/black.

  • Designed for fast, visual filtering in processing chains.

βš™οΈ Running mechanism

When evaluated, the block checks both inputs, ensures the mask can be used as a binary selector, and then applies the mask to the main image. The output is the original image with non-masked areas removed (or set to black) according to the mask.

πŸ“ Usage instructions

  1. Provide the image you want to filter to the Image input.

  2. Provide a mask image to the Mask input. Bright/white regions in the mask will be preserved in the output; dark/black regions will be removed.

  3. Connect the Filtered output to downstream blocks (for visualization, saving, or further processing).

Tips:

  • If the mask and the image differ in size, resize or crop them so they match before connecting.

  • If your mask is a rough segmentation, combine this block with morphological or smoothing steps to refine results.

πŸ’‘ Tips and Tricks

  • Create masks from intensity values using the Image Threshold or Image Adaptive Threshold blocks before feeding them into this block.

  • Reduce noise in the mask source using Blur or Denoising to avoid small unwanted holes in the result.

  • Improve foreground/background separation with HSV Filter when color is a strong cue, then convert that result into a mask for this block.

  • For higher-quality subject extraction, try Background Removal (RMBG-1.4) or Background Removal (BiRefNet) and feed the resulting mask or cutout into this block.

  • Use Morphological Transformations to clean up small mask artifacts (erode/dilate) before applying the mask.

  • Crop or focus processing with Image ROI Select or Image ROI so the mask and image align on the area of interest.

  • Preview results with Show Image and save successful outputs using Image Logger or Image Write.

πŸ› οΈ Troubleshooting

  • Mask appears to do nothing: Verify the Mask is aligned with the Image and that bright areas correspond to the regions you expect to keep. If sizes differ, use Image Resize or crop with Image ROI Select.

  • Output contains speckles or holes: Apply Blur or Morphological Transformations to the mask to remove small defects.

  • No visible change after masking: Check that the mask actually contains non-black regions. Use Image Threshold to explicitly binarize uncertain masks.

  • Need to inspect intermediate results: Insert Show Image after mask creation steps to verify mask correctness before applying it.

πŸ“Š Evaluation

On execution this block outputs the Filtered image. Use the output to visualize, save, or feed into later analysis blocks such as detection or measurement.

Last updated