Spatial Sobel filter

Spatial Sobel filter. See Wikipedia for general information.

The Spatial Sobel filter is an image filter used in image processing and computer vision to detect edges in an image. It calculates the gradient magnitude of an image by approximating the gradient using two separate convolution kernels: one for the horizontal direction (Sobel X) and another for the vertical direction (Sobel Y).

The filter operates by convolving the image with the Sobel X and Sobel Y kernels. These kernels are designed to approximate the first derivative of the image intensity in the corresponding directions. By convolving the image with these kernels, the filter estimates the rate of change of pixel intensities in the horizontal and vertical directions.

Usage:

  1. Start the algorithm from the Processing Toolbox panel.

  2. Select the raster to process and modify the parameterization if necessary, then click run.

    ../../../../_images/sobel_filter_interface.png
  3. Processed image in comparison to the original.

    ../../../../_images/sobel_filter_result.png

Parameters

Raster layer [raster]

Raster layer to be processed band-wise.

Function [string]

Python code. See sobel for information on different parameters.

Default:

from scipy.ndimage.filters import sobel

function = lambda array: sobel(array, axis=0)

Outputs

Output raster layer [rasterDestination]

Raster file destination.

Command-line usage

>qgis_process help enmapbox:SpatialSobelFilter:

----------------
Arguments
----------------

raster: Raster layer
    Argument type:  raster
    Acceptable values:
            - Path to a raster layer
function: Function
    Default value:  from scipy.ndimage.filters import sobel

function = lambda array: sobel(array, axis=0)
    Argument type:  string
    Acceptable values:
            - String value
            - field:FIELD_NAME to use a data defined value taken from the FIELD_NAME field
            - expression:SOME EXPRESSION to use a data defined value calculated using a custom QGIS expression
outputRaster: Output raster layer
    Argument type:  rasterDestination
    Acceptable values:
            - Path for new raster layer

----------------
Outputs
----------------

outputRaster: <outputRaster>
    Output raster layer