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

  1. Feed an RGB image into the ImageRGB input.

  2. Adjust Spatial Radius to control how much local spatial smoothing occurs.

  3. Increase Color Window Radius to merge similar colors into larger uniform regions.

  4. Use Maximum Level Radius sparingly β€” higher values increase processing time.

  5. Inspect the result from the ImageRGB output 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 Radius or Maximum Level Radius, or reduce image size with Image Resizer.

  • Over-smoothed details: reduce Color Window Radius and/or Spatial Radius to 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?