Kernel.DGauss#
- classmethod Kernel.DGauss(sigma, h=None)[source]#
Derivative of Gaussian kernel
- Parameters:
sigma (float) – standard deviation of Gaussian kernel
h (int, optional) – half-width of kernel
- Returns:
2h+1 x 2h+1 kernel
- Return type:
Returns a 2-dimensional derivative of Gaussian kernel with standard deviation
sigma\[\mathbf{K} = \frac{-x}{2\pi \sigma^2} e^{-(x^2 + y^2) / 2 \sigma^2}\]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:
>>> from machinevisiontoolbox import Kernel >>> K = Kernel.DGauss(1) >>> K Kernel: 7x7, min=-0.097, max=0.097, mean=-4.3e-19 (DGauss σ=1) >>> K.print() 0.00 0.00 0.00 -0.00 -0.00 -0.00 -0.00 0.00 0.01 0.01 -0.00 -0.01 -0.01 -0.00 0.00 0.03 0.06 -0.00 -0.06 -0.03 -0.00 0.01 0.04 0.10 -0.00 -0.10 -0.04 -0.01 0.00 0.03 0.06 -0.00 -0.06 -0.03 -0.00 0.00 0.01 0.01 -0.00 -0.01 -0.01 -0.00 0.00 0.00 0.00 -0.00 -0.00 -0.00 -0.00
Example:
>>> Kernel.DGauss(5, 15).disp3d()
(
Source code,png,hires.png,pdf)
Note
This kernel is the horizontal derivative of the Gaussian, \(dG/dx\).
The vertical derivative, \(dG/dy\), is the transpose of this kernel.
This kernel is an effective edge detector.
- References:
P. Corke, Robotics, Vision & Control for Python, Springer, 2023, Section 11.5.1.3.
- Seealso: