StructuringElement

NI Vision for LabWindows/CVI Function

StructuringElement

The size and contents of a structuring element specify which pixels a morphological operation takes into account when determining the new value of the pixel being processed. For more information on structuring elements, refer to Chapter 9, Binary Morphology, in the NI Vision Concepts Manual.

For example, to set up the 3 x 3 kernel
1 0 1
1 0 1
1 0 1
called myStructuringElement, use the following syntax:
myStructuringElement.matrixCols = 3
myStructuringElement.matrixRows = 3
myStructuringElement.hexa = FALSE
myStructuringElement.kernel = malloc(9 * sizeof(int))
myStructuringElement.kernel[0] = 1
myStructuringElement.kernel[1] = 0
myStructuringElement.kernel[2] = 1
myStructuringElement.kernel[3] = 1
myStructuringElement.kernel[4] = 0
myStructuringElement.kernel[5] = 1
myStructuringElement.kernel[6] = 1
myStructuringElement.kernel[7] = 0
myStructuringElement.kernel[8] = 1

Elements

Name

Type

Description

matrixCols int Number of columns in the matrix.
matrixRows int Number of rows in the matrix.
hexa int Set this element to TRUE if you specify a hexagonal structuring element in kernel. Set this element to FALSE if you specify a square structuring element in kernel.
kernel int* The values of the structuring element. Specify these values in order from the top-left of the kernel to the bottom-right of the kernel.