Kernel.Circle#
- classmethod Kernel.Circle(radius, h=None, normalize=False, dtype: DTypeLike = 'uint8')[source]#
Circular structuring element
- Parameters:
radius (scalar, array_like(2)) – radius of circular structuring element
h (int) – half-width of kernel
normalize (bool, optional) – normalize volume of kernel to one, defaults to False
dtype (str or NumPy dtype, optional) – data type for image, defaults to
uint8
- Returns:
2h+1 x 2h+1 circular kernel
- Return type:
Returns a circular kernel of radius
radiuspixels. Sometimes referred to as a tophat kernel. Values inside the circle are set to one, outside are set to zero.If
radiusis a 2-element vector the result is an annulus of ones, and the two numbers are interpreted as inner and outer radii respectively.The kernel is centred within a square array with side length given by \(2\mathtt{h} + 1\).
Example:
>>> from machinevisiontoolbox import Kernel >>> K = Kernel.Circle(2) >>> K Kernel: 5x5, min=0, max=1, mean=0.52, SYMMETRIC (Circle r=2) >>> K.print() 0.00 0.00 1.00 0.00 0.00 0.00 1.00 1.00 1.00 0.00 1.00 1.00 1.00 1.00 1.00 0.00 1.00 1.00 1.00 0.00 0.00 0.00 1.00 0.00 0.00 >>> Kernel.Circle([2, 3]) Kernel: 7x7, min=0, max=1, mean=0.41, SYMMETRIC (Circle r=[2. 3.])
- References:
P. Corke, Robotics, Vision & Control for Python, Springer, 2023, Section 11.5.1.1.
- Seealso: