Keywords

1 Introduction

The prior work on Mathematical Morphology has been done by Minkowski [12], Dineen [2], Kirsch [8] and others. Mathematical morphology has been formalized since the 1960s. Matheron [11] and Serra [20], at the Centre de Morphologies, found out geometry and edge properties of ores (see also [3, 5, 22]). Notice that already in the 1960s the hexagonal lattice was involved to this field by Golay [4]. There are several places where digital image processing and mathematical morphology are applied, such as various medical fields, remote sensing, robot vision, video processing, color processing, image sharpening, and restoration. Mathematical morphology provides a quantitative description of geometric structure and shape of the objects. In computer imaging and in computer vision, mathematical morphology is applied for extracting image components that are useful in description and representation of the shapes of the objects [21].

In the 2d square grid, a binary image is a finite set of elements of \( Z^{2} \). The elements of the grid are called pixels and are addressed with two coordinate values \( (x, y) \). Each pixel has value zero or one. Pixels with value one form the foreground and they are usually represented by black color; while value zero (background) pixels are represented by white color. The basic binary morphological operations, the dilation and the erosion have been defined on the square grid by using two images. One of them is the active (or current) image; it is the image of the object we are interested in. The other one is called structuring element, and the active image is examined/modified by its help [21]. The structuring element has its size and shape, and it is used to redefine the shape of the original image.

In digital geometry, pixels (sometimes they are also referred as points) are addressed by integer coordinate values. The square grid is often used in various applications, since the well-known Cartesian coordinate system (that is a part of standard elementary mathematics) describes it. To use another grid in image processing and/or in computer graphics one needs a good, manageable coordinate system. Image processing on the hexagonal lattice is also investigated due to some of its pleasant properties, e.g., there is only one type of usual neighbor relation among pixels (they are also called hexels in this case), and the grid has better symmetric properties than the square grid. The pixels of the hexagonal grid can be addressed with two integers [10], but there is a more elegant solution using three coordinate values and obtaining a symmetric description: addressing hexagons by zero-sum triplets [6]. Similarly, the triangular grid is described by three coordinates [13,14,15,16, 18] as it is shown in Fig. 1. There are two orientations of the used triangle pixels, the sum of their coordinate values is zero and one, and they are called even and odd points (pixels), respectively. There are three types of usual neighborhood relations on the triangular grid [1], for formal description see Sect. 3.

Fig. 1.
figure 1

Symmetric coordinate frame for triangle pixels on a triangular grid.

In digital binary image processing, apart from the traditional square grid, non-traditional grids, such as the triangular grid, are also used [1, 7, 9, 17, 18, 20]. The hexagonal and the triangular grids have more symmetry axes than the square grid has. In addition, rotations with a smaller angle (60°) can transform these non-traditional grids to themselves than the angle (90°) needed for a similar transformation on the square grid. Due to these better symmetric properties, the triangular grid could overperform the traditional square grid in various applications. Another reason to support the triangular grid is that the various types of neighbor relations give more freedom in applications. As we have already mentioned, morphological operations are studied and used on the square and on the hexagonal grid, however, up to our knowledge, there is a lack of the theory on the triangular grid. Here we will study the concepts of dilation and erosion extrapolating them to the triangular grid. We use the general approach given, e.g., in [21]. Morphological binary image processing deals with two-dimensional pictures (arrays) containing zeros and ones representing pixels with values either white or black. Since the square grid is a lattice, there are various equivalent expressions for dilation and erosion, the roles of pixels and grid vectors can easily be interchanged, one could add the vectors (addresses) of any two points resulting a point in the grid. Opposite to this, in the triangular grid, the situation is different; this grid is not a lattice. In this paper, we will give various types of approaches, different definitions for both dilation and erosion. In next section, we recall the basic definitions used in the square grid. In Sect. 3 we will give a formal description of the triangular grid. In Sect. 4 we will provide the definitions and results on dilation in the triangular grid. In Sect. 5 we give the essential definitions and results on erosion. In Sect. 6 various properties of dilations and erosions are shown. Finally, conclusions close the paper.

2 Preliminaries

In this section, we recall the core definitions of binary morphology on traditional grids (using the terminology of [3, 5, 21]). These definitions are apt for lattices. An image was delineated in Euclidean space as a set of a correspondent vectors. Let \( E^{N} \) be \( N \)-dimensional Euclidean space (it could be discrete \( Z^{N} \) or continuous \( R^{N} \)) where \( E^{N} \) is the set of all points \( p = (x_{1} , \ldots ,x_{N} ) \) in \( E^{N} \). Since we are interested in digital images, i.e., images in the discrete space, we may consider in most cases that our space is \( Z^{N} \). A binary image \( A \) is a subset of the binary space \( E^{N} , \) where the value of each point \( p \) of \( E^{N} \) is either black or white: \( p \) is black if and only if \( p \in A \), otherwise \( p \) is white.

Definition 1.

Let \( A \subset E^{2} \) be a binary image. If \( A = \emptyset \), then \( A \) is empty (sometimes is also called null). Otherwise, a pixel of the image \( a \in A \) is addressed by a vector \( (x, y) \).

Definition 2.

Let \( A \subset E^{2} \) be a binary image, the complement of \( A \) is also a binary image, it is defined by \( A^{c} = \{ p:p \notin A\} \), i.e., it is obtained by interchanging the roles of black and white pixels.

Definition 3.

Let \( A \subset E^{2} \), the reflection of an image \( A \) is denoted by \( \hat{A} \) and it is defined by \( \hat{A} = \left\{ {p:p = - a,\forall a \in A} \right\} \).

Note here the important fact that \( \hat{A} \subset E^{2} \) on the square grid.

Definition 4.

The union of two binary images \( A, B \subset E^{2} \) is a binary image such that a pixel is black if it is black in \( A \) or in \( B \), formally, \( A \cup B = \{ p: p \in A\,{\text{or}}\,p \in B\} \).

Definition 5.

The intersection of two binary images \( A,B \subset E^{2} \) is a binary image containing those pixels that are black both in \( A \) and in \( B \), i.e., \( A \cap B = \{ p: p \in A , p \in B\} \).

Definition 6.

Let \( A \subset E^{N} \), \( b \in E^{N} \), then the translation of \( A \) by \( b \), denoted by \( (A)_{b} \) is defined as \( (A)_{b} = \{ p \in E^{N} :p = a + b,{\text{for}}\,{\text{some}}\,a \in A\} \).

Definition 7.

Let \( A,B \subset E^{N} \), the binary dilation of \( A \) by structuring element \( B \) is denoted by \( A \oplus B \), \( A \oplus B = \{ p:p = a + b, \exists \,a\, \in A,b \in B\} \). It can also be defined by \( A \oplus B = \bigcup\nolimits_{b \in B} {A_{b} = \bigcup\nolimits_{a \in A} {B_{a} } } . \)

Note here the similar and interchangeable role of the image A and the structuring element B on the square grid.

Definition 8.

Let \( A,B \subset E^{N} \), the binary erosion of \( A \) by structuring element \( B \) is denoted by \( A\,{ \ominus }\,B \). Formally, it is \( A\,{ \ominus }\,B = \left\{ {p:p + b \in A,\forall b \in B} \right\} \), it can be written, equivalently, \( A\,{ \ominus }\,B = \bigcap\nolimits_{b \in B} {A_{ - b} } \).

3 Definitions and Notation on Triangular Grid

The triangular grid, based on [13, 14, 16, 18], is described by a symmetric coordinate system addressing every pixel by a coordinate triplet. The origin, as a pixel, is addressed by (0, 0, 0). The coordinate axes are lines cutting this pixel to halves (see Fig. 1). They are directed such that their angles are 120°. Every pixel, as a triangle, has three closest neighbor pixels sharing one of the sides of the triangle. Notice that, although each pixel is a triangle, there are two different orientations of them: \( \Delta \), \( {\nabla } \). A pixel and its closest neighbors have opposite orientations. From a pixel having coordinates \( (x, y,z) \) with \( x + y + z = 0 \), its closest neighbor pixels can be reached by a step to the direction of one of the coordinate axes. Consequently, the respective coordinate value is increased by one: the three neighbors are addressed by \( (x + 1, y,z) \), \( \left( {x, y + 1,z} \right) \), and \( (x, y,z + 1) \), respectively. For a pixel \( (x, y,z) \) with \( x + y + z = 1 \), its closest neighbor pixels can be reached by a step to the direction opposite to one of the coordinate axes, and thus, the three neighbors are addressed by \( (x - 1, y,z) \), \( \left( {x, y - 1,z} \right) \), and \( \left( {x, y,z - 1} \right) \). In this way, all pixels of orientation \( \Delta \) are addressed by triplets with zero sum (they are called even pixels), while the pixels of orientation \( {\nabla } \) have triplets where the sum of the coordinate values is one (they are the odd pixels). There are three types of neighborhood relations [1]: two triangles are 1-neighbours if they share a side, i.e., an edge of the grid. They are exactly the closest neighbors. Two triangles are strict 2-neighbours if they have a common 1-neighbor triangle. Two pixels are strict 3-neighbours if they share exactly one point on their boundaries (vertex of the grid) but they are not 2-neighbors. See also, Fig. 2, where these three types of neighbors are shown for an even pixel. Each pixel has three 1-neighbours, nine 2-neighbours (including 1-neighbours and six strict 2-neighbours) and twelve 3-neighbours (the nine 2-neighbours and three strict 3-neighbours). Actually, the coordinate triplets of two strict k-neighbor (k = 1, 2, 3) pixels mismatch exactly in k places, and the difference in each mismatch position is ±1. Triplets of two k-neighbor pixels could mismatch at most in k places and the difference in each mismatch position is ±1. As an example, consider the pixel having triplet (1, 1, −1). As one can also observe in Fig. 1, its three 1-neighbors are addressed by the coordinate triplets (0, 1, −1), (1, 0, −1) and (1, 1, −2). The strict 2-neighbors are (0, 1, 0), (1, 0, 0), (2, 0, −1), (2, 1, −2), (1, 2, −2) and (0, 2, −1). Further, (0, 0, 0), (2, 0, −2) and (0, 2, −2) are addressing the strict 3-neighbors of the pixel (1, 1, −1).

Fig. 2.
figure 2

Various neighborhood relations on the triangular grid of a pixel \( \delta \).

We will use the notation \( G \) for the triangular grid, we also use the notation \( G^{\Delta } \) for the set of even pixels of \( G \) (\( G^{\Delta } \subset G \)), and \( G^{\nabla } \) for the set of odd pixels of \( G(G^{\nabla } \subset G) \). We should notice that \( \emptyset = G^{\Delta } \cap G^{\nabla } \) and \( G = G^{\Delta } \cup G^{\nabla } \). Notice that the triangular grid can also be seen as a special subset of the cubic lattice, i.e., \( G \subset Z^{3} \) [14, 15]. We may also call vectors the elements of \( Z^{3} \), and specially, even and odd vectors for those that are also elements of \( G \).

Translations on Triangular Grid

First, we recall an important observation from [16] reflecting the fact that the triangular grid is not a lattice.

Proposition 1.

Translation with vector \( v (x, y, z) \) maps the grid to itself if and only if \( x + y + z = 0 \), i.e., the coordinate sum of the vector equals to zero.

One can easily establish the following simple, but important facts.

Proposition 2.

Addition of two points \( p_{1} (x_{1} ,y_{1} ,z_{1} ) \), \( p_{2} (x_{2} ,y_{2} ,z_{2} ) \) in G results \( p_{1} \left( {x_{1} ,y_{1} ,z_{1} } \right) + p_{2} \left( {x_{2} ,y_{2} ,z_{2} } \right) = p(x_{1} + x_{2} ,y_{1} + y_{2} ,z_{1} + z_{2} ) \). The resulting point is in the triangular grid if

  1. 1.

    \( p_{1} ,p_{2} \in G^{\Delta } \), then \( p_{1} + p_{2} \in G^{\Delta } \).

  2. 2.

    \( p_{1} \in G^{\nabla } ,p_{2} \in G^{\Delta } \), then \( p_{1} + p_{2} \in G^{\nabla } \).

  3. 3.

    \( p_{1} \in G^{\Delta } ,p_{2} \in G^{\nabla } \), then \( p_{1} + p_{2} \in G^{\nabla } \).

Proposition 3.

  1. 1.

    Let \( p_{1} \in G^{\Delta } \), then \( - (p_{1} ) \in G^{\Delta } \).

  2. 2.

    Let \( p_{2} \in G^{\nabla } \), then \( - (p_{2} ) \notin G \), but if it is allowed to use it, \( - \left( { - \left( {p_{2} } \right)} \right) = p_{2} \).

  3. 3.

    If \( p_{1} \in G^{\Delta } , \) \( p_{3} \in G^{\Delta } \), then \( - (p_{1} ) + p_{3} = p_{3} + ( - (p_{1} )) = p \in G^{\Delta } \).

  4. 4.

    If \( p_{2} \in G^{\nabla } ,p_{1} \in G^{\Delta } \), then \( - \left( {p_{2} } \right) + p_{1} = p_{1} + ( - \left( {p_{2} } \right)) = - (p) \), with \( p \in G^{\nabla } \).

  5. 5.

    If \( p_{1} \in G^{\Delta } ,p_{2} \in G^{\nabla } , \) then \( - (p_{1} ) + p_{2} = p_{2} + ( - (p_{1} )) = p \), where \( p \in G^{\nabla } \).

  6. 6.

    If \( p_{2} ,p_{4} \in G^{\nabla } \), then \( - (p_{2} ) + p_{4} = p_{4} + ( - (p_{2} )) = p \), where \( p \in G^{\Delta } \).

Remark 1.

If \( p_{1} \in G^{\nabla } ,p_{2} \in G^{\nabla } \), then \( p(x,y,z) = p_{1} (x_{1} + y_{1} + z_{1} ) + p_{2} (x_{2} + y_{2} + z_{2} ) \notin G \) since the sum of coordinate values of \( p \) is equal to 2 (\( x + y + z = 2 \)). This operation can be allowed but keeping in mind that the resulted point is not in the grid.

Example 1.

Let \( p_{1} = ( - 1,1,1) \), \( p_{2} = (0,1,0) \), then \( p_{1} + p_{2} = ( - 1,2,1) \notin G \).

The result of a translation of an odd point by another odd point is not in the grid. This type of translations does not map the grid into itself: this grid is not a lattice and therefore, the extensions of the morphological operations to the triangular grid are not straightforward. In next section, we recommend some possible definitions for dilation and erosion solving various ways the above problem.

4 Concepts of Dilation on the Triangular Grid

Since the grid is not a lattice, the types of points of the structuring element play importance. By the first and simplest solution, it is allowed to use only such transformations of the image which gives the resulted points inside the grid: the image points can be translated only by even point(s). See the case of strict dilation. The second option is when the translation is allowed by odd points which may produce point(s) outside of the grid (see weak and strong dilations which allow that option also).

Definition 9.

Let \( A \subset G, B \subset G^{\Delta } \), then the strict dilation of \( A \) by set \( B \) is defined as \( {\text{A}} \oplus_{\Delta } {\text{B}} = \{ p \in G:p\left( {x,y,z} \right), x = x_{1} + x_{2} , y = y_{1} + y_{2} , z = z_{1} + z_{2} ,\exists\ p_{1} \left( {x_{1} ,y_{1} ,z_{1} } \right) \in A,p_{2} \left( {x_{2} ,y_{2} ,z_{2} } \right) \in B\} \). The notation refers for the fact that the structuring element must contain only even vectors.

Example 2.

Let \( A = \{ \left( {0,2, - 1} \right),\left( {0,2, - 2} \right),\left( {0,3, - 2} \right),\left( { - 1,2, - 1} \right),\left( { - 1,3, - 2} \right),(-1,3, - 1)\} \) be a binary image (its points have the value equal to one, their color is black). Now, let \( B = \{ \left( {0, - 1,1} \right),\left( {1, - 1,0} \right)\} \), then \( A \oplus_{\Delta } B = \{ \left( { - 1,1,0} \right),\left( {0,2, - 1} \right),\left( {1,1, - 1} \right),\left( {1,1, - 2} \right),\left( {0,2, - 2} \right),\left( {0,2, - 1} \right),\left( { - 1,2, - 1} \right),\left( {0,1,0} \right),\left( {-1,2,0} \right),\left( {0,1, - 1} \right),(1,2, - 2)\} \). See Fig. 3.

Fig. 3.
figure 3

Strict dilation (Example 2) with the structuring element \( B \subset G^{\Delta } \).

The idea of strict dilation is a restriction on the structuring element B: to force the resulted pixels to be in G, the condition \( B \subset G^{\Delta } \) is applied.

Definition 10.

Let \( A,B \subset G \), then the weak dilation of \( A \) by the set \( B \) is defined by \( A \oplus_{w} B = (A \oplus B) \cap G \) where \( A \oplus B = \bigcup\nolimits_{p \in A} {B_{p} = \bigcup\nolimits_{p \in B} {A_{p} } } \) as vector addition of 3-dimensional vectors.

In weak dilation we keep only those resulted vectors that belong to the grid \( G \).

Example 3.

Let \( A = \left\{ {\left( {2, - 1,0} \right),\left( {1, - 1,0} \right),\left( {1,0,0} \right)} \right\} \), \( B = \{ \left( { - 2,1,1} \right),\left( { - 1,1,1} \right),\left( { - 1,1,0} \right)\} \). Then \( A \oplus B = \{ \left( {0,1,1} \right),\left( { - 1,1,1} \right),\left( {1,0,0} \right),\left( {0,0,1} \right),\left( {1,0,1} \right),\left( { - 1,0,1} \right),\left( {0,0,0} \right),(0,1,0)\} \). We have here points, e.g., \( (0,1,1) \) such that the sum of its coordinate values equals to 2. These points are removed and do not appear in \( A \oplus_{w} B \), thus the result is \( A \oplus_{w} B = \{ \left( { - 1,1,1} \right),\left( {1,0,0} \right),\left( {0,0,1} \right),\left( { - 1,0,1} \right),\left( {0,0,0} \right),(0,1,0)\} \) (Fig. 4).

Fig. 4.
figure 4

Example for weak dilation by resulting only points belong to G and deleting the other points that do not belong to G, i.e., (1, 0, 1) and (0, 1, 1).

Notice that in weak dilation some points could be lost, and thus, information can also be lost. Not to lose information because of this phenomenon, we introduce:

Definition 11.

Let \( A, B \subset Z^{3} \), then the strong dilation of A by the set B is defined by \( A \oplus_{s} B = A \oplus B \), keeping also the resulted points outside of G, but displaying only points which belong to grid G: \( p \in (A \oplus B) \cap G \).

Example 4.

Let \( B = \{ \left( {0,0,0} \right)\left( {0,1,0} \right)\} \), \( A = \{ \left( {6,0, - 6} \right),\left( {7,0, - 6} \right),\left( {7,0, - 7} \right),\left( {7,1, - 7} \right),\left( {6,1, - 7} \right)\} \). Then, \( A \oplus_{s} B = \{ (6,0, - 6),(7,0, - 6),(7,0, - 7),(7,1, - 7),\left( {6,1, - 7} \right), \left( {6,1, - 6} \right),\left( {7,1, - 6} \right),\left( {7,2, - 7} \right),(6,2, - 7)\} \) (Fig. 5).

Fig. 5.
figure 5

An example of strong dilation by displaying resulted points \( p \in G \) and keep the other points \( p \notin G \) in the result of \( A \oplus_{s} B \).

5 Concepts of Erosion on the Triangular Grid

Erosion is an operation of mathematical morphology that combines two sets by using vector subtraction. The original aim of the erosion is to shrink the active image (or simply image) by using a structuring element. Thus, it is a kind of translation that shifts the structuring element totally inside the active image. Originally, there are two types of definitions. The Minkowski decomposition is defined by \( A\,{ \ominus }\,B = \{ p:B_{p} \subset A\} = \left\{ {p \in G :a + b \in A, \forall b \in B} \right\} \); the other definition is \( A\,{ \ominus }\,B = \bigcap\nolimits_{b \in B} {A_{ - b} } \), this latter one is more general in the sense that it gives all possible solutions or possible positions that make \( B \) inside \( A \). We should notice that working on the triangular grid, some of these positions might not be inside the grid (see Sect. 3). Now we give various definitions of erosion according to possible types of transformations.

Remark 2.

For any point (vector), \( p(x,y,z) \in G \) we are using the notation \( - p( - x, - y, - z) \) for its inverse, as a kind of 3-dimensional reflection. However, we should notice that it is not a rotation by 180 degrees, as the analogous transformation was on the square grid. Moreover, it is not even a transformation of the triangular grid, since it maps odd points to triplets with sum −1, and they are clearly not points in G. Even the inverse of an odd element is not in \( G \), we could use it, e.g., in a strong dilation to have some effect. We note here that in the triangular grid rotation having center in the Origin (at the meeting point of the axes) can be used only if the degree is a multiplier of 120° (and 180° is not like that). There are also other types of mirroring and rotations on the triangular grid, e.g., with the center in the corner of a pixel [16].

Definition 12.

Let \( A,B \subset G \) where \( B \subset G^{\Delta } \), then the strict erosion of the image A by structuring element B is defined by \( A\,{ \ominus }_{\Delta } \,B = \{ p:p + b \in A,\forall b \in B\} \).

In strict erosion it is guaranteed that each vector p obtained in this way is automatically belonging to the grid G, i.e. \( p \in G \). To guarantee this fact a restriction is used for the structuring element, namely its inverse also belonging to the grid.

Remark 3.

In this case, we can use the alternative definition, the necessary translations are defined, \( A\,{ \ominus }_{\Delta } \,B = \bigcap\nolimits_{b \in B} {A_{ - b} } \): the resulting image is in \( G \).

Example 5.

Let \( B = \left\{ {\left( {0,0,0} \right),\left( {0,1, - 1} \right)} \right\} \) and let \( A = \{ \left( { - 1,0,1} \right),\left( { - 1,1,1} \right),\left( { - 2,1,1} \right),( - 1,1,0)\} \). Then \( {\text{A}}\,{ \ominus }_{\Delta } \,{\text{B}} = \{ \left( { - 1,0,1} \right)\} \) (Fig. 6).

Fig. 6.
figure 6

Example 5: strict erosion with property \( {\text{A}}{ \ominus }_{\Delta } {\text{B}} \subset {\text{A}} \).

Definition 13.

Let \( A \), \( B \subset G \), then the weak erosion of the image A with structuring element B is defined by \( A\,{ \ominus }_{w} \,B = (A\,{ \ominus }\,B) \cap G \), where \( A\,{ \ominus }\,B = \{ p :p + b \in A,\forall b \in B\} \).

We keep and display only points that belong to G and satisfy \( p + b \in A, {\text{for}} \,\forall \,b \in B \) and delete the other points of \( A\,{ \ominus }\,B \) that do not belong to \( G \).

Remark 4.

There could be vectors p not belonging to G, but satisfying \( p + b \in A \). If the result of A ⊖ B contains vectors with the sum −1, then by weak erosion, these points are lost and there might be nothing to display (see Example 6).

Example 6.

Let \( A = \{ \left( { - 3,1, 2} \right), \left( {2,0, - 2} \right), \left( {3, 0, - 3} \right)\} \), \( B = \{ (1,0,0)\} \). Then, \( A\,{ \ominus }\,B = \{ \left( { - 4,1,2} \right),\left( {1,0, - 2} \right),\left( {2,0, - 3} \right)\} \) and \( A\,{ \ominus }_{w} \,B = \emptyset \).

Fig. 7.
figure 7

Example 7 is shown: a weak erosion.

Example 7.

Let \( A = \{ \left( {3, - 1, - 1} \right),\left( {2, - 1, - 1} \right),\left( {2,0, - 1} \right),\left( {2,0, - 2} \right), \left( {3,0, - 2} \right),\left( {3, - 1, - 2} \right)\} \), \( B = \{ (0,0,1)\} \). Then, A ⊖ B = {(3, −1, −2), , (2, 0, −2), , (3, 0, −3), } and thus, \( A\,{ \ominus }_{w} \,B = \{ \left( {3 , - 1 , - 2} \right),\left( {2 , 0 , - 2} \right), \left( {3 , 0 , - 3} \right)\} \). (The shaded elements of \( A\,{ \ominus }\,B \) have coordinate sum −1, they are lost.) (Fig. 7)

Not to lose some of the information one can use the strong erosion:

Definition 14.

Let \( A \), \( B \subset Z^{3} \) then the strong erosion is defined by \( A\,{ \ominus }_{s} \,B = \{ p: p + b \in A, \forall b \in B\} \). It can be written as \( A\,{ \ominus }_{s} \,B = \{ p \in G: p + b \in A, \forall b \in B\} \cup \{ p \notin G: p + b \in A, \forall b \in B\} \) by having the pixels that can be displayed (points which belong to \( G \) and satisfy \( p + b \in A \) for every \( b \in B \)) and keeping also all the other points which do not belong to \( G \), but satisfy \( p + b \in A\, {\text{for}} \) every \( b \in B \).

Notice that in strong erosion, similarly to the strong dilation, it is not required that A and B are in G, instead all integer triplets are allowed, but only those triplets can be displayed that are element of G.

Example 8.

In Example 7 we have seen that A ⊖ B = {(3, −1, −2), , (2, 0, −2), , (3, 0, −3), }. Here we keep vectors outside of the grid, e.g., with sum of coordinate values equal to −1: (2, 0, −3), (3, −1, −3), (2, −1, −2), but we can display only those resulting points which are in the grid (\( p \in G \)).

6 Properties of Dilation and Erosion

In this section we list the basic properties of dilation and erosion. These properties are well known on the Euclidean space [3, 5, 20,21,22].

Let \( A,B,C,D \subset E \) where \( E \) is the Euclidean space, assume that all of these four sets can play the role of the active (e.g., input) image and also the role of the structuring element. (This is a usual and valid assumption on lattices.)

Let \( O \) be the origin of \( E \) and let \( p, t \in E \).

Dilation Properties

We should know the following facts: for any arbitrary subset \( A \) of \( E \), and for the empty set \( \emptyset \), where \( E \) is the whole Euclidean space, \( A \oplus \emptyset = \emptyset \), \( E \oplus A = A \oplus E = E \). Moreover, if \( A \oplus B = \emptyset \), then at least one of A or B is the empty set \( \emptyset \).

  • Property 1.a \( A \oplus \left\{ O \right\} = A \). 1.b \( A \oplus \left\{ O \right\} = \{ O\} \oplus A \). (Unit element)

  • Property 2.a \( A \oplus \left\{ p \right\} = \left\{ p \right\} \oplus A \). 2.b \( A \oplus \left\{ p \right\} = A_{p} \).

  • Property 3. If \( D \) contains the origin \( O \), then \( A\, \subseteq \,A \oplus D \).

  • Property 4. \( A \oplus C = C \oplus A \). (Commutativity)

  • Property 5. \( B \oplus \left( {A \oplus C} \right) = (B \oplus A) \oplus C \). (Associativity)

  • Property 6.a \( (A)_{p} \oplus C = \left( {A \oplus C} \right)_{p} \). 6.b \( A \oplus (C)_{p} = \left( {A \oplus C} \right)_{p} \). (Translation invariance)

  • Property 7. \( \left( A \right)_{p} \oplus \left( C \right)_{ - p} = A \oplus C \).

  • Property 8. If \( A\, \subseteq \,B \), then \( A \oplus C\, \subseteq \,B \oplus C \). (Increasing property, monotonicity)

  • Property 9. \( (A \cap B) \oplus C\, \subseteq \,(A \oplus C) \cap (B \oplus C) \).

  • Property 10. \( \left( {A \cup B} \right) \oplus C = (A \oplus C) \cup (B \oplus C) \). (Distributivity over union of images)

  • Property 11. \( A \oplus \left( {C \cup D} \right) = (A \oplus C) \cup (A \oplus D) \).

  • Property 12. \( A \oplus \left( {C \cap D} \right)\, \subseteq \,(A \oplus C) \cap (A \oplus D) \).

Erosion Properties

We should know also that for an arbitrary subset \( A \) of \( E \), \( A\,{ \ominus }\,\emptyset = E \), \( \emptyset \,{ \ominus }\,A = \emptyset \), \( E\,{ \ominus }\,A = E \). Let us see the other well-known facts involving erosion.

  • Property 1. If \( C \) contains the origin, then \( A\,{ \ominus }\,C \subseteq A \).

  • Property 2. \( A\,{ \ominus }\,C \ne C\,{ \ominus }\,A \). (Not commutative)

  • Property 3. \( (A)_{t} \,{ \ominus }\,C = (A\,{ \ominus }\,C)_{t} \). (Translation invariance)

  • Property 4. If \( A \subseteq B \), then \( A\,{ \ominus }\,C \subseteq B\,{ \ominus }\,C \). (Increasing property, monotonicity)

  • Property 5. \( B\,{ \ominus }\,\left( {A \oplus C} \right) = \left( {B\,{ \ominus }\,A} \right)\,{ \ominus }\,C \).

  • Property 6. \( B \oplus (A\,{ \ominus }\,C) \subseteq \left( {B \oplus A} \right)\,{ \ominus }\,C \).

  • Property 7. \( \left( {A \cap B} \right)\,{ \ominus }\,C = \left( {A\,{ \ominus }\,C} \right) \cap \left( {B\,{ \ominus }\,C} \right) \). (Distributivity over intersection)

  • Property 8. \( (A \cup B)\,{ \ominus }\,C \supseteq (A\,{ \ominus }\,C) \cup (B\,{ \ominus }\,C) \).

  • Property 9. \( A\,{ \ominus }\,\left( {C \cup D} \right) = \left( {A\,{ \ominus }\,C} \right) \cap \left( {A\,{ \ominus }\,D} \right) \).

  • Property 10. \( A\,{ \ominus }\,\left( {C \cap D} \right) \supseteq (A\,{ \ominus }\,C) \cup (A\,{ \ominus }\,D) \).

  • Property 11. \( A\,{ \ominus }\,(C)_{t} = (A\,{ \ominus }\,C)_{ - t} \).

6.1 Properties of Dilation and Erosion on the Triangular Grid

Tables 1 and 2 summarize which properties of the operations are inherited to the triangular grid using various definitions of the dilations and erosions, respectively. Let A and B be images, C and D be structuring elements based on various definitions of dilation and erosion on the triangular grid. Let p and t are arbitrary three-dimensional vectors. In some cases, to have well defined expressions, conditions are applied. As we can see, some of the properties hold only with some additional conditions.

Table 1. Summary of dilation properties according to their definitions.
Table 2. Summary of erosion properties according to their definitions.
  • \( \checkmark \) the property holds on the triangular grid without any additional conditions.

  • \( \Delta \) the strict dilation is defined only with the condition \( A \subset G^{\Delta } \). With this condition all the expressions are defined and the property holds.

  • \( p^{\Delta } \) the translation is defined with the condition that \( p \) is even pixel. If it is so, then the property holds.

  • + the property is fulfilled, but the result could be the empty set.

  • p the property holds with the condition \( p \in G^{\Delta } \).

Note that in strict dilation the definition already has a constraint on the structuring element: it can contain only even pixels (zero-sum coordinate triplets). While in case of weak dilation, any subset of G can be used as structural element; and the most general definition, the strong dilation allows any set of three-dimensional vectors (a constraint is applied only on the displayable part of the sets).

Since strict dilation is defined only with structural elements having no odd pixels, some of the expressions in some properties are well formed, i.e., defined only for images consisting only even pixels, e.g., properties 1.b, 2.a. We note here that constraining the work to \( G^{\Delta } \), i.e., to even pixels, one gets a structure that is equivalent to the hexagonal tessellation: the three-dimensional vectors with zero-sum describes exactly the hexagonal grid [6].

At weak dilations we allow to use only the elements of the grid G. Consequently, to allow using both p and −p, these translations must be by zero-sum vectors. These vectors transform the grid into itself, and thus this condition is applied at property 7, similarly to the strict case. The other properties of dilation hold without any additional condition for the weak dilations, however in most cases it may happen that an expression results the empty set, even in case when both the image and the structuring element contain some pixels. It could happen if odd pixels appear in the expressions. We show some examples.

In property 2 the empty set is obtained if and only if \( A \subset G^{\nabla } ,p \in G^{\nabla } \). For example, let \( A = \{ \left( { - 1,0,2} \right),\left( {0,0,1} \right)\} \), \( p = \{ \left( {1,0,0} \right)\} \), then \( A \oplus p = \{ \left( {0,0,2} \right),\left( {1,0,1} \right)\} \not\subset G \), moreover, \( \left( {A \oplus p} \right) \cap G = \emptyset \).

At property 4, the result is the empty set if and only if \( A,C \subset G^{\nabla } \). Similar conditions can be established for the other properties. We show one additional example.

At property 9, the expression on the left hand side defines the empty set if and only if \( A \cap B,C \subset G^{\nabla } \), i.e., there is no common even pixels of the images A and B and neither the structuring element C contains even pixels. For example, let \( A = \left\{ {\left( {2, - 3,2} \right),\left( {1, - 3,3} \right)} \right\} \), \( B = \left\{ {\left( {1, - 3,3} \right)} \right\} \), \( C = \left\{ {\left( {1, - 1,1} \right)} \right\} \), then \( A \cap B = \left\{ {\left( {1, - 3,3} \right)} \right\} \), and \( \left( {A \cap B} \right) \oplus C = \left\{ {\left( {2, - 4,4} \right)} \right\} \), while \( \left( {A \oplus C} \right) = \{ \left( {3, - 4,3} \right),\left( {2, - 4,4} \right)\} \), \( \left( {B \oplus C} \right) = \{ \left( {2, - 4,4} \right)\} \), \( \left( {A \oplus C} \right) \cap \left( {B \oplus C} \right) = \{ \left( {2, - 4,4} \right)\} \not\subset G \). The property holds, but the weak dilations result the empty set in both sides of the expression.

We note here that all the listed properties are satisfied for the strong dilation, however, in the cases when the weak dilation results the empty set, usually, there is no displayable result with the strong dilation. Thus, even the result is not the empty set of some operations, the result cannot be directly seen as an image of the triangular grid.

In the following part we analyze the properties of the variously defined erosion.

  • the property holds on the triangular grid without any additional conditions.

  • \( \Delta \) the expressions are defined only with the condition \( A \subset G^{\Delta } \). With this condition the property holds.

  • \( t^{\Delta } \) the translation is defined with the condition that \( t \) is a vector with zero sum. If it is so, then the property holds.

  • + the property is fulfilled, but the result could be the empty set.

  • t the expressions are defined and the property holds with the condition \( t \in G^{\Delta } \).

Similarly to strict dilation, at strict erosion the structuring element (and so, any image that is playing such a role in an expression) cannot contain vectors outside of \( G^{\Delta } \); also translation vectors must have zero sum coordinates.

At the case of weak erosions, translations by odd vectors are also allowed, moreover the structuring element may also contain odd pixels (vectors with coordinate sum one). In this case, it may happen that some of the expressions results the empty set. We present an example for property 7. Let \( A = \left\{ {\left( {1,0, - 1} \right),\left( {1,0,0} \right)} \right\} \), \( B = \left\{ {\left( {1,0, - 1} \right),\left( {0,0,1} \right)} \right\} \), \( C = \left\{ {\left( {1, - 1,1} \right)} \right\} \), \( A \cap B = \left\{ {\left( {1,0, - 1} \right)} \right\} \), then \( A\,{ \ominus }\,C = \left\{ {\left( {0,1, - 2} \right), \left( {0,1, - 1} \right)} \right\} \) and \( A\,{ \ominus }\,B = \left\{ {\left( {0,1, - 2} \right),\left( { - 1,1,0} \right)} \right\} \), \( \left( {A\,{ \ominus }\,C} \right) \cap \left( {B\,{ \ominus }\,C} \right) = \left\{ {\left( {0,1, - 2} \right)} \right\} = (A \cap B)\,{ \ominus }\,C \), but \( \left( {0,1, - 2} \right) \notin G \). Thus, the expressions of both sides of property 7 give the empty set for the given sets A, B and C.

By related examples, one can easily characterize the cases when the weak erosion results empty set. In a similar manner, at the case of strong erosion, it can be characterized when there is nothing to display, i.e., the resulted set is completely outside of the triangular grid G. The next subsection gives some related ideas.

6.2 A Note on Usable Vectors Outside of the Grid

In case of strong dilation, we may use vectors both for the image and the structuring element, which are outside of the grid, e.g., have coordinate sum −1.

Example 9.

Let \( A = \left\{ {\left( {1,2, - 2} \right),\left( {0,2, - 2} \right),\left( {1,2, - 3} \right),\left( {0,3, - 2} \right),\left( {0,3, - 3} \right),\left( {1,3, - 3} \right)} \right\} \) and let \( B = \left\{ {\left( {0,0, - 1} \right),\left( {0, - 1,0} \right)} \right\} \), then \( A \oplus_{s} B = \{ \left( {0, 3, - 3} \right),\left( {1,1, - 2} \right),\left( {0,2, - 2} \right), \left( {0,2, - 3} \right),\left( {1,2, - 4} \right),\left( {1,1, - 3} \right),\left( {1,2, - 3} \right),\left( {0,3, - 4} \right),\left( {0,1, - 2} \right),(1,3, - 4)\} \). The strong erosion \( A\,{ \ominus }_{s} \,B = \left\{ {\left( {1,3, - 2} \right),\left( {0,3, - 2} \right)} \right\}. \)

The result of the strong dilation and erosion may contain some vectors outside the grid, thus we may keep this information for using in some next operations, e.g., in a dilation of an odd point with this vector yield to an even point of the grid. Thus in strong operations it is allowed for both the image and the structuring element to contain vectors outside of the grid. However, only those vectors can be displayed as pixels that have sum 0 or 1.

6.3 Using the Traditional Neighbors at Structuring Elements

In this subsection, we briefly analyze how we can use the traditional neighborhood structure in morphological operations. It is well-known that in the most cases, at applications the neighborhood of the image is used for these operations, i.e., on the square grid, the structuring element contains the origin with its city-block or chessboard neighbors.

Based on the restricted definitions not allowing to generate or obtain any vectors outside of the triangular grid G, the structuring element can contain only even vectors. Observing the possible neighborhood relations, this implies that only strict 2-neighborhood can be applied for structural element, that is, the structural element C 2 = {(0, 0, 0), (1, −1, 0), (−1, 1, 0), (1, 0, −1), (−1, 0, 1), (0, 1, −1), (0, −1, 1)} is used including the origin itself. We note that these vectors as neighbors correspond exactly the neighborhood in the hexagonal grid.

In the weak case, since we can use only vectors with coordinate sum zero or one (after each operation we lose the resulted vectors not having this property), we can use only strict 2-neighborhood again (set C 2). For odd points to define 1-neighbors or strict 3-neighbors one need vectors with coordinate sum −1. Actually, this is the point why the strong case could be the most useful. For 1-neighborhood, as structuring element, one can use the set C 1 = {(0, 0, 0), (1, 0, 0), (−1, 0, 0), (0, 1, 0), (0, −1, 0), (0, 0, 1), (0, 0, −1)}. Also, strict 2-neighborhood, C 2 is allowed, however we may use all the 2-neighbors including the 1-neighbors by the structuring element C 1 ∪ C 2. The strong definitions also allow to use strict 3-neighborhood C 3 = {(0, 0, 0), (1, 1, −1), (1, −1, 1), (1, −1, −1), (−1, 1, 1), (−1, 1, −1), (−1, −1, 1)}; and 3-neighborhood C 1 ∪ C 2 ∪ C 3 as structuring element.

We present an example in Fig. 8. In Fig. 8(a) an image of a bone implant is shown. This implant was used to insert in a leg of a rabbit. Similar picture was also used in [19] for a binary tomography problem. Here, strict dilation and erosion of this figure are obtained by the structural element C 2 on the triangular grid as they are shown in Fig. 8 (b) and (c), respectively. Those parts of the strong dilations by the 1-, 2- and 3-neighborhood (i.e., by the sets C 1, C 1 ⋃ C 2 and C 1 ⋃ C 2 ⋃ C 3) that belong to the grid G are shown in Fig. 8(d), (f) and (h), respectively. Similarly, strong erosions obtained by the same sets of structuring elements are shown in Fig. 8(e), (g) and (i), respectively.

Fig. 8.
figure 8

(a) resampled image of a bone implant inserted in a leg of a rabbit, (b) strict dilation by structuring element C 2, (c) strict erosion by C 2. (d)–(i) the displayable result of strong dilations and erosions, by C 1 (d) and (e), by C 1 ⋃ C 2 (f) and (g), and by C 1 ⋃ C 2 ⋃ C 3 (h) and (i), respectively.

7 Conclusions

Digital binary image processing has frequently been applied in various places. The most applications, so far, connected to the square grid. In this paper, we have investigated/generalized related concepts to the triangular grid. This grid has interesting symmetric properties [16], since it is not a lattice, but has more symmetry axes than the square grid has. The basic concepts are defined by three different approaches, and fundamental basic properties of them are discussed. In strict operations, a condition is applied to the structuring element. In the strong case, the triangular grid is seen, as a subspace of the cubic grid [14, 15], and we also keep information that cannot be displayed (somehow in a similar manner as topological coordinates can be used [18]). While in the weak case, we may simply lose the information that is shifted outside of the grid.