RGB Mask

This function block applies a color-range mask to an image using separate Red / Green / Blue min-max sliders. Use it to isolate or extract image regions that fall inside a chosen RGB color range. Optionally, provide a replacement color to fill areas outside the mask.

πŸ“₯ Inputs

Image Any Input Provide the source image to be masked (color image).

Mask Color Input Optional pixel color used to fill areas that are excluded by the mask (three-channel color).

πŸ“€ Outputs

Image Any Output The resulting image where only pixels inside the chosen RGB ranges remain (areas outside can be left black or filled with the provided Mask Color).

πŸ•ΉοΈ Controls

Red Value (Min-Max) Control Adjust the minimum and maximum allowed red channel values.

Green Value (Min-Max) Control Adjust the minimum and maximum allowed green channel values.

Blue Value (Min-Max) Control Adjust the minimum and maximum allowed blue channel values.

🎨 Features

  • Interactive three-channel masking using min/max sliders for each channel.

  • Live visual feedback: change sliders and observe how the output image retains only the selected colors.

  • Optional fill color: provide a Mask Color input to replace excluded areas with a chosen color for clearer visualization or downstream processing.

πŸ“ Usage Instructions

  1. Connect a color image to the Image Any input.

  2. Move the Red Value (Min-Max), Green Value (Min-Max), and Blue Value (Min-Max) sliders to select the color range you want to keep.

  3. Optionally connect a pixel to Mask Color to fill excluded areas with a chosen color.

  4. Use the Image Any output as the masked image for viewing or further processing.

πŸ“Š Evaluation

When executed, the block creates a mask from the RGB ranges you set and applies it to the input image. The output image contains only the pixels inside the chosen ranges; excluded pixels are either black or replaced with the provided Mask Color.

πŸ’‘ Tips and Tricks

  • Use HSV Filter before this block when lighting or color variations make RGB ranges unreliable β€” HSV often separates hue from brightness and helps isolate colors more robustly.

  • Crop the input with Image ROI to narrow the area of interest before masking β€” this reduces false matches from irrelevant background.

  • If you need to preview results larger or in detail, connect the output to Show Image to open the image viewer.

  • Resize very large images with Image Resizer before masking to speed up interactive slider tuning.

  • After refining ranges, combine results with transformation or export blocks (for example, save final images via Image Write).

πŸ› οΈ Troubleshooting

  • No visible change: expand the min-max ranges for the channels until you see the target color appear.

  • Too many areas selected: tighten the channel ranges or try using HSV Filter to isolate hue more precisely.

  • Replacement color not applied: ensure a valid three-channel value is provided to Mask Color.

  • Uneven results under different lighting: test with different lighting conditions or preprocess with Blur or Contrast Optimization to stabilize color appearance.

Last updated