Mean Shift Filtering
This function block applies mean shift filtering to RGB images to smooth color regions while preserving edges. It is useful for denoising, color segmentation, and preparing images for contour or blob analysis.
π₯ Inputs
ImageRGB Input RGB image to be processed.
(here the socket is an input socket)
π€ Outputs
ImageRGB Filtered RGB image (same type as input).
(here the socket is an output socket)
πΉοΈ Controls
Spatial Radius Slider that controls the spatial neighbourhood used for filtering (smaller = finer detail preserved).
Range: 1 β 3
Color Window Radius Slider that controls the color similarity window (larger = stronger color smoothing).
Range: 20 β 100
Maximum Level Radius Slider that adjusts the number of pyramid levels used internally (higher = more aggressive smoothing, but slower).
Range: 1 β 5
βοΈ Running mechanism
When this block receives an image through the ImageRGB input, it applies mean shift filtering using the values set on the three sliders and outputs the processed image through the ImageRGB output. Changes to any slider take effect on the next evaluation, so you can tune the parameters interactively while previewing results.
β¨ Features
Smooths color regions while keeping object edges sharp.
Reduces noise and small texture details, making segmentation and shape detection easier.
Real-time parameter tuning via sliders for quick experimentation.
π Usage recommendations
Feed an RGB image into the
ImageRGBinput.Adjust
Spatial Radiusto control how much local spatial smoothing occurs.Increase
Color Window Radiusto merge similar colors into larger uniform regions.Use
Maximum Level Radiussparingly β higher values increase processing time.Inspect the result from the
ImageRGBoutput in a preview block or the image viewer.
π‘ Tips and Tricks
If your source image is very large and processing is slow, add Image Resizer before this block to reduce image dimensions and speed up processing.
For noisy inputs, consider a light Blur before mean shift to remove sensor noise without losing important edges.
After mean shift, use Find Contour or Blob Detector to extract clean object shapes from the smoothed color regions.
To focus processing on a specific area, crop first with Image ROI Select and feed the cropped image to this block.
Use HSV Filter or Color Quantizer and Clustering after mean shift to refine color-based segmentation.
Preview results with Show Image and save interesting frames with Image Logger or Image Write.
(hints above reference complementary function blocks available in the system)
π οΈ Troubleshooting
Slow performance: lower
Color Window RadiusorMaximum Level Radius, or reduce image size with Image Resizer.Over-smoothed details: reduce
Color Window Radiusand/orSpatial Radiusto preserve finer features.Uneven segmentation across lighting changes: try combining HSV Filter or adjust lighting (capture settings) before processing.
Unexpected colors or artifacts: visualize intermediate steps with Show Image to check inputs and consider using Blur or Denoising upstream.
Last updated
Was this helpful?