RGB Set

This function block selects pixels in an image based on red, green and blue channel ranges and replaces those pixels with a chosen color. Use it to isolate color regions (for masking, visualization or further processing) without any technical setup.

📥 Inputs

Image Any Main image to be processed (any color image).

Mask Color Optional replacement color used for pixels that match the selected RGB ranges. If not provided, matched pixels are set to black.

📤 Outputs

Image Any Resulting image where pixels within the selected RGB ranges are replaced by the Mask Color (or black if none provided).

🕹️ Controls

Red Value (Min-Max) Horizontal range slider to set minimum and maximum accepted red channel values.

Green Value (Min-Max) Horizontal range slider to set minimum and maximum accepted green channel values.

Blue Value (Min-Max) Horizontal range slider to set minimum and maximum accepted blue channel values.

⚙️ How it runs

  • The block examines every pixel in the input image and checks whether its R, G and B values fall inside the ranges specified by the three sliders.

  • Pixels whose channels all lie within the selected ranges are considered matched.

  • Matched pixels are replaced with the color provided to the Mask Color input. If no color is provided, matched pixels become black.

  • The processed image is emitted on the output socket and can be previewed or passed to other function blocks.

✨ Features

  • Per-channel min/max sliders for precise color range selection.

  • Optional external color input to set the replacement color dynamically.

  • Instant preview friendly—adjust sliders and see updated results when used with an image display block.

  • Works with any standard color image format accepted by the system.

📝 Usage Instructions

  1. Connect a color-producing block to the Image Any input (for example a camera block or an image loader).

  2. Adjust Red Value (Min-Max), Green Value (Min-Max) and Blue Value (Min-Max) sliders to select the desired color range.

  3. Optionally connect a color source to Mask Color to define what matched pixels should be replaced with.

  4. Use the output image for visualization or feed it into further processing blocks.

💡 Tips and Tricks

  • To make color selection easier, first use HSV Filter to narrow down the desired region in a more perceptual color space, then feed the result into this block.

  • Use Blur before this block to reduce noise and avoid tiny speckle matches.

  • Use Image Threshold or Image Color Match if you prefer single-channel or reference-based matching before refining with RGB ranges.

  • Crop the area of interest with Image ROI or Image ROI Select to limit processing to a smaller region and speed up experimentation.

  • For visual verification, connect the output to Show Image to preview the replaced pixels in real time.

  • If you plan to feed this result into segmentation or masking operations, combine with Apply Mask to isolate or blend matched areas with other images.

🛠️ Troubleshooting

  • No pixels change: widen the min/max ranges or try preprocessing with HSV Filter or Blur to increase robustness.

  • Too many unwanted pixels matched: narrow the ranges, test each channel individually, or use Image ROI to limit the search area.

  • Replacement color not applied as expected: ensure the Mask Color input provides a valid color (three-channel value). If left disconnected, matched pixels will become black.

  • Slow performance on large images: reduce image size with Image Resizer or crop with Image ROI before using this block.

Last updated