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 Anyinput socket β Accepts any image (color or grayscale). The block will convert color images to grayscale before processing.
π€ Outputs
Grayscale Imageoutput socket β Resulting single-channel image showing Sobel filter result (edge / gradient visualization).
πΉοΈ Controls
dx OrderSlider β Select the derivative order in X direction (integer).dy OrderSlider β Select the derivative order in Y direction (integer).Aperture SizeSlider β 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 Sizeanddx Order/dy Orderand 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 Orderto 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:
Accepts the image from the
Image Anyinput socket.Converts color images into grayscale automatically.
Applies the Sobel operation using the selected
dx,dy, andAperture Sizesettings.Normalizes and outputs a display-friendly grayscale result on the
Grayscale Imageoutput socket.
π Usage Instructions
Connect an image source to the
Image Anyinput socket (for exampleCamera USB,Stream Reader, orLoad Image).Adjust
dx Orderanddy Orderto emphasize horizontal or vertical edges (increasedx Orderto emphasize vertical gradients,dy Orderfor horizontal gradients).Change
Aperture Sizeto control smoothing and sensitivity (larger sizes give smoother gradient estimates but reduce fine detail).Inspect the output using a display block such as
Show Imageor feed it to downstream analysis blocks.
π‘ Tips and Tricks
Preprocess noisy images with
Blurbefore this block to reduce false edges and make gradient output cleaner.If your input is very large and real-time responsiveness matters, use
Image Resizerto reduce resolution first.For binary or thresholded inputs, combine with
Image Thresholdto get clearer edge peaks.To focus analysis on a specific area, crop upstream with
Image ROIorImage ROI Selectand then apply the Sobel Filter.Use the Sobel output together with detection blocks like
Find ObjectorBlob Detectorto improve feature-based detection.Visualize results in full window using
Show Imageto 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 OptimizationorAuto Contrast.Too much noise in edges: Add
Bluror increaseAperture Sizeto smooth small fluctuations.Loss of fine detail: Reduce
Aperture Sizeor 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