Apply Mask

This function block allows you to filter out specific parts of an image using a mask image, which should contain black and white patterns. The resulting image will show only the areas defined by the white parts of the mask.

πŸ“₯ Inputs

Image The original image that you want to apply the mask to.

Mask A binary image where white (255) indicates areas to retain from the original image and black (0) indicates areas to remove.

πŸ“€ Outputs

Filtered The output image that shows the result after applying the mask to the original image.

πŸ•ΉοΈ Controls

This function block does not have specific controls as it processes the images based on the provided inputs.

🎨 Features

Binary Masking The block uses a binary mask to selectively filter areas of an image, effectively isolating desired parts.

Real-Time Processing The mask is applied instantly, allowing users to visualize the results as soon as images are connected.

πŸ“ Usage Instructions

  1. Connect Input Images: Connect the image you wish to filter to the Image input and the mask to the Mask input.

  2. Run the Block: Evaluate the block. The output will automatically display the filtered image, highlighting only the areas defined by the white parts of the mask.

πŸ“Š Evaluation

Upon running, the function block processes both the original image and the mask, producing a new image where only the relevant areas are visible based on the mask.

πŸ’‘ Tips and Tricks

Creating Masks

You can create black and white masks using image processing tools. Areas you wish to keep should be white, and areas to be filtered out should be black.

Tools such as Image ROI or Image Adaptive Threshold can be helpful in creating precise masks.

Combining with Other Filters

To enhance filtering, consider using this block alongside Blur or Contrast Optimization to preprocess your image before applying the mask. This can help in refining the areas of interest.

Multiple Masks

When applying multiple masks, ensure that they are combined into one binary mask image before feeding it into the block for accurate filtering results.

πŸ› οΈ Troubleshooting

Mismatched Dimensions

If you receive an error regarding sizes, ensure both input images (the original image and the mask) are of the same dimensions. Resize one if necessary.

Visible No Output

If the output appears completely black, check the mask: confirm it contains white areas for parts you expect to see. If the maximum values are above expected, normalize the mask appropriately.

Mask Not Applied

Ensure the mask is truly binary, with proper values of 0 (black) and 1 (white). Also, confirm that the mask size matches that of the original image dimensions.

Last updated