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:

Kernel

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:
Seealso:

Circle