machinevisiontoolbox.ImageSpatial.Kernel.DoG

classmethod Kernel.DoG(sigma1, sigma2=None, h=None)[source]

Difference of Gaussians kernel

Parameters:
  • sigma1 (float) – standard deviation of first Gaussian kernel

  • sigma2 (float, optional) – standard deviation of second Gaussian kernel

  • h (int, optional) – half-width of Gaussian kernel

Returns:

2h+1 x 2h+1 kernel

Return type:

Kernel

Return the 2-dimensional difference of Gaussian kernel defined by two standard deviation values:

\[\mathbf{K} = G(\sigma_1) - G(\sigma_2)\]

where \(\sigma_1 > \sigma_2\). By default, \(\sigma_2 = 1.6 \sigma_1\).

The kernel is centred within a square array with side length given by:

  • \(2 \mbox{ceil}(3 \sigma) + 1\), or

  • \(2\mathtt{h} + 1\)

Example:

TypeError: unsupported operand type(s) for -: 'Kernel' and 'Kernel'
Note:
  • This kernel is similar to the Laplacian of Gaussian and is often used as an efficient approximation.

  • This is a “Mexican hat” shaped kernel

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

Seealso:

LoG Gauss