# Structuring Elements

Morphology operators use a structuring element to process the input image. In a typical case, a morphology operator examines the grey value at each pixel and its eight neighboring pixels using the boundary defined by a structuring element 3 pixels high and 3 pixels wide, as shown in the following figure:

During an erosion operation, the minimum value of all the pixels becomes the grey value in the output image at the pixel corresponding to the center of the structuring element. A dilation operation takes the opposite approach, using the maximum value for the output image.

By default, a morphology operator uses a flat structuring element, which does not add or subtract from the original values in the input image. VisionPro supports a set of six different flat 3x3 structuring elements for use in either QuickBuild or your Dev Studio application:

By default, the morphology operator uses a 3x3 square structuring element, but you can specify a different shape. In general, you should choose a structuring element based on the shape of the features you are interested in enhancing or reducing.

In addition to the six supported structuring elements, you can choose to design your own custom structuring element and define a different shape. Your custom structuring element can also be populated with positive or negative values in the range -128 to 127. Using a non-flat structuring element will modify how the morphology operator will perform an erosion or dilation. In an erosion, the values in the structuring element are subtracted from the pixels in the input image, while the values are added to the input image during a dilation as illustrated in the following figure:

QuickBuild supports the custom structuring element through the One Image Edit Control while the VisionPro API supports the MemberMask property to define the members of the 3x3 structuring element you do not want the operator to consider. You will have to experiment with custom structuring elements to discover the best values for your application.