Sobel Filter

This function block applies Sobel derivative filtering to images to highlight edges and directional changes in intensity. It is optimized for RGB inputs (internally converted to grayscale) and provides controls to select derivative orders and the filter aperture.

πŸ“₯ Inputs

  • Image Any input socket β€” Accepts any image (color or grayscale). The block will convert color images to grayscale before processing.

πŸ“€ Outputs

  • Grayscale Image output socket β€” Resulting single-channel image showing Sobel filter result (edge / gradient visualization).

πŸ•ΉοΈ Controls

  • dx Order Slider β€” Select the derivative order in X direction (integer).

  • dy Order Slider β€” Select the derivative order in Y direction (integer).

  • Aperture Size Slider β€” Select the aperture (kernel) size used by the filter. Some valid aperture sizes are odd numbers; the control enforces compatible values with the derivative orders.

Notes on controls behavior:

  • The block validates the relation between Aperture Size and dx Order/dy Order and will correct or warn if an invalid combination is chosen (for example, aperture too small for the selected derivative order).

  • If both derivative orders are set to zero, the block will adjust dx Order to a valid default.

🎨 Features

  • Produces a normalized, 8-bit grayscale representation of image gradients suitable for visualization and further analysis.

  • Real-time adjustable sliders let you experiment with different derivative orders and kernel sizes without reconfiguring sources.

  • Built-in safety checks prevent common invalid parameter combinations and provide clear error messages when adjustments are made.

βš™οΈ Running mechanism

When executed, the block:

  1. Accepts the image from the Image Any input socket.

  2. Converts color images into grayscale automatically.

  3. Applies the Sobel operation using the selected dx, dy, and Aperture Size settings.

  4. Normalizes and outputs a display-friendly grayscale result on the Grayscale Image output socket.

πŸ“ Usage Instructions

  1. Connect an image source to the Image Any input socket (for example Camera USB, Stream Reader, or Load Image).

  2. Adjust dx Order and dy Order to emphasize horizontal or vertical edges (increase dx Order to emphasize vertical gradients, dy Order for horizontal gradients).

  3. Change Aperture Size to control smoothing and sensitivity (larger sizes give smoother gradient estimates but reduce fine detail).

  4. Inspect the output using a display block such as Show Image or feed it to downstream analysis blocks.

πŸ’‘ Tips and Tricks

  • Preprocess noisy images with Blur before this block to reduce false edges and make gradient output cleaner.

  • If your input is very large and real-time responsiveness matters, use Image Resizer to reduce resolution first.

  • For binary or thresholded inputs, combine with Image Threshold to get clearer edge peaks.

  • To focus analysis on a specific area, crop upstream with Image ROI or Image ROI Select and then apply the Sobel Filter.

  • Use the Sobel output together with detection blocks like Find Object or Blob Detector to improve feature-based detection.

  • Visualize results in full window using Show Image to inspect details and tune sliders interactively.

πŸ› οΈ Troubleshooting

  • Unexpectedly dark or blank output: Confirm the source image is valid and not all-zero. Try preprocessing with Contrast Optimization or Auto Contrast.

  • Too much noise in edges: Add Blur or increase Aperture Size to smooth small fluctuations.

  • Loss of fine detail: Reduce Aperture Size or lower blur before filtering.

  • Slider warnings or automatic adjustments: The block enforces valid parameter combinations. If you see a message, adjust the sliders to match the suggested values.

If you need to inspect intermediate images or compare results, route the input and output to Show Image blocks for side-by-side visualization.

Last updated