HSV Filter

This block lets you isolate colors in an image by adjusting Hue, Saturation and Value ranges. Use it to create color masks, extract colored regions, or combine foreground and background for visualization.

πŸ“₯ Inputs

This block has the following input socket:

  • Image Any Input socket that accepts the image to be processed.

πŸ“€ Outputs

This block provides these output sockets:

  • Result Image Filtered image showing only the pixels within selected HSV ranges (foreground).

  • HSV Image The converted HSV representation of the input image.

  • Masked Image A single-channel binary/grayscale mask showing which pixels passed the HSV test.

  • Added Image Foreground blended with the background for easier visualization.

  • Background Image The background portion (grayscale) where masked pixels are removed.

πŸ•ΉοΈ Controls

  • Hue (Min-Max) Slider pair to set the hue lower and upper bounds.

  • Saturation (Min-Max) Slider pair to set the saturation lower and upper bounds.

  • Value (Min-Max) Slider pair to set the value/brightness lower and upper bounds.

Adjust these sliders until the Masked Image highlights your target color range while excluding unwanted areas.

🎯 Features

  • Visual, interactive color selection with three range sliders.

  • Live mask preview to quickly validate selected color ranges.

  • Outputs both mask and visualizations so you can use either for analysis or downstream processing.

  • Combines masked foreground with a grayscale background to help verify extracted regions.

πŸ“ How to use

  1. Connect an image-producing block to the Image Any input.

  2. Move the Hue (Min-Max), Saturation (Min-Max) and Value (Min-Max) sliders to isolate the color you want.

  3. Inspect the Masked Image to confirm the selection.

  4. Use Result Image or Added Image for visual outputs, and Masked Image for further processing or measurements.

βš™οΈ What happens when it runs

When executed, the block converts the input image into HSV space, builds a binary mask using the slider ranges, produces a masked color image (foreground), a grayscale background, and a combined visualization for easy validation.

πŸ’‘ Tips and Tricks

  • Preprocess to reduce noise: feed the input through Blur before this block to smooth noisy images and get cleaner masks.

  • Better separation for large images: use Image Resize to reduce image size for faster interactive tuning, then process full-size when settings are finalized.

  • Focus on area of interest: crop the input with Image ROI Select before applying HSV to avoid color confusion from surrounding regions.

  • Refine the mask: combine this block's Masked Image with Apply Mask to filter another image or chain into Image Threshold for further binary cleanup.

  • Visual inspection: connect the output to Show Image to open the image viewer and inspect results in a larger window.

  • Save results: use Image Logger or Image Write to save masked images or visualizations once you have the desired settings.

  • Use with detectors: after isolating a color region, pass the masked or result image to detection blocks like Find Object or Blob Detector to locate specific features that match the selected color.

  • Background analysis: combine with Background Subtractor when working on video streams to separate moving colored objects from static backgrounds.

πŸ› οΈ Troubleshooting

  • Little or no mask output: check that your sliders cover the correct hue range for the target color and that the input image is in the expected color space (photographed in normal lighting).

  • Mask too broad: narrow the Saturation (Min-Max) and Value (Min-Max) ranges to exclude similar but undesired colors and highlights.

  • Excess noise in mask: add Blur or run Image Threshold / morphological cleanup blocks after the mask to remove small speckles.

  • Performance concerns: resize the image with Image Resize for interactive tuning; apply settings on full resolution only when ready.

If you need more targeted guidance on block combinations for a specific task, describe the scenario (camera type, target color, real-time vs. offline) and recommended combinations can be suggested.

Last updated