Kernel.LoG#
- classmethod Kernel.LoG(sigma, h=None)[source]#
Laplacian of Gaussian kernel
- Parameters:
sigma (float) – standard deviation of first Gaussian kernel
h (int, optional) – half-width of kernel
- Returns:
2h+1 x 2h+1 kernel
- Return type:
Return a 2-dimensional Laplacian of Gaussian kernel with standard deviation
sigma\[\mathbf{K} = \frac{1}{\pi \sigma^4} \left(\frac{u^2 + v^2}{2 \sigma^2} -1\right) e^{-(u^2 + v^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.LoG(1) >>> K Kernel: 7x7, min=-0.32, max=0.043, mean=9.6e-20, SYMMETRIC (LoG σ=1) >>> K.print() 0.00 0.00 0.01 0.01 0.01 0.00 0.00 0.00 0.02 0.04 0.04 0.04 0.02 0.00 0.01 0.04 0.00 -0.10 0.00 0.04 0.01 0.01 0.04 -0.10 -0.32 -0.10 0.04 0.01 0.01 0.04 0.00 -0.10 0.00 0.04 0.01 0.00 0.02 0.04 0.04 0.04 0.02 0.00 0.00 0.00 0.01 0.01 0.01 0.00 0.00
Example:
>>> Kernel.LoG(5, 15).disp3d()
(
Source code,png,hires.png,pdf)
Note
This is the classic “Mexican hat” shaped kernel
- References:
P. Corke, Robotics, Vision & Control for Python, Springer, 2023, Section 11.5.1.3.
- Seealso: