Image filters that are used in mathematical morphology typically require a structuring element or a series of structuring elements to define the bounds of the filter. Examples include the classical forms of the erosion, dilation, opening and closing filters, and cascades of such filters. However, openings and closings are defined by very general properties that do not necessitate the use of a set of fixed structuring elements. For example, attribute openings preserve only those connected components in an image that satisfy a specified criterion based on some shape attribute. The advantage with this approach is that the filter does not change the shape of the connected components in the image; it either removes them or leaves them as they are. The figure below shows an example. In Fig. 1(b) is the result of an attribute opening of the image in Fig. 1(a), using the criterion: must have an area greater than 200 pixels . Fig. 1(c) shows the result when the criterion is: must have a length greater than 50 pixels .
The notion of binary attribute openings can be extended to grey-scale images. The resulting filter satisfies the three required properties of an opening (idempotence, increasingness and anti-extensivity) but does not use a structuring element to define the bounds of the filter. The figure below shows conceptually how the grey-scale attribute opening works. The result of the opening is constructed from a maximum of connected openings, where each connected opening works on a regional maxima in the image. In Fig. 2(a) is shown the profile of a grey–scale image. The result for the connected component opening for the middle regional maximum shown is in Fig. 2(b), using the criterion: must have an area greater than 50 pixels (we have used this filter in graph-based image processing). Here, we have descended down though the threshold sets of the image that contain this middle regional maxima, removing those threshold sets that do not satisfy the given criterion. Shown in Fig. 2(c) is the complete opening, obtained by combining the results from the connected component openings working on the three regional maxima in the image.
By using criteria that are non-increasing we obtain attribute thinnings (filters that are idempotent, anti-extensive, but not necessarily increasing). The use of non-increasing criteria is seen as an important generalisation because it allows the use of non-increasing shape descriptors such as compactness and eccentricity to be applied to filter images. For example, in Fig. 3(a) is shown the Mona Lisa, from which we want to distinguish the face from the background. In Fig. 3(b) is shown the difference between the original image and a grey–scale thinning using the criterion: minor axis of the best–fit ellipse must be greater than 200 pixels . The thinning component of this filter allowed us to thin the brightness of the facial region in the image. Subtracting this result from the original image then highlights the face, but other small features are also retained, as shown in Fig. 3(b). In order to remove these, we finish by using a grey–scale thinning with the non-increasing criterion: major axis must be greater than 250 pixels (using a lesser value than 250 would have retained the chest region in the image). The result, shown in Fig. 3(c), shows the facial region distinguished from the background of the image. Note that this result is rotationally invariant because the criteria used are rotationally invariant.