Keywords

1 Introduction

Images are functions whose values are bounded between 0 and M (e.g. 256 for 8 bits images) and depend of the illumination conditions. During the acquisition, some parts of the image may be underexposed to light with dark values close to 0, whereas other parts may be overexposed to light with bright values close to M. Therefore, the processing should not be the same in the bright and in the dark parts. When processing grey-level images by Mathematical Morphology (MM) [3, 8, 17], dark parts and bright parts are processed in the same way and in some cases the transformed image may have values that exceed the upper limit M.

The aim of this paper is to overcome this issue by defining morphological operators adaptive to lighting variations thanks to an appropriate model, the Logarithmic Image Processing (LIP) one [4, 5] which allows to brighten or darken images in a way compatible with the physics of acquisition and with the human visual system [2]. Previously, a morphological transform, the LIP-top-hat, was defined with the LIP model in [4]. A model, the Symmetric Logarithmic Image Processing (SLIP) one [12] was combined with wavelets in [11]. Homomorphic models [12, 14] and retinex algorithms [9] were also used with convolution. However, these models, interesting from a mathematical point of view, are not related to the physics of acquisition.

This paper constitutes the first attempt to define morphological operators adaptive to lighting variations - without any pre-processing. Such a property makes the definition of Logarithmic-Mathematical Morphology of the utmost importance for many applications where the acquisition depends on the illumination (e.g. industry, outdoor scenes, forensics, medical images etc.) [7, 13, 15, 18]. The paper is organised as follows: (i) after a reminder about MM and the LIP model, (ii) MM will be defined in the logarithmic-additive framework. The morphological properties of the operators will be verified and (iii) the Logarithmic-MM will be illustrated and compared to the classical MM.

2 Prerequisites

2.1 Mathematical Morphology

Definition 1

Complete lattice. Given a set \(\mathscr {L}\) and a partial order \(\le \) on \(\mathscr {L}\), \(\mathscr {L}\) is a complete lattice if every subset \(\mathscr {X}\) of \(\mathscr {L}\) has an infimum (a greatest lower bound), \(\wedge \mathscr {X}\), and a supremum (a least upper bound), \(\vee \mathscr {X}\).

MM [8, 10, 17] is defined on complete lattices [1, 3]. The least element O and the greatest element I are two important elements of the lattice \(\mathscr {L}\). A grey-level image is a function f: \(D \subset \mathbb R^n \rightarrow [O,M[\), with \(M \in \mathbb R\). The space of images is denoted \(\mathcal {I}= [O,M[^D\). The (bounded) set of images \(\overline{\mathcal {I}}= [0,M]^D\) and the set of functions \(\overline{\mathbb R}^D\), \(\overline{\mathbb R}= \mathbb R\cup \{-\infty , +\infty \}\) are complete lattices with the order \(\le \). For \(\overline{\mathcal {I}}\), the least and greatest elements are the constant functions equal to zero, \(f_0\), and M, \(f_M\). The supremum and infimum are respectively, for any \(\mathscr {X} \subset \overline{\mathcal {I}}\): \(\left( \wedge _{\overline{\mathcal {I}}} \mathscr {X}\right) (x) = \wedge _{[0,M]} \left\{ f(x):f \in \mathscr {X}, \> x\in D \right\} \) and \(\left( \vee _{\overline{\mathcal {I}}} \mathscr {X}\right) (x) = \vee _{[0,M]} \left\{ f(x):f \in \mathscr {X}, \> x\in D \right\} \).

Definition 2

Erosion, dilation [1, 16]. Given \(\mathscr {L}_1\) and \(\mathscr {L}_2\) two complete lattices, a mapping \(\psi \in \mathscr {L}_2^{\mathscr {L}_1}\) is: (i) an erosion \(\varepsilon \): iff \(\forall \mathscr {X} \subset \mathscr {L}_1\), \(\psi ( \wedge \mathscr {X} ) = \wedge \psi ( \mathscr {X} )\) or (ii) a dilation \(\delta \): iff \(\forall \mathscr {X} \subset \mathscr {L}_1\), \(\psi ( \vee \mathscr {X} ) = \vee \psi ( \mathscr {X} )\).

As the definitions of these mappings apply even to the empty subset of \(\mathscr {L}_1\), we have: \(\varepsilon (I)=I\) and \(\delta (O)=O\).

Definition 3

Adjunction [3]. Let \(\varepsilon \in \mathscr {L}_2^{\mathscr {L}_1}\) and \(\delta \in \mathscr {L}_1^{\mathscr {L}_2}\) be operators between complete lattices \(\mathscr {L}_1\) and \(\mathscr {L}_2\); the pair \((\varepsilon ,\delta )\) is called an adjunction between \(\mathscr {L}_1\) and \(\mathscr {L}_2\) if for all \(X \in \mathscr {L}_1\), \(Y \in \mathscr {L}_2\) there is \(\delta (Y) \le X \Leftrightarrow Y \le \varepsilon (X)\).

Proposition 1

In an adjunction \((\varepsilon ,\delta )\), \(\varepsilon \) is an erosion and \(\delta \) a dilation [3].

When using an additive structuring function \(b \in [O,M]^{D_b}\), \(D_b \subset D\), invariant under translation (in D), the previously defined dilation \(\delta \) and erosion \(\varepsilon \) in the lattice \((\overline{\mathbb R}^D,\le )\), can be expressed as [3, 16]:

$$\begin{aligned} \delta _b(f)(x) =\vee \left\{ f(x - h) + b(h), h \in D_b\right\} = (f \oplus b) (x) \end{aligned}$$
(1)
$$\begin{aligned} \varepsilon _b(f)(x)=\wedge \left\{ f(x + h) - b(h), h \in D_b\right\} = (f \ominus b) (x). \end{aligned}$$
(2)

\(\oplus \) and \(\ominus \) are the extension to functions of Minkowski operations on sets [17].

Definition 4

Opening, closing [3, 17]. An operator \(\psi \in \mathscr {L}^{\mathscr {L}}\) on the complete lattice \(\mathscr {L}\) is called:

  • an opening if \(\psi \) is increasing (\(\forall X, Y \in \mathscr {L}\), if \(X \le Y\) then \(\psi (X) \le \psi (Y)\)), anti-extensive (\(\forall X \in \mathscr {L}\), \(\psi (X) \le X\)) and idempotent (\(\psi \circ \psi = \psi \)),

  • a closing if \(\psi \) is increasing, extensive (\(\forall X \in \mathscr {L}\), \(X \le \psi (X)\)) and idempotent.

Proposition 2

Let \((\varepsilon ,\delta ) \in \mathscr {L}_2^{\mathscr {L}_1} \times \mathscr {L}_1^{\mathscr {L}_2}\) be an adjunction between \(\mathscr {L}_1\) and \(\mathscr {L}_2\), then \(\delta \varepsilon \) is an opening on \(\mathscr {L}_1\) and \(\varepsilon \delta \) is a closing on \(\mathscr {L}_2\) [3].

2.2 Logarithmic Image Processing

The LIP model, introduced by Jourlin et al. [4, 5], is a mathematical framework for image processing based on the physical law of transmittances. Its consistency with the human visual model [2] makes it suitable not only for images acquired with transmitted light but also for images acquired with reflected light. Due to the relation, \(T_f = 1 - f/M\), between the transmittance \(T_f(x)\) at point x and the grey level f(x), the grey scale is inverted in the LIP-model: 0 corresponds to the white extremity, when no obstacle is placed between the light source and the sensor, whereas M corresponds to the black value, when the source cannot be transmitted through the obstacle. The addition of two images corresponds to the superposition of two obstacles generating the images f and g:

(3)

The multiplication of an image f by a real number \(\lambda \) is deduced from the Eq. 3, , and corresponds to a variation of thickness (or opacity) of the object. The opposite function of f and the difference between two grey level functions f and g are expressed by:

(4)

Let us note that is not an image (as it takes negative values) and is an image if and only if \(f \ge g\).

Property 1

(A strong physical property). The negative values , with \(f \ge 0\), are light intensifiers that can be used to compensate the light attenuation due a variation of exposure-time (or light intensity) [5].

Property 2

(Mathematical properties). Let \(\mathcal {F}= ]-\infty ,M[^D\) be the space of functions with values in \(]-\infty ,M[\). The space is a real vector space and represents the positive cone of this vector space [4, 5]. \(\mathcal {F}\) and \(\mathcal {I}\) are both ordered by the usual order \(\le \) [4].

3 Logarithmic-Mathematical Morphology

MM is defined on the lattice of functions with real values \(\overline{\mathbb R}^D\). When performing a dilation by a (non-flat) structuring function, the dilated function may have values which exceed the range [0, M[. In order to solve this issue and to perform operations adaptive to light variations, let us extend MM with Logarithmic-MM, on the lattice of functions \(\overline{\mathcal {F}}=[-\infty ,M]^D\) with values in \([-\infty ,M]\). First of all, the fundamental operators of erosion and dilation are needed:

Proposition 3

Let \(f \in \overline{\mathcal {F}}\) be a function and \(b \in ]-\infty ,M[^{D_b}\) a structuring function, the mappings in \(\overline{\mathcal {F}}\) defined by

(5)
(6)

form an adjunction , with an erosion and a dilation. is called a logarithmic-erosion and a logarithmic-dilation.

Proof

of Proposition 3.

  • is a dilation (Definition 2). As the operation preserves the order \(\le \) [4], we have \(\forall f, g \in \overline{\mathcal {F}}\), \(\forall x \in D\), . In addition, with \(b(h)\in ]-\infty ,M[\), we have: .

  • Similarly, \(\forall f, g \in \overline{\mathcal {F}}\), and Therefore, is an erosion.

  • is an adjunction because: .

Let us verify that the new operations are dual by their negative function.

Proposition 4

The negative function [3] is .

Proposition 5

Let \(\overline{b}(x) = b(-x)\) be the reflection of the structuring function b, the logarithmic-erosion and dilation are dual by their negative function:

(7)

Proof

. Similarly, we have .

As is an adjunction, an opening and a closing can be defined [3].

Proposition 6

Given an adjunction , the operator is an opening and is a closing (by adjunction). is called a logarithmic-opening and a logarithmic-closing.

A relation between the logarithmic operations and the “classical” ones exists. This facilitates the implementation of the logarithmic operations, as the “classical” ones are available in many image analysis toolboxes.

Proposition 7

Let \(f \in \overline{\mathcal {F}}\) be a function and \(b \in ]-\infty ,M[^{D_b}\) a structuring function, the logarithmic-dilation and the logarithmic-erosion are related to the dilation \(\delta _b\) and erosion \(\varepsilon _b\) by:

(8)

with \(\acute{f} = -\ln {\left( 1 - f/M \right) }\), \(\acute{f} \in \overline{\mathbb R}\).

Proof

The dilation \(\delta _b\) and the erosion \(\varepsilon _b\) are mappings of the lattice \(\overline{\mathbb R}^D\), whereas the logarithmic-dilation and erosion are mappings of the lattice \([-\infty ,M]^D\). In order to link these operations, a bijective mapping (i.e. an isomorphism) is needed between these two lattices. Such an isomorphism \(\xi : \overline{\mathbb R}^D \rightarrow [-\infty ,M]^D\) and its inverse \(\xi ^{-1}\) are both defined in [6] by \([\xi (f)](x) = M(1-\exp {(-f/M)})\) and \(\left[ \xi ^{-1}(f)\right] (x) = -M \ln {(1-f/M)}\). As increasing bijections, \(\xi \) ans \(\xi ^{-1}\) distribute over infima and suprema. Therefore, the dilation can be expressed by: . Similarly, we have .

4 Results

In the Fig. 1, the “classical” operations of MM and those of Logarithmic-MM are compared on a simulated signal. For each operation of Logarithmic-MM, the amplitude of the structuring function (sf) changes according to the values of the image because of the LIP-laws, or , used in their definition (Eqs. 5 and 6), whereas for the operations of “classical” MM the amplitude of the sf remains the same. In the Fig. 1b, the values of the logarithmic-dilation always remain below the upper limit \(M = 256\), whereas for the “classical” dilation \(\delta _b(f)\), some grey-levels may exceed the limit M. Such a property is due to the LIP addition law . In the Fig. 1a, the lowest values of both erosions and \(\varepsilon _b(f)\) are negative because of the laws and − used in Eqs. 6 and 2. For real value functions \(\overline{\mathbb R}^D\), the negative values have no physical justification, whereas in the LIP model they correspond to light intensifiers [5]. In the Fig. 1c (resp. Fig. 1d), the disparity between the openings \(\gamma _b (f)\) and (resp. closings \(\varphi _b(f)\) and ) is greater for the grey-levels close to M than for those close to zero. Indeed, the LIP difference is non linear along the grey-level axis.

Fig. 1.
figure 1

Comparison between the operations of “classical” MM and Logarithmic-MM: (a) erosions \(\varepsilon _b(f)\), , (b) dilations \(\delta _b(f)\), , (c) openings \(\gamma _b(f)\), and (d) closings \(\varphi _b(f)\), . (a), (b) The structuring function is represented for both peaks and for all the operations \(\varepsilon _b(f)\), , \(\delta _b(f)\) and .

In the Fig. 2, two images of the same scene are acquired at two different exposure time (i.e. shutter speed): a bright image f (Fig. 2a) and a dark image \(f^d\) (Fig. 2d). Both images f and \(f^d\) are complemented (\(f^c = M-1-f\)) before computing a morphological gradient \(\varrho _b(f^c) = \delta _b(f^c) - \varepsilon _b(f^c)\) [16] (Fig. 2b, e) and its logarithmic version (Fig. 2c, f). For comparison purpose, the amplitudes of each gradient are scaled between 0 and 255. The logarithmic-gradient of the dark image (Fig. 2f) finds much more contours than the “classical” one \(\varrho _b((f^d)^c)\) (Fig. 2e). Even on the bright image f, the logarithmic-gradient (Fig. 2c) finds more contours than the “classical” one , especially on the darkest parts (Fig. 2b). The logarithmic-gradient is also few sensitive to lighting variations (Fig. 2c and f).

Fig. 2.
figure 2

Comparison between the gradient \(\varrho _b\) (b, e) and the Logarithmic-gradient (c, f) on a bright image f (a) (acquired with an exposure time of 1/40 s) and on a dark image of the same scene (d) (exposure time of 1/800 s). The sf b is an hemisphere of radius 2 pixels.

In the Fig. 3, an opening \((\gamma _b((f^d)^c))^c\), a closing \((\varphi _b((f^d)^c))^c\), a logarithmic-opening and a logarithmic-closing are compared on the complement of the dark image \(f^d\) (Fig. 2b), using an hemisphere of radius 15 pixels as structuring function. For comparison purpose, the amplitudes of each filtered image are scaled between 0 and 255. The “classical” opening and closing (Fig. 3a, c) have a limited effect in terms of transformation whereas the logarithmic-opening and closing have a more important effect (Fig. 3b, d). E.g. on the body of the soft toy monster, the words are removed with the logarithmic-opening and closing and not with the “classical” opening and closing.

Those examples illustrate the property of the logarithmic-MM to adapt to important contrast variations caused by varying illumination conditions.

Fig. 3.
figure 3

(a) Opening \((\gamma _b((f^d)^c))^c\) and (b) logarithmic-opening on the dark image \(f^d\). (c) Closing \((\varphi _b((f^d)^c))^c\) and (d) logarithmic-closing . The sf b is an hemisphere of radius 15 pixels.

5 Conclusion and Perspectives

Logarithmic-mathematical morphology is introduced in this paper. The fundamental operators of logarithmic-dilation and erosion are defined for a structuring function thanks to the LIP-addition law . Their expressions are related to the “classical” dilation \(\delta _b\) and \(\varepsilon _b\) facilitating their implementation. As both operators form an adjunction, a logarithmic-opening and closing are defined. The logarithmic-MM is compared to the “classical” MM based on an additive structuring function through several examples. Results show that Logarithmic-MM operators are particularly efficient to detect contrast variations in the dark parts (and also in the bright parts) of images caused by different illumination conditions. In future, logarithmic-MM operations will be extended to colour and multivariate images.