machinevisiontoolbox.ImageSpatial.Kernel.Sobel

static Kernel.Sobel()[source]

Sobel edge detector

Returns:

Sobel kernel

Return type:

ndarray(3,3)

Return the Sobel kernel for horizontal gradient

\[\begin{split}\mathbf{K} = \frac{1}{8} \begin{bmatrix} 1 & 0 & -1 \\ 2 & 0 & -2 \\ 1 & 0 & -1 \end{bmatrix}\end{split}\]

Example:

>>> from machinevisiontoolbox import Kernel
>>> Kernel.Sobel()
array([[ 0.125,  0.   , -0.125],
       [ 0.25 ,  0.   , -0.25 ],
       [ 0.125,  0.   , -0.125]])
Note:
  • This kernel is an effective vertical-edge detector

  • The y-derivative (horizontal-edge) kernel is K.T

References:
  • Robotics, Vision & Control for Python, Section 11.5.1.3, P. Corke, Springer 2023.

Seealso:

DGauss