Keywords

1 Introduction

Edge detection plays an important role in the field of binary, grayscale or colour image processing, primarily for image segmentation. Edge detection can be defined as the process to detect relevant image features. It usually works by detecting discontinuities in brightness [22] as edges are usually the sign of a lack of continuity. In particular, medical images edge detection is one of the most important pre-processing steps in medical image segmentation and 3D reconstruction.

There are many different approaches to edge detection with the aim to extract contour features. Classical edge detectors are based on a discrete differential operators [11], derivatives [14] or wavelet transformations [12]. In addition, there are several approaches to edge detection based on statistical inference. In this case, edge detection is data driven instead of model based [16]. However, the performance of most of these classical methods degrades with noise. To overcome this drawback, Mathematical Morphology (MM) has been introduced. MM provides with an alternative approach to image processing based on concepts of set theory, topology, geometry and algebra. The main idea of this methodology is to compare the objects of interest with a set of predefined and known geometry, called Structuring Element (SE). The use of different shapes and sizes for the SE allows testing and quantifying how the structuring element is, or is not contained in the image.

Fuzzy Mathematical Morphology (FMM) [3] has emerged as an extension of the Mathematical Morphology’s binary operators to gray level images, by redefining the set operations as fuzzy set operations, based on the theory of Fuzzy Sets (FS) [24]. It is inspired by the observation that both greyscale images and FS are modeled as mappings from a universe into the unit interval [0,1].

Therefore fuzzy set theory is thus used as a tool here and not to model uncertainty. In particular, the extension of FS so called Interval-Valued Fuzzy Sets (IVFSs) [20] based on generalizing the membership function as a closed interval in \([0,1]\) is quite useful in detecting edges [8, 18]. In fact, this kind of construction methods are often applied to the detection of edges in gray scale images, which has its most important application in the medical field (see [19]) and other branches of science (see [7]).

The aim of this paper is to define a method to image edge detection based on a construction method for Interval-Valued Fuzzy Relations (IVFR) which can be understood as a gradient from a morphological point of view.

The remainder of the paper is structured as follows: next section revises FMM. Section 3 describes basic concepts regarding IVFSs. In Sect. 4 the weighted construction method for IVFR and its relation with MM are studied. Section 5 draws some experiments and finally in Sect. 6 the main conclusions of this work are highlighted.

2 Fuzzy Mathematical Morphology

The theory of MM is broadly used as a processing tool for enhancement, segmentation, edge detection and filtering, with an important development in biomedical image processing, where objects are characterized by their topology or geometrical structure. MM has been extensively studied and applied to binary and gray level images [21].

The main objective of the MM is to extract information of the geometry and topology of an unknown set in an image. The key of this methodology is the SE, a small set completely defined with a known geometry, which is compared with the whole image. The basic morphological operators of MM are erosion and dilation. From the combination of these operators other more complex arise.

When combined with MM, fuzzy set theory extends the applicability of this model by adding the ability to handle uncertainty. Extension of binary MM to gray level images is obtained via FMM, which combines the power of MM, based on set theory, with the ability of fuzzy logic to handle degrees of membership. FMM has been developed in several directions, until it was combined in a general theoretical framework [1, 2, 5, 10, 13].

Let \(\mu \) and \(\nu \) be two fuzzy sets with membership functions \(\mu :U \subset R^2 \rightarrow [0,1]\) and \(\nu :U \subset R^2 \rightarrow [0,1]\). The first one corresponds to a gray scale images and the second one determines the structuring element. Then basic operators are defined as follows.

Definition 1

[5, 6] Let \(\mu \) be a gray scale image and let \(\nu \) be an SE. Then the Fuzzy Morphological Dilation and Fuzzy Morphological Erosion of the image \(\mu \) by the SE \(\nu \) are defined respectively as:

$$\delta (\mu ,\nu )(x)=sup_{y \in U} [t(\mu (y),\nu (y-x))] $$
$$\epsilon (\mu ,\nu )(x)=inf_{y \in U} [s(\mu (y),c(\nu (y-x)))], $$

where \(t(a,b)\) is a t-norm, \(s(a,b)\) is a t-conorm and \(c(a)=1-a\) is the fuzzy complement operator.

Gradient operators are used in segmentation because they enhance intensity variations in image. These variations are assumed to be edges of objects. This is why gradients are also called “edge detectors”. They are presented in the following definition.

Definition 2

[5, 21] Let \(\mu \) be a gray scale image and let \(\nu \) be an SE, then

  • The basic morphological gradient of the image \(\mu \) by the SE \(\nu \) is:

    $$Grad_{D,E}(\mu ,\nu )=\delta (\mu ,\nu )-\epsilon (\mu ,\nu ).$$
  • Gradient by erosion or internal gradient of the image \(\mu \) by the SE \(\nu \) is:

    $$Grad_{E}(\mu ,\nu )=\mu -\epsilon (\mu ,\nu ).$$
  • Gradient by dilation or external gradient of the image \(\mu \) by the SE \(\nu \) is:

    $$Grad_{D}(\mu ,\nu )=\delta (\mu ,\nu )-\mu .$$

Gradient by erosion detects edges in the positions of higher gray levels in the edges while Gradient by dilation detects edges in the positions of lower gray levels in the edges. Therefore, the morphological gradient grouped the results of these two operators, getting thicker contours.

3 Interval-Valued Fuzzy Sets

IVFSs, introduced by Sambuc in [20], are extensions of classical FS (see [15]). While a FS is defined by a function \(\mu \) that maps each element \(x \in X\) onto a value \(\mu (x) \in [0,1]\). The following definitions introduce basic concepts regarding IVFS. All of them can be found in [20].

Definition 3

\(A\) is an IVFS in the finite set \(X\) if it is defined by the membership function:

$$ A:X\rightarrow L([0,1]), \text{ with } L([0,1])=\{[a_l,a_u]| (a_l,a_u)\in [0,1]^2\text { and }a_l\le a_u\}, $$

Fuzzy Relations (FR) are a special case of FS which are very useful in the construction of IVFS.

Definition 4

Let \(X\) and \(Y\) be two finite sets. A FR \(R\) in \(X\times Y\) is given by the membership function \( R : X\times Y \rightarrow [0,1]. \)

In the same way as it has been done with the classical Fuzzy Sets, the definition of IVFSs is extended to IVFRs.

Definition 5

Let \(X\) and \(Y\) be two finite sets. An IVFR \(R\) is defined by the membership function \( R: X\times Y \rightarrow L([0,1]). \)

An IVFR can be denoted by \(R=\{((x,y),R(x,y))| x\in X, y\in Y\}\), where \(R(x,y)\) is the degree of strength of the relation between \(x\) and \(y\) given by an interval.

4 Construction of Interval-Valued Fuzzy Relations for Edge Detection in Images

The following definition states the meaning of a gray scale image in the fuzzy field.

Definition 6

[18] A gray scale image \(R\) whose dimensions are \(P\times Q\) pixels, is a FR where the finite sets used are \(X=\{0,1,\dots ,P-1\}\) and \(Y=\{0,1,\dots ,Q-1\}\).

This means that gray scale images can be understood as FRs. The edge detection can be solved through morphological operations describing the interaction of the image with a SE. The SE is usually small compared to the image. The notion of a SE is applied to construct an IVFR from the gray scale image represented as FR.

The IVFR construction method is based on two constructors (lower and upper constructors) in order to obtain the limits of each interval. In addition, it involves t-norms and t-conorms [9, 23] which are well known generalizations of conjunction and disjunctions in classical logic. Definitions 7, 8 and 9 establish the basic method to construct an IVFR.

4.1 Non-Weighted Method

Let’s describe first the basic construction method.

Definition 7

[4] Let \(X=\{0,1,\dots ,P-1\}\) and \(Y=\{0,1,\dots ,Q-1\}\) two universes, \(R\in F(X\times Y)\) a FR, two t-norms \(T_1\), \(T_2\), two t-conorms \(S_1\), \(S_2\), and \(n,m\in \mathbb {N}\) such that \(n\le \frac{P-1}{2}\) and \(m\le \frac{Q-1}{2}\),

  • \(L_{T_1,T_2}^{n,m}: F(X\times Y) \rightarrow F(X\times Y)\) is the lower constructor associated to \(T_1,T_2,n\) and \(m\). It is defined by

  • \(U_{S_1,S_2}^{n,m}: F(X\times Y) \rightarrow F(X\times Y)\) is the upper constructor associated to \(S_1,S_2, n\) and \(m\). It is defined by

\(\forall (x,y)\in X\times Y\), where \(i,j\) take values such that \(0\le x-i \le P-1\) and \(0\le y-j \le Q-1\), \(n\) and \(m\) indicate that the SE is a matrix of dimension \((2n+1)\times (2m+1)\) and \(\underset{i=1}{\overset{n}{T}}x_i=T(x_1,\dots ,x_n)\).

Definition 8

[4] Let \(R\in F(X\times Y)\) be a FR, \(L_{T_1,T_2}^{n,m} [R]\) a lower constructor and \(U_{S_1,S_2}^{n,m} [R]\) an upper constructor, then \(R^{n,m}\) is defined by:

$$ R^{n,m}(x,y)=[L_{T_1,T_2}^{n,m} [R](x,y), U_{S_1,S_2}^{n,m} [R](x,y)], $$

for all \((x,y)\in X \times Y\) is an IVFR from \(X\) to \(Y\).

After obtaining both lower and upper constructors from the initial FR (Definition 7), and the IVFR generated by them (Definition 8), the last step of the construction method is to obtain another FR from such IVFR by considering the length of each interval is used.

Definition 9

[4] Given \(L_{T_1,T_2}^{n,m} [R]\) a lower constructor and \(U_{S_1,S_2}^{n,m} [R]\) an upper constructor, the W-fuzzy relation associated to them is given by:

$$ W[R^{n,m}](x,y)=U_{S_1,S_2}^{n,m}[R](x,y)-L_{T_1,T_2}^{n,m}[R](x,y). $$

4.2 Weighted Construction Method

In the method developed by [4], for each element of the relation, the SE is a window centered in that element. Window dimension depends on natural numbers \(n\) and \(m\), which are the parameters in both constructors.

However, it can be assumed that the influence of pixels closer to the center of the SE is higher in detecting edges. In this case, the closer the value to the center of the window, the greater the importance that it takes in the definition of the constructors. This fact is modeled in this work by introducing weights in the lower and upper constructors.

In other words, our goal is to obtain the final lower and upper constructors as \(L(x,y)=\sum _{i=1}^k w_i L^i (x,y)\) and \(U(x,y)=\sum _{i=1}^k w_i U^i (x,y)\), where \(w_i\) are weights that satisfy \(w_i\ge w_{i+1}\) and \(L^i(x,y)\) and \(U^i(x,y)\) the lower and upper constructors of different window sizes respectively, so the smaller windows have more strength in the definition.

Definition 10

[18] Given two finite universes of natural numbers \(X=\{0,1,\) \(\dots ,P-1\}\) and \(Y=\{0,1,\dots ,Q-1\}\), \(R\in FR(X,Y)\) a fuzzy relation in \(X\times Y\), two t-norms \(T_1\), \(T_2\), two t-conorms \(S_1\), \(S_2\), and \(n,m\in \mathbb {N}\) such that \(n\le \frac{P-1}{2}\) and \(m\le \frac{Q-1}{2}\), for any \(i=1,2\ldots , \max (n,m)\) we can consider the two fuzzy relations \(L^i[R]\) and \(U^i[R]\) defined by

$$\begin{aligned} L^i[R](x,y)= L_{T_1,T_2}^{\min (i,n),\min (i,m)}[R](x,y), \ U^i[R](x,y)=U_{S_1,S_2}^{\min (i,n),\min (i,m)}[R](x,y). \end{aligned}$$

There are several options to define these weights (see [18]). In this work, it is proposed one that assign a different value to each point in the window according to the average of the \(k\) windows (\(w_{i}=\frac{1}{k}, \quad i=1,\dots ,k\)).

The scheme of the weighted method with the smoothing step is shown in Algorithm 1. In order to obtain the non weighted method point 4 of Algorithm 1 is skipped.

figure a

4.3 Linking Interval-Valued Fuzzy Relations to Fuzzy Mathematical Morphology

As gray scale images can be represented by FRs, the outputs produced by the construction method are the following:

  • The lower constructor: it represents a darker version of the original image. Depending on the \(t-norms\) chosen, this image can be more or less dark. Note that the lower constructor is a morphological operator (see Sect. 2).

    Depending on the pair of \(t-norms\) selected, different lower constructors are obtained (see Fig. 1).

  • The upper constructor: it represents a brighter version of the original image. Depending on the \(t-conorms\) chosen, this image can be more or less bright. Upper constructors are associated to dilatation operators (see Sect. 2). Figure 2 shows the effect of different co-norms in the upper constructors.

  • The W-fuzzy edge image: it represents the difference of contrast between both constructors. The edges can be identified in this image. Figure 3 represents three W-fuzzy images with different pairs of \(t-norms\) and \(t-conorms\).

Fig. 1
figure 1

Examples of lower constructors. \(T_M\) and \(T_P\) are the minimum and product t-norms respectively

Fig. 2
figure 2

Examples of upper constructors. \(S_M\) and \(S_P\) are the maximum and product t-conorms respectively

Fig. 3
figure 3

Examples of W-fuzzy images depending on the used pairs of t-norms and t-conorms, where \(W[M,P]=U_{S_M,S_P}^{n,m}-L_{T_M,T_P}^{n,m}\), and analogously for the others

Note that the lower and upper constructors can be seen as fuzzy morphological operators. Thus, there is a parallelism between the definition of gradient and the definition of the constructors. Therefore, assuming \(\mu \) to be an image and \(\nu \) to be the SE defined by a \(n \times m\)-matrix, the gradients defined in terms of constructors are

  • Gradient: \(R^{n,m}=U_{S_M,S_P}^{n,m}-L_{T_M,T_P}^{n,m}.\)

  • Internal Gradient: \(\mu -L_{T_M,T_P}^{n,m}.\)

  • External Gradient: \(U_{S_M,S_P}^{n,m}-\mu .\)

5 Experiments

The goal of this section is to compare the performance of the gradients defined in terms of the lower and upper constructors in detecting edges. This comparison is obtained in terms of least squares estimator by comparing respectively the image produced by the lower constructor, the upper constructor and the W-fuzzy image to the benchmark one. In addition it is also checked the effect of weights [18] in the constructors against the original one [4] and different sizes of the SE. To do that, a gray scale images database has been considered. These gray scale images were obtained from the Berkeley Segmentation Dataset (see [17]). This database contains original images and its corresponding edge images. The first 25 images from the test set were selected, whose dimensions are \(481\times 321\) (or \(321\times 481\)) pixels. In addition, the t-norms and t-conorms are the standard ones (Minimum-Maximum). The different configurations studied are:

  • Non-weighted method with \(n=m=1\) (SEs size: \(3\times 3\) matrix) (NW1).

  • Non-weighted method with \(n=m=2\) (SEs size: \(5 \times 5\) matrix) (NW2).

  • Weighted method using the average (A) with 2, 3 or 4 terms (2,3,4)(methods noted as A2, A3 and A4).

Figure 4 shows the performance of the morphological gradient, and the internal and external gradients. \(X\) axis represents each different method: Average with two (A2), three (A3) or four (A4) term; Non weighted method with \(n=m=1\) (NW1) or with \(n=m=2\) (NW2). \(Y\) axis represents the error (the lower the error, the better the method).

As it can be seen the non-weighted methods with an SE represented by a \(3\times 3\)-matrix are the one performing better. Regarding the gradients, the external gradient (associated to the upper constructor) is the one performing better independently of the size of the SE as well as of the kind of weighting method selected.

Fig. 4
figure 4

Comparative of gradients depending on the experimental parameters, where two non-weighted methods (NW1, NW2), and averaging method with \(2, 3 \text{ and } 4\) terms

6 Conclusions

This paper presents different methods to construct IVFRs where the starting point is a FR. These methods are understood as gradients, which are well known tools used in Mathematical Morphology to discover edges in images. The behaviour of these gradients have been analyzed depending on several parameters. The results show that the external gradient obtained from the upper constructor in the one performing better.