StructuringElement Class
An immutable structuring element: the neighborhood of a pixel that the morphological filters read (ImageProcessingExtensions.Erode, ImageProcessingExtensions.Dilate and the operations made of them). It is flat: every pixel of the neighborhood counts the same.
public sealed class StructuringElementRemarks
The neighborhood is centered on the pixel and symmetric: it holds the offset (dx, dy) when it holds (-dx, -dy). A rectangle (StructuringElement.CreateRectangle) is filtered in two passes, a row then a column, in a time per pixel that does not depend on its size; an ellipse (StructuringElement.CreateEllipse), which rounds the corners, takes a time per pixel that grows with its height: every row is filtered once per distinct width of the rows of the ellipse, then each output sample compares one filtered sample per row of the ellipse.
Properties
| Name | Description |
|---|---|
| Height | Gets the number of pixels of a column of the bounding box, 2 RadiusY + 1. |
| RadiusX | Gets the number of pixels on each side of the center, horizontally. |
| RadiusY | Gets the number of pixels on each side of the center, vertically. |
| Width | Gets the number of pixels of a row of the bounding box, 2 RadiusX + 1. |
Height
StructuringElement.csRadiusX
StructuringElement.csRadiusY
StructuringElement.csMethods
| Name | Description |
|---|---|
| Contains(int, int) | Gets a value indicating whether the element holds an offset from its center. |
| CreateEllipse(int, int) | Creates an ellipse: the offsets (dx, dy) such that (dx / radiusX)^2 + (dy / radiusY)^2 <= 1, computed exactly in integers. With equal radii, it is the disk of scikit-image's morphology.disk(radius). A radius of 0 gives a line along the other axis. |
| CreateRectangle(int, int) | Creates a rectangle of 2 radiusX + 1 by 2 radiusY + 1 pixels: the neighborhood of ImageProcessingExtensions.MedianBlur when both radii are equal, and the rectangle of OpenCV's MORPH_RECT and of SciPy's size parameter. |
Contains(int, int)
StructuringElement.csCreateEllipse(int, int)
StructuringElement.csCreates an ellipse: the offsets (dx, dy) such that (dx / radiusX)^2 + (dy / radiusY)^2 <= 1, computed exactly in integers. With equal radii, it is the disk of scikit-image's morphology.disk(radius). A radius of 0 gives a line along the other axis.
public static StructuringElement CreateEllipse(int radiusX, int radiusY)Parameters
radiusXint- The number of pixels on each side of the center, horizontally, from 0 to 1000.
radiusYint- The number of pixels on each side of the center, vertically, from 0 to 1000.
Returns
StructuringElement The structuring element.
Exceptions
ArgumentOutOfRangeException- A radius is negative or exceeds 1000.
CreateRectangle(int, int)
StructuringElement.csCreates a rectangle of 2 radiusX + 1 by 2 radiusY + 1 pixels: the neighborhood of ImageProcessingExtensions.MedianBlur when both radii are equal, and the rectangle of OpenCV's MORPH_RECT and of SciPy's size parameter.
public static StructuringElement CreateRectangle(int radiusX, int radiusY)Parameters
radiusXint- The number of pixels on each side of the center, horizontally, from 0 to 1000.
radiusYint- The number of pixels on each side of the center, vertically, from 0 to 1000.
Returns
StructuringElement The structuring element.
Exceptions
ArgumentOutOfRangeException- A radius is negative or exceeds 1000.