Kernel.Box#
- classmethod Kernel.Box(h, normalize=True)[source]#
Square structuring element
- Parameters:
h (int) – half-width of kernel
normalize (bool, optional) – normalize volume of kernel to one, defaults to True
- Returns:
2h+1 x 2h+1 kernel
- Return type:
Returns a square kernel with unit volume.
The kernel is centred within a square array with side length given by \(2\mathtt{h} + 1\).
Example:
>>> from machinevisiontoolbox import Kernel >>> K = Kernel.Box(2) >>> K Kernel: 5x5, min=0.04, max=0.04, mean=0.04, SYMMETRIC (Box h=2) >>> K.print() 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 >>> Kernel.Box(2, normalize=False) Kernel: 5x5, min=1, max=1, mean=1, SYMMETRIC (Box h=2)
- References:
P. Corke, Robotics, Vision & Control for Python, Springer, 2023, Section 11.5.1.1.
- Seealso: