1 Introduction

Broadly speaking, mathematical morphology (MM) is a theory that uses geometric and topological concepts for image processing and analysis [22, 41]. Applications of MM cover, for instance, boundary detection, automatic image segmentation and reconstruction, pattern recognition, and signal and image decomposition [9, 18, 35, 39].

The first morphological operators have been developed by Matheron and Serra in the 1960s for the analysis of binary images. Subsequently, many approaches—including umbra, level-sets, and threshold approaches—have been successfully devised to generalize MM to cope with gray-scale images [43, 45]. Some gray-scale morphological operators have also been developed using concepts from fuzzy set theory and fuzzy logic [8, 15, 17, 32, 45].

From the theoretical point of view, MM can be very well defined in a mathematical structure called complete lattice [22, 33, 36]. A complete lattice is a partially ordered set in which any subset has both a supremum and an infimum. Since the requirement is a partial ordering with well-defined extrema operators, complete lattices allowed for the development of morphological operators for multivariate data such as color images [4, 28]. Precisely, multivariate MM attracted the attention of many researchers since the 1990s [13, 19, 46]. In general terms, researches on multivariate MM focused on appropriate ordering schemes. A comprehensive discussion on several approaches for multivariate MM, including color MM, can be found in [4]. In particular, total orderings such as the conditional ordering schemes have been widely used in multivariate MM partially because they prevent the appearance of “false colors” [5, 40]. For instance, Hanbury and Serra introduced a conditional ordering on the CIELab space for color MM [21]. Also, Sartor and Weeks proposed an ordering scheme based on the distance to a reference color followed by a lexicographical cascade used to resolve ambiguities [38]. Distance-based ordering schemes have also been proposed by prominent researchers such as Angulo [3], Aptoula and Lefèvre [6], De Witte at al. [55], Ledoux et al. [26, 27], Deborah et al. [16], and Al Otum [2]. Recent developments in multivariate MM include operations that are invariant to a certain group of transformations [25, 49, 51], probabilistic pseudo-morphology [14], operations derived from Einstein addition and Loewner ordering scheme [10, 50], and flexible mathematical structures such as sponges [52, 53].

Despite the suitability of complete lattices, many important approaches to MM are defined in richer mathematical structures [29, 37, 42]. For example, the umbra approach is defined on a complete lattice-ordered group extension (cloge), which is obtained by enriching a complete lattice with an order-preserving group operation [44]. The cloge structure have also been used implicitly by [7] in a hit-or-miss transform for multivariate images. In fact, some researchers advocate that many morphological operators can be defined in a structure called quantale [37, 42]. In brief, a quantale is a complete lattice endowed with an associative binary operation that commutes with the supremum operation. From an algebraic point of view, the quantale framework comprises the approaches based on a cloge but it is included in the general complete lattice framework.

It turns out that Valle and Sussner introduced a quantale based on the CIELab color space in spherical coordinates, referred to as the spherical CIELab quantale [48]. Although the spherical CIELab quantale has been successfully applied for the development of a class of associative memories, it have not been used as the mathematical background for color MM yet. The purpose of this paper, which completes of the conference paper [47], is to provide support and insights into the implementation of color MM using the spherical CIELab quantale.

The paper is organized as follows. Next section provides the basic concepts on MM, including the complete lattice and quantale-based frameworks. Four approaches to color MM are briefly revised in Sect. 3. The spherical CIELab quantale is discussed in Sect. 4. The novel approach to color MM is introduced in Sect. 5. Section 6 contains an application to boundary detection. The paper finishes with concluding remarks in Sect. 7. We would like to point out that the reader familiar with the fundamentals of MM may overlook Sect. 2. Also, the reader who knows the spherical CIELab may choose to skip Sect. 4 or read it later.

2 Two Algebraic Frameworks to MM

As pointed out in the introduction, complete lattices constitute an appropriate framework for a general theory of MM [36]. However, many classical approaches to MM are defined on a richer mathematical structure called quantales [37, 42]. In this section, we briefly review the complete lattice and the quantale-based frameworks to MM.

2.1 Mathematical Morphology on Complete Lattices

A complete lattice \({\mathscr {L}}\) is an ordered set in which any subset \(X \subseteq {\mathscr {L}}\) has both a supremum and an infimum, denoted respectively by \(\bigvee X \in {\mathscr {L}}\) and \(\bigwedge X \in {\mathscr {L}}\). From an algebraic point of view, the two elementary operations of MM are defined as follows using the adjunction relationship [22]:

Definition 1

(Adjunction, Dilation, and Erosion) Given complete lattices \({\mathscr {L}}\) and \({\mathscr {M}}\), we say that the operators \(\varepsilon :{\mathscr {L}}\rightarrow {\mathscr {M}}\) and \(\delta :{\mathscr {M}}\rightarrow {\mathscr {L}}\) form an adjunction between \({\mathscr {L}}\) and \({\mathscr {M}}\) if the following equivalence holds true for \(x \in {\mathscr {L}}\) and \(y \in {\mathscr {M}}\):

$$\begin{aligned} \delta (y)\le x \Longleftrightarrow y \le \varepsilon (x). \end{aligned}$$
(1)

In this case, \(\delta \) and \(\varepsilon \) are called, respectively, a dilation and an erosion.

Many other operations of MM are obtained by combining dilations and erosions [41]. For example, an opening and a closing, denoted, respectively, by \(\gamma :{\mathscr {L}}\rightarrow {\mathscr {L}}\) and \(\phi :{\mathscr {M}}\rightarrow {\mathscr {M}}\), are obtained by the compositions

$$\begin{aligned} \gamma = \delta \circ \varepsilon \quad \text{ and } \quad \phi = \varepsilon \circ \delta . \end{aligned}$$
(2)

The operations of opening and closing are used, for instance, in granulometries as well as for the removal of noise [22, 41].

2.2 Mathematical Morphology on Quantales

A quantale, denoted in this paper by the triple \(({\mathscr {Q}},\le ,\cdot )\), is the algebraic structure in which the set \({\mathscr {Q}}\), ordered by the relation “\(\le \)”, is a complete lattice and the binary operation “\(\cdot \)” commutes with the supremum in both arguments. In mathematical terms, the following equations hold true for any \(q \in {\mathscr {Q}}\) and \(X \subseteq {\mathscr {Q}}\):

$$\begin{aligned} q \cdot \left( \bigvee X \right) = \bigvee _{x \in X} \left( q \cdot x \right) \quad \text{ and } \quad \left( \bigvee X \right) \cdot q = \bigvee _{x \in X} \left( x \cdot q \right) . \end{aligned}$$
(3)

The binary operation “\(\cdot \)” is often referred to as the multiplication of the quantale. We say that \(({\mathscr {Q}},\le ,\cdot )\) is a commutative quantale if the multiplication “\(\cdot \)” is a commutative binary operation. Similarly, we have a unital quantale if “\(\cdot \)” has an identity, that is, if there exist \(e \in {\mathscr {Q}}\) such that \(e \cdot q = q \cdot e = q\) for all \(q \in {\mathscr {Q}}\).

In a quantale \(({\mathscr {Q}},\le ,\cdot )\), the multiplication is always residuated [37]. Specifically, there exist binary operations “\(\backslash \)” and “ / ” such that the following equivalences hold true for \(x,y,z \in Q\):

$$\begin{aligned} x \cdot y \le z \Longleftrightarrow x \le z / y \Longleftrightarrow y \le x \backslash z. \end{aligned}$$
(4)

The operations “ / ” and “\(\backslash \)” are called, respectively, the left and the right residuums of “\(\cdot \)”. Also, they are uniquely determined by the equations

$$\begin{aligned} x \backslash y = \bigvee \{z \in {\mathscr {Q}}:x \cdot z \le y\}, \end{aligned}$$
(5)

and

$$\begin{aligned} y / x = \bigvee \{z \in {\mathscr {Q}}: z \cdot x \le y \}. \end{aligned}$$
(6)

for any \(x,y \in {\mathscr {Q}}\). It is important to remark that the left and right residuums coincide in a commutative quantale, that is, \(x \backslash y = y /x\) if and only if \(x \cdot y = y \cdot x\) for all \(x,y \in {\mathscr {Q}}\).

The following briefly reviews how the elementary operations of MM are defined using a quantale [37, 42]. For simplicity, we shall restrict our attention to images \(f:X \rightarrow {\mathscr {Q}}\), where \(({\mathscr {Q}},\le ,\cdot )\) is a commutative unital quantale and X is a subset of either \({\mathbb {R}}^d\) or \({\mathbb {Z}}^d\). The set of all images \(f:X \rightarrow {\mathscr {Q}}\) is denoted by \({\mathscr {Q}}^X\).

Like classical approaches to MM, the operations of erosion and dilation on \({\mathscr {Q}}^X\) are defined using an structuring element (SE) \(s:Y \rightarrow {\mathscr {Q}}\), where Y is also a subset of either \({\mathbb {R}}^d\) or \({\mathbb {Z}}^d\). The SE is used to extract relevant information about the shape and form of objects in the probing image. Formally, the two elementary operations of MM on a commutative unital quantale are defined as follows:

Definition 2

(Quantale-based Erosion and Dilation) Let \(({\mathscr {Q}},\le ,\cdot )\) denote a commutative unital quantale. The quantale-based erosion of an image \(f \in {\mathscr {Q}}^X\) by an SE \(s \in {\mathscr {Q}}^Y\), denoted by \(\varepsilon _s^{\mathscr {Q}}(f)\), is the image defined as follows where “ / ” denotes the residuum of the multiplication “\(\cdot \)”:

$$\begin{aligned} \varepsilon _s^{\mathscr {Q}}(f)(x)= \bigwedge _{\begin{array}{c} y \in Y,\\ x+y \in X \end{array}}\big ( f(x+y) / s(y) \big ), \quad \forall \, x \in X. \end{aligned}$$
(7)

Dually, the quantale-based dilation of \(f \in {\mathscr {Q}}^X\) by an SE \(s \in {\mathscr {Q}}^Y\), denoted by \(\delta _s^{\mathscr {Q}}(f)\), is the image given by

$$\begin{aligned} \delta _s^{\mathscr {Q}}(f)(x)= \bigvee _{\begin{array}{c} y \in Y,\\ x-y \in X \end{array}}\big ( f(x-y) \cdot s(y) \big ), \quad \forall \, x \in X. \end{aligned}$$
(8)

Remark 1

It is not hard to show that the set \({\mathscr {Q}}^X\) is a complete lattice under the induced ordering defined as follows for any \(f,g \in {\mathscr {Q}}^X\):

$$\begin{aligned} f \le g \Longleftrightarrow f(x) \le g(x), \; \forall \, x \in X. \end{aligned}$$
(9)

Moreover, from (4), we conclude that the operators \(\varepsilon ^{\mathscr {Q}}_s\) and \(\delta _s^{\mathscr {Q}}\) form an adjunction on \({\mathscr {Q}}^X\) for any fixed SE \(s \in {\mathscr {Q}}^X\). Therefore, according to Definition 1, the operators defined by (7) and (8) are indeed an erosion and a dilation, respectively. Further morphological operators, such as openings and closings, can be obtained by combining these two elementary operations.

Remark 2

Let \(({\mathscr {Q}},\le ,\cdot )\) be a quantale and \(f \in {\mathscr {Q}}^X\) an image. The horizontal translation of f by \(y \in X\), denoted by \(f_y\), is the image defined by \(f_y(x)=f(x-y)\) for all \(x \in X\). The vertical translation of f by \(\alpha \), denoted by \(\alpha f\), is the image given by \((\alpha f)(x) = \alpha f(x)\), for all \(x \in X\). We say that an image operator \(\psi :{\mathscr {Q}}^X \rightarrow {\mathscr {Q}}^X\) is invariant under horizontal translation if \(\psi ( f_x)=[\psi (f)]_x\) for all \(f \in {\mathscr {Q}}^X\) and \(x \in X\). Similarly, \(\psi \) is invariant under vertical translation if \(\psi (\alpha f) = \alpha \psi (f)\), for all \(f \in {\mathscr {Q}}^X\) and \(\alpha \in {\mathscr {Q}}\). Maragos showed that a dilation \(\delta :{\mathscr {Q}}^X \rightarrow {\mathscr {Q}}^X\) is invariant under both horizontal and vertical translations if and only if it is given by (8) [29]. Therefore, the quantale-based approach is used whenever one imposes that the dilation is invariant under horizontal and vertical translations.

We would like to conclude this section recalling that many important approaches, including the widely used umbra or additive approach [36, 43], the multiplicative approach [23, 24], and some fuzzy-based approaches [32, 45], belong to the quantale-based framework. Further examples of morphological operators on quantales can be found in [37, 42].

3 Some Approaches to Color MM

In this section, we briefly review some approaches to color MM. The reader interested in a comprehensive study on multivariate MM, including color MM, is invited to consult [4]. According to our terminology, a color image is a function \(f:X \rightarrow {\mathscr {C}}\), where the domain \(X \subseteq \mathbb {R}^d\) or \(X \subseteq \mathbb {Z}^d\) and \({\mathscr {C}}\), usually a subset of \(\bar{{\mathbb {R}}}^3\), is the color space. There are many color spaces in the literature but, in this paper, we restrict our attention to the RGB and CIELab spaces [34].

3.1 The RGB and the CIELab Color Spaces

The RGB color space is based on the tristimulus theory of vision in which a color is decomposed into the primitives: red (R), green (G), and blue (B) [34]. Geometrically, this color space is represented by the cube \({\mathscr {C}}_\mathrm{RGB}=[0,1]\times [0,1]\times [0,1]\) whose axes correspond to the intensities in each primitive. In the RGB space, a certain color \(c=(c_R,c_G,c_B)\) is a point in or inside the cube \({\mathscr {C}}_\mathrm{RGB}\). The origin corresponds to “black” while the edge (1, 1, 1) represents “white”.

Although the RGB color space is widely used by imaging devices as well as for color image representation and processing, it is not a perceptually uniform color space [34]. Specifically, it is claimed that the Euclidean distance between two elements \(c,c' \in {\mathscr {C}}_\mathrm{RGB}\) hardly resembles the perceptual difference between the two colors. As a consequence, the RGB color space is not advisable for applications in which the visual perception of the colors is pertinent. A perceptually uniform color space, such as the CIELab color space, is recommended in such applications. Besides been a perceptually uniform color space, the CIELab is device-independent color space, which means that the color elements do not depend on the image capture and display devices.

In the CIELab color space, denoted in this paper by \({\mathscr {C}}_\mathrm{Lab} \subseteq [0,100] \times {\mathbb {R}}\times {\mathbb {R}}\), the components of a color element \(c=(c_L,c_a,c_b)\) have the following connotations [1, 34]:

  • The component \(c_L\) models the lightness.

  • The component \(c_a\) indicates the green–red position.

  • The component \(c_b\) yields the blue–yellow position.

The value \(c_c=\sqrt{c_a^2+c_b^2}\), referred to as chroma, measures the colorfulness of c with respect to white. Also, the angle \(c_h = \tan ^{-1}(c_b/c_a) \in (-\pi ,\pi ]\) is called hue of the color c [54]. Gray-scale elements are in the line segment \(c_L=[0,100]\), \(c_a = c_b = 0\). The reader interested in the details of the conversion between the RGB and CIELab color spaces is invited to consult [1, 34].

3.2 The Marginal and the Lexicographical Approaches

A straightforward extension of the gray-scale MM to color images, referred to as the marginal or component-wise approach, is obtained by processing separately each color component [4, 13]. Although the marginal approach yielded excellent results in computational experiments concerning the removal of Gaussian noise [4], there is the possibility of altering the color balance or object boundaries [13]. For example, a certain feature can be removed or enhanced in one of the color components but not in the others. In fact, the marginal approach does not take into account the correlations between the color components. In contrast, the color elements are ranked sequentially according to an order of “importance” in the lexicographical approach. The lexicographical approach have been widely used in color MM partially because it prevents the apparition of “false colors” when a flat SE is used. On the downside, it prioritizes excessively the first condition in the lexicographical cascade. Hence, the lexicographical approach is almost always used in combination with a suitable domain in which the relevant information is placed in the first components [4]. In this paper, both marginal and lexicographical approaches are defined using the CIELab color space.

In mathematical terms, given a color image f and an SE s, the elementary operations of the marginal and lexicographical approaches to color MM are defined by

$$\begin{aligned} \varepsilon ^{\mathscr {*}}_s(f)(x) = \bigwedge _{\begin{array}{c} y \in Y,\\ x+y \in X \end{array}}\big (f(x+y)-s(y)\big ), \quad \forall x \in X, \end{aligned}$$
(10)

and

$$\begin{aligned} \delta ^{\mathscr {*}}_s(f)(x)= \bigvee _{\begin{array}{c} y \in Y,\\ x-y \in X \end{array}}\big (f(x-y)+s(y)\big ), \quad \forall x \in X, \end{aligned}$$
(11)

where the operations of sum and subtraction are performed in a component-wise manner. The supremum and infimum are both computed using either the marginal or the lexicographical ordering schemes.

The marginal ordering is obtained by comparing separately the components of the colors. Precisely, given two color elements \(c,c' \in {\mathscr {C}}_\mathrm{Lab}\), we have

$$\begin{aligned} c \le _{\mathscr {M}} c' \Longleftrightarrow c_L \le c'_L, \; c_a \le c'_a, \; \text{ and } \; c_b \le c'_b. \end{aligned}$$
(12)

The marginal CIELab erosion and dilation of f by s are denoted respectively by \(\varepsilon _s^{\mathscr {M}}(f)\) and \(\delta _s^{\mathscr {M}}(f)\).

The lexicographical ordering, which yields a total order in \({\mathscr {C}}_\mathrm{Lab}\), is obtained by comparing sequentially each color component. Formally, given two color elements \(c,c'\in {\mathscr {C}}_\mathrm{Lab}\), we have

$$\begin{aligned} c \le _{\mathscr {L}} c' \Longleftrightarrow {\left\{ \begin{array}{ll} c_L< c'_L, \; \\ c_L = c'_L \text{ and } c_a < c'_a, \; \text{ or }, \\ c_L = c'_L, c_a = c'_a, \text{ and } c_b \le c'_b. \end{array}\right. } \end{aligned}$$
(13)

The lexicographical CIELab erosion of f by s is denoted respectively by \(\varepsilon _s^{\mathscr {L}}(f)\). Similarly, the lexicographical CIELab dilation is written as \(\delta _s^{\mathscr {L}}(f)\). Note that the lexicographical cascade in (13) prioritizes the lightness.

Remark 3

The marginal and lexicographical approaches can be expressed in terms of (7) and (8) if we extend \({\mathscr {C}}_\mathrm{Lab}\) to \(\bar{{\mathbb {R}}}^3\), where \(\bar{{\mathbb {R}}}={\mathbb {R}}\cup \{+\infty ,-\infty \}\). In this case, the multiplication “\(\cdot \)” coincides with “\(+\)” given that the addition is appropriately defined in the infinities [45]. Evidently, the residuum of “\(+\)” is the subtraction “−” and the identity of “\(+\)” is (0, 0, 0).

3.3 The Vector-Based Approach of Witte et al.

In the lexicographical CIELab approach, the color elements are ordered sequentially by comparing, respectively, the lightness, green–red, and blue-yellow components. A similar approach, referred in this paper shortly as the approach of Witte, have been proposed by Witte et al. [54]. Specifically, Witte et al. considered more than one color space. However, due to page constrain, we only present the approach in the CIELab space in order to provide a fair comparison with the other approaches.

First, the colors are ordered sequentially by considering respectively the lightness, chroma, and hue. Formally, given \(c,c' \in {\mathscr {C}}_\mathrm{Lab}\), we have

$$\begin{aligned} c \le _{\mathscr {W}} c' \Longleftrightarrow {\left\{ \begin{array}{ll} c_L < c'_L, \; \\ c_L = c'_L \text{ and } c_c > c'_c, \; \text{ or }, \\ c_L = c'_L, c_c = c'_c, \text{ and } c_h \le c'_h, \end{array}\right. } \end{aligned}$$
(14)

where the angle \(c_h\) is measured in degrees. Note that the smaller between two colors is the darker one. If two colors have the same lightness, the smaller is the one with greater chroma. The last condition avoids ambiguities. In contrast to some works concerning the morphological processing of hue [6, 20], the circularity of this component has not been taken into account in (14).

Apart from the color ordering given by (14), Witte et al. defined two binary operations, denoted here by the symbols “\(+_{ {\mathscr {W}}}\)” and “\(-_{ {\mathscr {W}}}\)”. In a general form, an operation, “\(*_{ {\mathscr {W}}}\)”, which can be either “\(+_{ {\mathscr {W}}}\)” or “\(-_{ {\mathscr {W}}}\)”, is defined as follows for any colors \(c,c' \in {\mathscr {C}}_\mathrm{Lab}\):

$$\begin{aligned} c *_{ {\mathscr {W}}} c' = {\left\{ \begin{array}{ll} (m_L,c_a',c_b' ), &{} c_c=0, \\ (m_L,c_a,c_b ), &{} c_c'=0, \\ \big (m_L, m_c \cos (m_h), m_c \sin (m_h) \big ), &{} \text{ otherwise }. \end{array}\right. } \end{aligned}$$
(15)

The values \(m_L,m_c\), and \(m_h\) are obtained by a kind of arithmetic mean and its complement. Unfortunately, the binary operations defined by Witte et al. do not have an identity [54]. Hence, inspired by the Lukasiewicz fuzzy conjunction and implication [32, 45], we slightly adapted “\(+_{ {\mathscr {W}}}\)” and “\(-_{ {\mathscr {W}}}\)” by considering \(m_L,m_c\), and \(m_h\) given as follows: The addition \(c+_{ {\mathscr {W}}} c'\) is derived from (15) by setting

$$\begin{aligned} {\left\{ \begin{array}{ll} m_L = 0 \vee (c_L+c_L'-100),\\ m_c = \dfrac{c_c+c_c'}{2}, \\ m_h = \dfrac{c_h+c_h'}{2}. \end{array}\right. } \end{aligned}$$
(16)

Dually, the subtraction \(c-_{ {\mathscr {W}}} c'\) is given by (15) with

$$\begin{aligned} {\left\{ \begin{array}{ll} m_L = 100 \wedge (100-c_L'+c_L), \\ m_c = \dfrac{c_c-c_c'}{2}, \\ m_h = \dfrac{c_h-c_h'}{2}. \end{array}\right. } \end{aligned}$$
(17)

Note that \((100,0,0) \in {\mathscr {C}}_\mathrm{Lab}\), which corresponds to white, is an identity of both addition and subtraction. In other words, \(c +_{ {\mathscr {W}}} (100,0,0) = c\) and \(c -_{ {\mathscr {W}}} (100,0,0) = c\) for all color \(c \in {\mathscr {C}}_\mathrm{Lab}\). Furthermore, the following equivalence holds true for any \(c,c' \in {\mathscr {C}}_\mathrm{Lab}\) and \(t \in [0,100]\):

$$\begin{aligned} c +_{ {\mathscr {W}}} (t,0,0) \le _{\mathscr {W}} c' \Longleftrightarrow c \le _{\mathscr {W}} c' -_{ {\mathscr {W}}} (t,0,0). \end{aligned}$$
(18)

Hence, the subtraction “\(-_{ {\mathscr {W}}}\)” is the residuum of the addition “\(+_{ {\mathscr {W}}}\)” if the second argument corresponds to an achromatic color.

Now, given a color image \(f \in {\mathscr {C}}_\mathrm{Lab}^X\) and an SE \(s \in {\mathscr {C}}_\mathrm{Lab}^Y\), the elementary operations of erosion and dilation of f by s, denoted, respectively, by \(\varepsilon _s^{\mathscr {W}}(f)\) and \(\delta _s^{\mathscr {W}}(f)\), are the color images in \({\mathscr {C}}_\mathrm{Lab}^X\) defined by

$$\begin{aligned} \varepsilon ^{\mathscr {W}}_s(f)(x) = \bigwedge _{\begin{array}{c} y \in Y,\\ x+y \in X \end{array}}\big (f(x+y)-_{ {\mathscr {W}}} s(y)\big ), \quad \forall x \in X, \end{aligned}$$
(19)

and

$$\begin{aligned} \delta ^{\mathscr {W}}_s(f)(x)= \bigvee _{\begin{array}{c} y \in Y,\\ x-y \in X \end{array}}\big (f(x-y)+_{ {\mathscr {W}}} s(y)\big ), \quad \forall x \in X, \end{aligned}$$
(20)

where the supremum and infimum are both computed using (14).

Remark 4

The elementary morphological operations \(\varepsilon _s^{\mathscr {W}}\) and \(\delta _s^{\mathscr {W}}\) are dual with respect to a certain negation (or complement) defined on \({\mathscr {C}}_\mathrm{Lab}\) [54]. Also, from (18), we conclude that \(\varepsilon _s^{\mathscr {W}}(f)\) and \(\delta _s^{\mathscr {W}}(f)\) form an adjunction if \(s \in {\mathscr {C}}_\mathrm{Lab}^X\) corresponds to a gray-scale image, i.e., \(s_a(x)=s_b(x)=0\) for all \(x \in X\). The approach of Witte have been successfully applied for the removal of noise in satellite images [54].

3.4 The Distance-Based Approach of Angulo

In contrast to the marginal and lexicographical ordering discussed previously, a reduced ordering or R-ordering ranks the elements according to a real-valued function. In particular, a distance-based ordering is an R-ordering in which the elements are ranked by comparing the distance to a certain reference. Despite the irregularity problem of total orderings [12], distance-based ordering schemes have been used by many prominent researchers to implement morphological operators [6, 13, 26, 27, 38, 55]. A generalization of many distance-based approaches to color MM for flat structuring elements have been proposed by Angulo [3]. In general terms, the distance-based approach of Angulo is based on an ordering scheme which first compares the distance to a certain color reference. The subsequent comparisons follow the usual lexicographical cascade. In this paper, we only consider the Euclidean distance in the CIELab color space.

Formally, let \(r \in {\mathscr {C}}_\mathrm{Lab}\) be a reference color. Given two color \(c,c' \in {\mathscr {C}}_\mathrm{Lab}\), we have \(c \le _{\mathscr {A}} c'\) if and only if

$$\begin{aligned} {\left\{ \begin{array}{ll} \Vert c-r\Vert _2> \Vert c'-r\Vert _2, \\ \Vert c-r\Vert _2 = \Vert c'-r\Vert _2 \text{ and } c_L < c'_L, \\ \Vert c-r\Vert _2 = \Vert c'-r\Vert _2, c_L = c'_L, \text{ and } c_a > c'_a, \; \text{ or }, \\ \Vert c-r\Vert _2 = \Vert c'-r\Vert _2, c_L = c'_L, c_a = c'_a, \text{ and } c_b \le c'_b, \end{array}\right. } \end{aligned}$$
(21)

where \(\Vert c-r\Vert _2 = \sqrt{(c_L-r_L)^2+(c_a-r_a)^2+(c_b-r_b)^2}\) is the usual Euclidean distance between the color element c and the reference r in the CIELab space. At this point, we would like to recall that the ranking of color elements by (21) is strongly determined by the distance to r. Indeed, although the Euclidean distance in the CIELab space has interesting perceptual properties, Angulo remarked that the most important issue in the implementation of (21) refers to the choice of the reference color [3].

In the light of (21), the elementary morphological operators are defined as follows in the approach of Angulo. Given a color image \(f \in {\mathscr {C}}_\mathrm{Lab}^X\) and a binary (or flat) SE Y, the erosion and dilation of f by Y, denoted respectively by \(\varepsilon _Y^{\mathscr {A}}(f)\) and \(\delta _Y^{\mathscr {A}}(f)\), are the color images defined by

$$\begin{aligned} \varepsilon ^{\mathscr {A}}_Y(f)(x) = \bigwedge _{\begin{array}{c} y \in Y,\\ x+y \in X \end{array}} f(x+y), \quad \forall x \in X, \end{aligned}$$
(22)

and

$$\begin{aligned} \delta ^{\mathscr {A}}_Y(f)(x)= \bigvee _{\begin{array}{c} y \in Y,\\ x-y \in X \end{array}} f(x-y), \quad \forall x \in X. \end{aligned}$$
(23)

It is not hard to show that \(\varepsilon _Y^{\mathscr {A}}(f)\) and \(\delta _Y^{\mathscr {A}}(f)\) form an adjunction in \({\mathscr {C}}_\mathrm{Lab}^X\) for any fixed \(Y \subseteq X\). Hence, the approach of Angulo belongs to the general complete lattice framework. Except for a minor modification in the lexicographical cascade, the spherical CIELab approach introduced in the next section generalizes the approach of Angulo by allowing for non-flat SEs.

4 The Spherical CIELab Quantale

In this section, we review the spherical CIELab quantale introduced by Valle and Sussner [48]. Briefly, we first express the color elements of \({\mathscr {C}}_\mathrm{Lab}\) using spherical coordinates centered at a reference color r. Then, a total order is defined by comparing, in a lexicographical cascade, the radius, elevation, and azimuth of two elements. Finally, we obtain a quantale structure by endowing the complete lattice with a certain multiplication.

4.1 The Spherical CIELab System

A color element \(c=(c_L,c_a,c_b) \in {\mathscr {C}}_\mathrm{Lab}\) can be expressed as \((c_\rho ,c_\phi ,c_\theta )\) using spherical coordinates centered at a fixed color reference \(r=(r_L,r_a,r_b) \in {\mathscr {C}}_\mathrm{Lab}\). Recall that the spherical coordinates \(c_\rho \) (radius), \(c_\phi \) (elevation), and \(c_\theta \) (azimuth) are given by

$$\begin{aligned} {\left\{ \begin{array}{ll} c_\rho = \Vert c-r\Vert _2,\\ c_\phi = \tan ^{-1}\left( \dfrac{c_L-r_L}{\sqrt{(c_a-r_a)^2+(c_b-r_b)^2}}\right) , \\ c_\theta = \tan ^{-1}\left( \dfrac{c_b-r_b}{c_a-r_a}\right) , \end{array}\right. } \end{aligned}$$
(24)

where \(c_\rho \in {\mathbb {R}}_{\geqslant 0} = \{ x \in {\mathbb {R}}: x \geqslant 0\}\), \(c_\phi \in \Phi =[-\pi /2,\pi /2]\), and \(c_\theta \in \Theta = (-\pi ,\pi ]\). From now on, the symbol \({{\mathscr {S}}_r}={\mathbb {R}}_{\geqslant 0} \times \Phi \times \Theta \) denotes the CIELab color space in spherical coordinates centered at a reference color r.

Fig. 1
figure 1

Synthetic color image f

The following example illustrates the representation of a color image in the spherical CIELab system centered at red.

Example 1

Consider the synthetic color image f of size \(9 \times 9\) depicted in Fig. 1. This image is composed of 9 squares of size \(3\times 3\) with the colors: gray, black, blue, magenta, red, green, cyan, white, and yellow. The CIELab and spherical CIELab components of each \(3\times 3\) color square as well as their spatial representation are shown in Fig. 2 using red as reference color. Specifically, the coordinates above and below the name of a color in Fig. 2a) gives the position of the color using, respectively, the usual CIELab and the spherical CIELab. Fig. 2b) depicts the nine colors in the spherical CIELab space, which is equivalent to the CIELab space shifted by \((53.24, 80.09, 67.20) \in {\mathscr {C}}_\mathrm{Lab}\). Note that the origin of the shifted CIELab space shown in Fig. 2b) corresponds to red.

Fig. 2
figure 2

The colors of the image shown in Fig. 1 in the CIELab (above the color name) and spherical CIELab (below) spaces as well as their spatial representation, a representation of colors using CIELab and spherical CIELab, b spatial representation of the colors in the spherical CIELab space centered at red

4.2 The Spherical CIELab Complete Lattice

Let us now enrich the spherical CIELab system \({{\mathscr {S}}_r}\) with a total ordering scheme. Given two elements \(c=(c_\rho ,c_\phi ,c_\theta ) \in {{\mathscr {S}}_r}\) and \(c'=(c_\rho ',c_\phi ',c_\theta ') \in {{\mathscr {S}}_r}\), we define

$$\begin{aligned} c \leqslant _{{{\mathscr {S}}_r}} c' \Longleftrightarrow {\left\{ \begin{array}{ll} c_\rho >c_\rho ', \text{ or } \\ c_\rho =c_\rho ', \text{ and } c_\phi \prec c_\phi ', \text{ or } \\ c_\rho =c_\rho ',c_\phi =c_\phi ', \text{ and } c_\theta \preceq c_\theta ', \end{array}\right. } \end{aligned}$$
(25)

where “>” denotes the usual greater than ordering on \({\mathbb {R}}\), “\(\prec \)” is the ordering given by

$$\begin{aligned} x\prec y \Leftrightarrow {\left\{ \begin{array}{ll} |x|<|y|, \text{ or }\\ |x|=|y| \text{ and } x<y, \end{array}\right. } \end{aligned}$$
(26)

and \(x \preceq y\) if and only if \(x \prec y\) or \(x=y\).

The total ordering given by (25) can be interpreted as follows: The greater of the two elements c and \(c'\) is the color closer (in the Euclidean distance sense) to the reference r, which corresponds to the origin (0, 0, 0) in the spherical CIELab system \({{\mathscr {S}}_r}\). Hence, the lattice structure of the spherical CIELab quantale is very similar to the one obtained from (21). In case both c and \(c'\) have the same distance to r, the greater is the one with larger elevation, which corresponds to the one chroma of which is closer to the chroma of the reference r. Finally, the last condition in (25) avoids ambiguities and makes “\(\leqslant _{{\mathscr {S}}_r}\)” a total ordering scheme. We would like to point out that, since the dilation is based on the supremum, the ordering “\(\leqslant _{{{\mathscr {S}}_r}}\)” given by (25) yields an operator that enlarges the structures having a color close to the reference. Dually, the erosion shrinks the objects which have a color close to the reference because of the infimum operation.

Although the greatest element of \({{\mathscr {S}}_r}\) is the origin, the algebraic structure \(({{\mathscr {S}}_r},\leqslant _{{{\mathscr {S}}_r}})\) is not a complete lattice because it does not have a least element. We can circumvent this problem by introducing an artificial point \(\bot =(+\infty ,0,0)\) as the least element of \({{\mathscr {S}}_r}\). Now, the set \({\bar{{\mathscr {S}}}}_r= {{\mathscr {S}}_r}\cup \{\bot \}\) is a complete lattice under the total ordering “\(\leqslant _{{{\mathscr {S}}_r}}\)” given by (25). The artificial element \(\bot \) plays a role similar to the infinities \(+\infty \) and \(-\infty \) on the extended real numbers \(\bar{{\mathbb {R}}}\).

Fig. 3
figure 3

Ranking of some colors in the complete lattice \(({{\mathscr {S}}_r},\leqslant _{{{\mathscr {S}}_r}})\) using red as the reference color (Color figure online)

Example 2

Fig. 3 shows some color elements ranked according to the ordering given by (25), or similarly by (21), with red \(r=(1,0,0) \in {\mathscr {C}}_\mathrm{RGB}\) as the reference color. Note that, since red and green are opposite colors in the CIELab space, the largest colors are reddish while the smallest are greenish. On the downside, there are many different colors in the middle which are distanced similarly to the reference. Unfortunately, the last remark holds for any reference color besides red because a small change in either elevation or azimuth angles may cause a significant visual change of colors if the radius is sufficiently large. In fact, Chevallier and Angulo demonstrated that any total order—including the distance-based scheme defined by (25)—always introduce irregularities on a color space [12].

4.3 The Spherical CIELab Quantale

Let us now endow the complete lattice \(({\bar{{\mathscr {S}}}}_r,\leqslant _{{\mathscr {S}}_r})\) with a binary operation “\(\cdot _{{{\mathscr {S}}_r}}\)” such that the algebraic structure \(({\bar{{\mathscr {S}}}}_r,\leqslant _{{\mathscr {S}}_r},\cdot _{{\mathscr {S}}_r})\) is a commutative unital quantale.

Given elements \(c=(c_\rho ,c_\phi ,c_\theta ) \in {\bar{{\mathscr {S}}}}_r\) and \(c'=(c_\rho ',c_\phi ',c_\theta ') \in {\bar{{\mathscr {S}}}}_r\), the multiplication \(c \cdot _{{\mathscr {S}}_r}c'\) is defined by

$$\begin{aligned} c \cdot _{{\mathscr {S}}_r}c' = (c_\rho \times ^\prime c_\rho ', c_\phi \curlywedge c_\phi ', c_\theta \curlywedge c_\theta '), \end{aligned}$$
(27)

where the binary operation “\(\curlywedge \)” is given by

$$\begin{aligned} x \curlywedge y = {\left\{ \begin{array}{ll} x, &{} \text{ if } x\preceq y,\\ y, &{} \text{ otherwise }. \end{array}\right. } \end{aligned}$$
(28)

The operation “\(\times '\)” coincides with the usual multiplication on \({\mathbb {R}}_{\geqslant 0}\) and it is extended to the infinity by means of the equations \((+\infty )\times ^\prime x = x\times ^\prime (+\infty )=+\infty \) for all \(x \in \bar{{\mathbb {R}}}_{\geqslant 0}= {\mathbb {R}}_{\geqslant 0}\cup \{+\infty \}\).

The identity of “\(\cdot _{{\mathscr {S}}_r}\)” is the element \(e = \left( 1,\frac{\pi }{2},\pi \right) \in {\bar{{\mathscr {S}}}}_r\). Furthermore, the residuum of the multiplication is the binary operation “\(\slash _{{\mathscr {S}}_r}\)” given by the following equation for all \(c,c' \in {\bar{{\mathscr {S}}}}_r\):

$$\begin{aligned} c \slash _{{\mathscr {S}}_r}c' = (c_\rho /^\prime c_\rho ', c_\phi /^\Phi c_\phi ', c_\theta /^\Theta c_\theta '), \end{aligned}$$
(29)

where the symbols “\(/^\prime \)”, “\(/^\Phi \)”, and “\(/^\Theta \)” denote the binary operations defined as follows for appropriate elements x and y and “\(\div \)” denotes the usual division of real numbers:

$$\begin{aligned} y/^\prime x=&{\left\{ \begin{array}{ll} 0,&{}\text{ if } x = +\infty ,\\ 0,&{}\text{ if } x = 0,\;y=0,\\ +\infty ,&{}\text{ if } x=0,\;y>0,\\ y\div x,&{}\text{ otherwise }, \end{array}\right. } \end{aligned}$$
(30)
$$\begin{aligned} y/^\Phi x =&{\left\{ \begin{array}{ll} \frac{\pi }{2},&{}\text{ if } x\preceq y,\\ y,&{}\text{ otherwise }, \end{array}\right. } \end{aligned}$$
(31)

and

$$\begin{aligned} y/^\Theta x = {\left\{ \begin{array}{ll} \pi ,&{}\text{ if } x\preceq y,\\ y,&{}\text{ otherwise }. \end{array}\right. } \end{aligned}$$
(32)

Example 3

The multiplication of \(c=(114.03, 0.40, 2.88) \in {\bar{{\mathscr {S}}}}_r\), which represents the yellow shown in Fig. 1, by the element \(s_1=(1.2,\frac{\pi }{2},\pi )\) is

$$\begin{aligned} c_1&= (114.03, 0.40, 2.88) \cdot _{{\mathscr {S}}_r}(1.20, 1.57, 3.14) \\&= (136.84, 0.40, 2.88), \end{aligned}$$

while the residuum is

$$\begin{aligned} c_2&= (114.03, 0.40, 2.88) \slash _{{\mathscr {S}}_r}(1.20, 1.57, 3.14) \\&=(95.03, 0.40, 2.88). \end{aligned}$$

Similarly, the multiplication and the residuum of the color magenta by \(s_2=(0.8, \frac{3\pi }{4},-\frac{\pi }{4})\) satisfy

$$\begin{aligned} c_3&=(129.50, 0.05, -1.43) \cdot _{{\mathscr {S}}_r}(0.8, 2.36, -0.79) \\&= (103.60, 0.05, -0.79), \end{aligned}$$

and

$$\begin{aligned} c_4&=(129.50, 0.05, -1.43) \slash _{{\mathscr {S}}_r}(0.8, 2.36, -0.79) \\&= (161.87, 0.05, 3.14). \end{aligned}$$

Figure 4 provides a visual interpretation of the color elements \(c_1,\ldots ,c_4\) obtained above. Note that the elevation and the azimuth angles of \(s_1\) correspond to the identities of the minimum operation “\(\curlywedge \)” on \(\Phi \) and \(\Theta \), respectively. As a consequence, the multiplication and the residuum of a color element by \(s_1\) preserve the angles but the radius is respectively multiplied and divided by 1.2. Thus, the orange color given by \(c_2\) is closer to red than the yellow given by \(c_1\) in the CIELab Euclidean distance sense, i.e., \(c_2 \leqslant _{{\mathscr {S}}_r}c_1\). In contrast, the elevation and azimuth angles of \(s_2\) do not correspond to the identity of “\(\curlywedge \)”. Hence, the multiplication and the residuum of a color element c by \(s_2\) change the angles besides the operations performed on the radius of c. Indeed, the residuum of magenta by \(s_2\) yielded the dark green element \(c_4\). This example shows that the multiplication and the residuum given, respectively, by (27) and (29) may produce unexpected colors. Hence, these two operations must be used with caution.

Fig. 4
figure 4

Visual interpretation of the color \(c_1,\ldots ,c_4\) of Example 3

Remark 5

We would like to point out that the spherical quantale can be extended to multivariate elements (with more than 3 channels) as follows: Let \(c=(c_\rho ,c_{\phi _1},c_{\phi _2},\ldots ,c_{\phi _{n-1}})\), with \(c_\rho \in [0,\infty )\), \(c_{\phi _1} \in (-\pi ,\pi ]\), and \(c_{\phi _i} \in [-\pi /2,\pi /2]\) for any \(i=2,\ldots ,n-1\), be the n-dimensional spherical coordinates a multivariate element. Given two multivariate elements c and \(c'\), we write \(c \leqslant _{{\mathscr {S}}^n_r} c'\) if and only if

$$\begin{aligned} {\left\{ \begin{array}{ll} c_\rho >c_\rho ', \text{ or } \\ c_\rho =c_\rho ', \text{ and } c_{\phi _1} \prec c_{\phi _1}', \text{ or } \\ \quad \vdots \\ c_\rho =c_\rho ',c_{\phi _1}=c_{\phi _1}', \ldots , c_{\phi _{n-2}} = c_{\phi _{n-2}}', \text{ and } c_{\phi _{n-1}} \preceq c_{\phi _{n-1}}'. \end{array}\right. } \end{aligned}$$

Also, the multiplication \(c \cdot _{{\mathscr {S}}^n_r} c'\) is defined by

$$\begin{aligned} c \cdot _{{\mathscr {S}}^n_r} c' = (c_\rho \times ^\prime c_\rho ', c_{\phi _1} \curlywedge c_{\phi _1}', \ldots , c_{\phi _{n-1}} \curlywedge c_{\phi _{n-1}}'). \end{aligned}$$

The extension of the spherical quantale to multivariate elements require investigation and it will not be considered further in this paper.

5 Morphological Operators on the Spherical CIELab

According to Definition 2, the operations of MM on the spherical CIELab quantale \(({\bar{{\mathscr {S}}}}_r,\leqslant _{{\mathscr {S}}_r},\cdot _{{\mathscr {S}}_r})\) are defined as follows: The spherical CIELab erosion of a color image \(f \in {\bar{{\mathscr {S}}}}_r^X\) by an SE \(s \in {\bar{{\mathscr {S}}}}_r^Y\), denoted by \(\varepsilon _s^{{{\mathscr {S}}_r}}(f)\), is the color image given by

$$\begin{aligned} \varepsilon _s^{{\mathscr {S}}_r}(f)(x) = \bigwedge _{\begin{array}{c} y \in Y,\\ x+y \in X \end{array}}\big ( f(x+y) \slash _{{\mathscr {S}}_r}s(y) \big ), \quad \forall \, x \in X, \end{aligned}$$
(33)

where “\(\slash _{{\mathscr {S}}_r}\)” denotes the residuum given by (29). Dually, the spherical CIELab dilation of \(f \in {\bar{{\mathscr {S}}}}_r^X\) by an \(s \in {\bar{{\mathscr {S}}}}_r^Y\), denoted by \(\delta _s^{{\mathscr {S}}_r}(f)\), is the color image obtained as follows:

$$\begin{aligned} \delta _s^{{\mathscr {S}}_r}(f)(x) = \bigvee _{\begin{array}{c} y \in Y,\\ x-y \in X \end{array}}\big ( f(x-y) \cdot _{{\mathscr {S}}_r}s(y) \big ), \quad \forall \, x \in X. \end{aligned}$$
(34)

Remark 6

The spherical CIELab erosion and dilation are closely related to the elementary operators of the multiplicative approach to gray-scale morphology [23]. Specifically, a gray-scale image f can be interpreted as a function \(f:X \rightarrow {\mathscr {C}}_\mathrm{Lab}\) such that \(f_L(x) \in [0,100]\) and \(f_a(x)=f_b(x)=0\) for all \(x \in X\). Similarly, a gray-scale SE corresponds to \(s:X \rightarrow {\mathscr {C}}_\mathrm{Lab}\), where \(s_L \in [0,100]\) and \(s_a(x)=s_b(x)=0\). By considering black \((0,0,0) \in {\mathscr {C}}_\mathrm{Lab}\) as the reference color, the gray-scale image f and the SE s are given in the spherical CIELab space by \(f(x)=(f_\rho (x),0,0)\) and \(s(x)=(s_\rho (x),0,0)\), where \(f_\rho (x)=f_L(x)\) and \(s_\rho (x)=s_L(x)\). Hence, the first component of the spherical CIELab dilation \(\delta _s^{{\mathscr {S}}_r}(f)\) is the supremum of the product \(f_\rho (y) \times ' s_\rho (y-x)\), such as the dilation of the multiplicative approach applied only in the lightness. Dually, the first component of the spherical CIELab erosion is the minimum of a quotient like the erosion of the multiplicative approach. We would like to recall that the multiplicative approach to gray-scale MM has been applied for edge enhancement in X-ray images [24]. Furthermore, there is a one-to-one correspondence between the multiplicative approach and the classical umbra approach [23].

According to (2), the spherical CIELab closing and opening are given, respectively, by the compositions

$$\begin{aligned} \gamma _s^{{\mathscr {S}}_r}= \delta _s^{{\mathscr {S}}_r}\circ \varepsilon _s^{{\mathscr {S}}_r}\quad \text{ and } \quad \phi _s^{{\mathscr {S}}_r}=\delta _s^{{\mathscr {S}}_r}\circ \varepsilon _s^{{\mathscr {S}}_r}, \end{aligned}$$
(35)

for a fixed SE \(s \in {\bar{{\mathscr {S}}}}_r^X\). The achromatic morphological gradient of a color image \(f \in {\bar{{\mathscr {S}}}}_r^X\) with respect to a fixed SE \(s \in {\bar{{\mathscr {S}}}}_r^X\) is defined by

$$\begin{aligned} \varrho _s^{{\mathscr {S}}_r}(f)(x) = \Vert \delta _s^{{\mathscr {S}}_r}(f)(x) - \varepsilon _s^{{\mathscr {S}}_r}(f)(x)\Vert _2, \quad \forall x \in X, \end{aligned}$$
(36)

where “\(\Vert \cdot \Vert _2\)” denotes the Euclidean norm computed in the CIELab system. As pointed out by Angulo, the achromatic morphological gradient gives the contours of the original color image. Thus, it can be used for boundary or edge detection [3]. According to Yang and Li, boundary detection often serves as an early stage in image understanding and other high level computer vision applications [56]. For a better visual interpretation of the achromatic morphological gradient, in this paper, we also considered the re-scaled and complemented version \(\bar{\varrho }_s^{{\mathscr {S}}_r}(f)\) of \(\varrho _s^{{\mathscr {S}}_r}(f)\) given by

$$\begin{aligned} \bar{\varrho }_s^{{\mathscr {S}}_r}(f)(x) = 1-\frac{\varrho _s^{{\mathscr {S}}_r}(f)(x)}{\bigvee _{y \in X} \varrho _s^{{\mathscr {S}}_r}(f)(y)}, \quad \forall x \in X. \end{aligned}$$
(37)

Note that \( \bar{\varrho }_s^{{\mathscr {S}}_r}(f) \in [0,1]^X\) is a gray-scale image such that

$$\begin{aligned} \bar{\varrho }_s^{{\mathscr {S}}_r}(f)(x)=1 \quad \Longleftrightarrow \quad \varrho _s^{{\mathscr {S}}_r}(f)(x)=0, \end{aligned}$$
(38)

and

$$\begin{aligned} \bar{\varrho }_s^{{\mathscr {S}}_r}(f)(x)=0 \quad \Longleftrightarrow \quad \varrho _s^{{\mathscr {S}}_r}(f)(x)= \bigvee _{y \in X} \varrho _s^{{\mathscr {S}}_r}(f)(y).\nonumber \\ \end{aligned}$$
(39)

Remark 7

A GNU Octave/MATLAB subroutine implementing the operations of erosion, dilation, opening, closing, and the achromatic morphological gradient is available at www.ime.unicamp.br/~valle/Codes/SphCIELabMM_Codes.zip. The zip file also contains some codes used in the subsequent experiments.

In the following, we evaluate the performances of the spherical CIELab approach as well as the other approaches to color MM in experiments using synthetic and natural images. For simplicity, we use in the spherical CIELab approach the SEs \(p,s:Y \rightarrow {\bar{{\mathscr {S}}}}_r\) defined by

(40)

where \(Y=\{-1,0,1\}^2\), \(e=(1,\frac{\pi }{2},\pi )\) is the identity of the quantale \(({\bar{{\mathscr {S}}}}_r,\leqslant _{{\mathscr {S}}_r},\cdot _{{\mathscr {S}}_r})\), and \(s_1=(t_{s},\frac{\pi }{2},\pi )\) for some positive real number \(t_{s}\). The shaded cell refers to the origin of the SE.

Fig. 5
figure 5

Spherical CIELab erosion and dilation of the color image f depicted in Fig. 1 using a flat and a non-flat SE, respectively

Remark 8

Note that p corresponds to a flat (or planar) SE. Loosely speaking, the dilation \(\delta _p^{{\mathscr {S}}_r}(f)\) replaces the color of a pixel on the input image by the color closer to red (in the CIELab Euclidean distance sense) in the \(3\times 3\) square neighborhood. Dually, the erosion \(\varepsilon _p^{{\mathscr {S}}_r}(f)\) substitutes the color of a pixel by the color farther to red in the \(3 \times 3\) square neighborhood. Besides the use of flat SEs, the quantale-based approach allows for non-planar SEs such as s given by (40). The effect of the SE s in the spherical CIELab dilation \(\delta _s^{{\mathscr {S}}_r}(f)\) can be interpreted intuitively as follows: f(x) is replaced by \(f(y) \cdot _{{\mathscr {S}}_r}s(y-x)\) if \(f_\rho (x)=\Vert f(x)-r\Vert _2 < t_{s} \Vert f(y)-r\Vert _2 = t_{s} f_\rho (y)\) for \(y \ne x\) in the \(3 \times 3\) neighborhood of x.

Fig. 6
figure 6

Dilation of the image f displayed in Fig. 1 using different approaches to color MM

Similarly, we use the following non-flat SEs w and b, also defined on \(Y=\{-1,0,+1\}^2\), in the approach of Witte as well as in the marginal and lexicographical approaches:

(41)

where \(b_1=(t_{b},0,0)\), \(b_0=(0,0,0)\), \(w_1=(t_{w},0,0)\), and \(w_0=(100,0,0)\) for certain numbers \(t_{b}\) and \(t_{w}\). These two SEs have been chosen in a way similar to the SE s in (40). For instance, the color image \(\delta _b^{\mathscr {L}}(f)\) is intuitively obtained replacing f(x) by \(f(y)+b(x-y)\) if the lightness \(f_L(x)<f_L(y)+t_{b}\) for \(y \ne x\) in the \(3 \times 3\) neighborhood of x. Moreover, since the binary operations defined by (15), (16), and (17) are inspired by fuzzy logic operation, an SE with high lightness values must be used in the approach of Witte. Finally, the SE in the approach of Angulo is the square \(Y = \{-1,0,+1\}^2\).

5.1 Illustrative Example Using a Synthetic Image

Let us compute the spherical CIELab erosion and dilation of the synthetic color image f depicted in Fig. 1 by p and s given by (40) with \(t_s=2\), that is, \(s_1=(2,\frac{\pi }{2},\pi )\). Here, we are assuming that fp, and s are all represented in the spherical CIELab system with pure red as the reference color. A visual interpretation of the flat erosion \(\varepsilon _p^{{\mathscr {S}}_r}(f)\) and dilation \(\delta _p^{{\mathscr {S}}_r}(f)\) can be seen in Fig. 5. This figure also shows the spherical CIELab erosion and dilation of f by the non-flat SE \(s \in {\bar{{\mathscr {S}}}}_r^X\).

We also computed the dilation and erosion of the synthetic color image f depicted in Fig. 1 using the four approaches reviewed in Sect. 3. Due to page constraint, Fig. 6 only shows the images produced by the dilations \(\delta _{b}^{\mathscr {M}}(f)\) (marginal approach), \(\delta _{b}^{\mathscr {L}}(f)\) (lexicographical approach), \(\delta _w^{\mathscr {W}}(f)\) (approach of Witte), and \(\delta _Y^{\mathscr {A}}(f)\) (approach of Angulo). Similar to the spherical CIELab approach, we used red as the reference color in the approach of Angulo. Also, we considered \(b_1=(-10,0,0)\) and \(w_1=(90,0,0)\) in (41).

Note that the red region has been expanded by both spherical CIELab dilations \(\delta _p^{{\mathscr {S}}_r}(f)\) and \(\delta _s^{{\mathscr {S}}_r}(f)\). The dilation \(\delta _Y^{\mathscr {A}}(f)\) also expanded the red region of the image f. In fact, the reader may observe the equality \(\delta _Y^{\mathscr {A}}(f)=\delta _p^{{\mathscr {S}}_r}(f)\), which holds because the first condition dominated the lexicographical cascade in both ordering schemes, \(\le _{\mathscr {A}}\) and \(\le _{{\mathscr {S}}_r}\). Furthermore, since both orderings, \(\le _{\mathscr {L}}\) and \(\le _{\mathscr {W}}\), compare first the lightness of the color elements, \(\delta _b^{\mathscr {L}}(f)\) and \(\delta _w^{\mathscr {W}}(f)\) are very similar. Visually, the dilations, \(\delta _b^{\mathscr {L}}(f)\) and \(\delta _w^{\mathscr {W}}(f)\), expanded the bright regions of f. For instance, the gray region expanded over the magenta region because the lightness of the former is 76.07, while the lightness of the latter is 60.32. Finally, observe that \(\delta _b^{\mathscr {M}}(f)\) has many “false colors” produced by the maximum operation. Indeed, the marginal maximum operation yields bright red or yellow colors due to the large values of the components \(c_L\), \(c_a\), \(c_b\).

Fig. 7
figure 7

Re-scaled and complemented achromatic morphological gradients of the color image f shown in Fig. 1

We would like to conclude by remarking that, in contrast to the other approaches, the non-flat operators, \(\varepsilon ^{{\mathscr {S}}_r}_s(f)\) and \(\delta ^{{\mathscr {S}}_r}_s(f)\), expanded the red region but treated equally the other regions. As a consequence, the achromatic morphological gradient \(\varrho _s^{{\mathscr {S}}_r}(f)\) with respect to the non-planar SE s gives better contours of the red region on f than the morphological gradient produced by the other approaches. Figure 7 confirms this last remark by showing the re-scaled and complemented achromatic morphological gradients produced by the spherical CIELab approach as well as the four color approaches reviewed in Sect. 3.

6 Application to Color Image Boundary Detection

Let us consider an application of the achromatic morphological gradient to detect the boundaries of an object in natural color images. Precisely, consider the 300 color images as well as the 1633 human segmented binary images from Berkeley segmentation database [30]. We evaluated quantitatively the performance of a color morphological approach using Pratt’s figure of merit [34]. Formally, let \(\tau \) denote a binary image corresponding to an human segmentation of a color image g from the database. We first computed the re-scaled and complemented achromatic morphological gradient \(\varrho (g)\) using a color morphological approach. Then, like González-Hidalgo et al. [18], we converted the gray-scale gradient image \(\varrho (g)\) into a binary image \(\beta \) by applying the non-maximum suppression method followed by an hysteresis threshold [11, 31]. For simplicity, we fixed the threshold values at \(T_1=0.01\) and \(T_2=0.2\) in our experiments. Finally, given the binary image \(\beta \) with boundary of one-pixel width and the corresponding ground truth binary image \(\tau \), Pratt’s FoM is defined by

$$\begin{aligned} \text{ FoM }(\beta ,\tau )=\frac{1}{\big (\text{ Card }(\beta ) \vee \text{ Card }(\tau )\big )} \sum _{x \in E} \frac{1}{1+a d^2}, \end{aligned}$$
(42)

where \(\text{ Card }(\cdot )\) yields the number of boundary points, a is a scaling constant, and d is the separation distance from a boundary point of \(\beta \) to the ideal boundary point in \(\tau \). As suggested in [34], we used \(a=1/9\). Note that higher values of FoM represent a better boundary detection.

We evaluated the performance of the spherical CIELab approach using the flat and non-flat SEs given by (40), with \(s_1=(1.2,\frac{\pi }{2},\pi )\). Also, we considered the following reference colors: gray (a), black (k), blue (b), magenta (m), red (r), green (g), cyan (c), white (w), and yellow (y). The Pratt’s FoM values obtained from these two approaches (flat and non-flat) are summarized in the box and whisker diagrams (box plot) shown in Fig 8. Also, Table 1 shows the average Pratt’s FoM obtained from the two approaches. We would like to point out that for the nine reference colors, a two-sample t test rejected the null hypothesis that the Pratt’s FoM values obtained from flat and non-flat approaches have equal means at a significance level 0.05. Here, we assumed that the two populations have unequal variances. In other words, these two approaches are not equivalent for boundary detection even using the same reference color.

Fig. 8
figure 8

Box and whisker diagram describing the Pratt’s FoM values obtained using spherical CIELab approaches with several reference colors

Table 1 Average Pratt’s FoM values obtained using the spherical CIELab approaches with several reference colors
Fig. 9
figure 9

Original color images and achromatic morphological gradients

Fig. 10
figure 10

Original color images and achromatic morphological gradients

Note that the spherical CIELab approach yielded similar average FoM values for all color references. In fact, a two-sample t test applied to the flat approach with two different references failed to rejected the null hypothesis that they have equal means except for gray versus green and gray versus yellow. In contrast, the performance of the non-flat spherical CIELab approach depends strongly on the reference color. Indeed, the average Pratt’s FoM of the non-flat approach varied from low values such as 0.01 to the largest value 0.29, which was obtained by considering white as the reference color. Also, a two-sample t test rejected the null hypothesis that the non-flat approach with any two different references have equal means except for gray versus black and green versus magenta. A short explanation of the (good or poor) performance of the non-flat spherical CIELab approach for some references is given below.

An illustration of the performance of the spherical CIELab approaches, both using red as the reference color, is illustrated in Figs. 9 and 10. Specifically, these figures show images for which the flat and the non-flat spherical CIELab approaches yielded large FoM values, respectively. Figs. 9 and 10 also show the ground truth image, the re-scaled and complemented gradient, and the binary boundary image obtained from both approaches. The corresponding Pratt’s FoM values are displayed below the binary image.

On one hand, the color image shown in Fig. 9a) does not have any red pixels. As a consequence, the non-flat gradient, as well as the binary image \(\beta _s^{{\mathscr {S}}_{ \text{ red }}}\), is an almost white image. The almost white gradient resulted in a small FoM value. In general, the poor performance of the non-flat spherical CIELab approach results from a white or almost white morphological gradient. An almost white morphological gradient is obtained when the reference is far from any color in the image. Now, the colors red, green, blue, yellow, and magenta are near the border of the CIELab gamut. Therefore, they have a very high probability to be far from the color elements of a natural image such as the one show in Fig. 9a).

On the other hand, the red flowers in the natural color image shown in Fig. 10a) is characterized by red pixels. In this case, the non-flat gradient \(\varrho _s^{{\mathscr {S}}_{ \text{ red }}}(g_{124084})\) enhanced only the red flowers. In contrast, the flat gradient \(\varrho _p^{{\mathscr {S}}_{ \text{ red }}}(g_{124084})\) enhanced the flowers as well as some of the details on the background. As a consequence, the binary image \(\beta _p^{{\mathscr {S}}_{ \text{ red }}}\) has many noisy pixels. Concluding, in the non-flat spherical CIELab approach, the reference must be chosen a priori according to the color of the object, the boundary of which we intend to detect.

Fig. 11
figure 11

Box and whisker diagram describing the Pratt’s FoM values obtained using the flat (F) and non-flat (NF) spherical CIELab approaches with white as the reference color as well as the marginal (M), lexicographical (L), Witte (W), and luminance-based gray-scale (G) approaches

Table 2 Average Pratt’s FoM values obtained several approaches to boundary detection
Fig. 12
figure 12

Original color image \(g_{135069}\), Ground truth image \(\tau _{135069}\), and the boundary binary image obtained using different approaches

Fig. 13
figure 13

Original color image \(g_{138032}\), ground truth image \(\tau _{138032}\), and the boundary binary image obtained using six different approaches

Finally, if no prior knowledge about the image is available, then an achromatic reference is recommended in the non-flat spherical CIELab approach. In particular, we suggest to use white as the reference color due to the following. As shown in Table 1, the non-flat approach based on white yielded the largest average Pratt’s FoM value in our previous experiments. For comparison purpose, we confronted the spherical CIELab approaches based on white with the marginal and lexicographical CIELab approaches as well as the approach of Witte et al. reviewed in Section 3. Here, we used the SEs given by (41) with \(b_1=(-5,0,0)\) and \(w_1=(95,0,0)\) in the approaches of Witte, marginal, and lexicographical. We refrained from including the approach of Angulo because it is very similar to the flat spherical CIELab approach. In addition, we considered an approach based on gray-scale morphological operators. Specifically, we computed the traditional morphological gradient \(\varrho ^{\mathscr {G}}_Y\), with the square SE \(Y=\{-1,0,+1\}^2\), applied only on the luminance of the color image. The Pratt’s FoM values are summarized in the box and whisker diagrams shown in Fig. 11 and Table 2. Note that the non-flat spherical CIELab approach yielded the largest average FoM value. Notwithstanding this, excluding the flat approach which produced the smallest average FoM value, the five approaches to boundary detection exhibited similar performance. More precisely, a two-sample t test failed to reject the hypothesis that the non-flat spherical CIELab approach has an average FoM equal to that produced by the marginal, lexicographical, or Witte approaches. This result can be partially explained by the fact that white corresponds to the largest element of the complete lattices obtained by considering all the orderings “\(\le _{\mathscr {M}}\)”, “\(\le _{\mathscr {L}}\)”, “\(\le _{\mathscr {W}}\)”, and “\(\le _{{\mathscr {S}}_{ \text{ white }}}\)”.

Let us close this section with two instances of the six approaches to boundary detection. Figs. 12 and 13 show a natural color image, its corresponding ground truth image, and the the binary images \(\beta _p^{{\mathscr {S}}_{ \text{ white }}}\), \(\beta _s^{{\mathscr {S}}_{ \text{ white }}}\), \(\beta _b^{{\mathscr {M}}}\), \(\beta _b^{{\mathscr {L}}}\), \(\beta _w^{{\mathscr {W}}}\), and \(\beta _Y^{{\mathscr {G}}}\) obtained, respectively, by the flat and non-flat CIELab approaches, the marginal and lexicographical approaches, the approach of Witte, and the gray-scale approach based on the luminance. We would like to point out that the binary images \(\beta _s^{{\mathscr {S}}_{ \text{ white }}}\), \(\beta _b^{{\mathscr {M}}}\) shown in Fig. 12 yielded the maximum Pratt’s FoM values among all images in the database. Here, the high values of the Pratt’s FoM confirm the excellent performances of the approaches to the detection of the boundary of the two birds depicted in Fig. 12a). In contrast, the images shown in Fig. 13 are those for which the flat spherical CIELab, marginal, lexicographical, and Witte approaches produced the minimum Pratt’s FoM values. Note that the binary images obtained by all six approaches are much richer in details than the ground truth image. This explains the low FoM values obtained by the six approaches.

7 Concluding Remarks

MM is a theory with many applications in image and signal processing and analysis. From a theoretical point of view, MM can be very well conducted in a mathematical structure called complete lattices [36]. The complete lattice framework, which relies primary on a partial ordering with well-defined extrema operators, contributed for the development of many approaches to color morphology [35, 20, 21]. Notwithstanding the above, researchers such as Russo and Stell argued that some widely used morphological approaches are defined in a richer mathematical structure called quantale [37, 42]. The binary MM, the umbra approach, and some fuzzy approaches to gray-scale MM are defined using the quantale-based framework. Furthermore, the quantale-based approach is appropriate if one requires dilations invariant under both vertical and horizontal translations.

In [48], Valle and Sussner introduced a quantale based on the CIELab color space in spherical coordinates. In general terms, the spherical CIELab quantale is obtained by enriching the CIELab space with a distance-based total ordering and a binary operation called multiplication. The total ordering scheme is partially motivated by the works [3, 21, 54]. The multiplication is given by the product of the radii and the minimum between either the elevation or the azimuth angles. Computational experiments revealed that the novel approach has potential application in problems such as detection of the boundaries of objects in color images. Notwithstanding, we would like to point out that both elementary operations of erosion and dilation are greatly influenced by both structuring element and the reference color. Therefore, in the spherical CIELab approach to color MM, the structuring element as well as the reference color must be carefully chosen for certain applications. In a boundary detection application, for instance, the reference must be chosen a priori according to the color of the object, the boundary for which we intend to detect. An achromatic color, such as white, is recommended if no information is available.