Returns a structuring element of the specified size and shape for morphological operations
elem = cv.getStructuringElement('OptionName', optionValue, ...)
Output
- elem Output structuring element of specified shape and size.
Options
- Shape Element shape, default 'Rect'. Could be one of:
- Rect a rectangular structuring element:
E(i,j)=1
- Cross a cross-shaped structuring element:
E(i,j)=1
if
i=Anchor(2)
or j=Anchor(1)
, E(i,j)=0
otherwise.
- Ellipse an elliptic structuring element, that is, a filled ellipse
inscribed into the rectangle
[0, 0, KSize(1), KSize(2)]
.
- KSize Size of the structuring element
[w,h]
. default [3,3].
- Anchor Anchor position within the element. The default value (-1,-1)
means that the anchor is at the center. Note that only the shape of a
cross-shaped element depends on the anchor position. In other cases the
anchor just regulates how much the result of the morphological operation
is shifted.
The function constructs and returns the structuring element that can be
further passed to cv.erode, cv.dilate or cv.morphologyEx. But you can also
construct an arbitrary binary mask yourself and use it as the structuring
element.