%gmChap07.tex

\graphicspath{{./figures/}}

\chapter[Sup-Inf Operators]{\label{Chap7}Sup-Inf Operators}
The main contents  of this
chapter are two representation theorems: one for
translation-invariant monotone set operators and one for functions
operators that are monotone, contrast invariant, and translation
invariant. If $T$ is a function operator satisfying these three
conditions, then it has a ``sup-inf'' representation of the form
\[
Tu(\fxx)=\sup_{B\in\mathcal B} \inf_{\fxy\in B}u(\fxx+\fxy),
\]
where $\mathcal B$ is a family  of subsets of $\mathcal M(\SN)$, the set of all measurable subsets of $\SN$. This
theorem is a nonlinear analogue of the Riesz theorem that states that a continuous linear translation-invariant
operator from $L^2(\RR^N)$ to $C^0(\RR^N)$ can be represented as a convolution
\[
Tu(\fxx)=\int_{\RR^N}u(\fxx-\fxy)k(\fxy)\,\rmd\fxy.
\]
In this case, the kernel $k\in L^2(\RR^N)$  is called the impulse
response. In the same way, $\mathcal B$ is an impulse response for
the nonlinear operator.

\section{Translation-invariant monotone set operators}



Recall that a set of $\mathcal M$ can contain $\infty$.  We have specified that $\fxx+\infty=\infty$ for every $\fxx\in
\SN$. As a consequence, for any subset $B$ of $\SN$, $\infty+B=\{\infty\}$. In this chapter we shall associate with any
nonempty subset $\mathcal B$ of $\mathcal M$ a set operator defined by
\begin{equation}\label{eq81}
\mathcal T X=\{\fxx\in \SN\mid\fxx+B\subset X \hbox{ for some } B\in \mathcal B\}.
\end{equation}



\begin{definition}\label{definitionBstandard}
We say that a subset $\mathcal B$ of $\mathcal M$ is standard if it is not empty and if its associated operator
satisfies
\begin{description}

\item[(i)] $\forall R>0,\;\exists R'>0,\; \mathcal T(B(0,R))\subset B(0,R');$

\item[(ii)] $\forall R>0,\;\exists R'>0,\; B(0,R')^c\subset \mathcal T(B(0,R)^c).$
\end{description}

\end{definition}

\begin{exercise} Conditions (i) and (ii) on $\mathcal B$
are easily   satisfied.  Check that Condition (i) is equivalent to
$$\forall R>0,\;\exists C>0,\; (B\in \mathcal B,\hbox{ and }
\hbox{diameter}(B)\leq R) \Rightarrow B\subset B(0,C).$$
 Check
that this condition is achieved (e.g.) if all elements of $\mathcal B$ contain 0. Check that Condition (ii) is achieved
if $\mathcal B$ contains at least one bounded element $B$. \finex
\end{exercise}

\begin{exercise} Show that if $\mathcal B$ contains $\emptyset$, then $\mathcal B$ is not standard.
\finex
\end{exercise}


\begin{theorem}[Matheron]\label{theorem7.1} Let $\mathcal T$ be a
 translation-invariant and standard monotone set operator. Consider the subset of $\mathcal D(\mathcal T)$,
  \begin{equation}\label{defsetB}
  \mathcal B=\{B\in \mathcal D(\mathcal T)\mid 0\in\mathcal T B\}\end{equation} Then $\mathcal B$ is
standard and the operator $\mathcal T$ is associated with $\mathcal B$ by \eqref{eq81}.
  Conversely, if $\mathcal B$
is any standard subset of $\mathcal M$, then  \eqref{eq81} defines a translation-invariant standard monotone set
operator on $\mathcal M$.
\end{theorem}

\begin{definition}
In Mathematical Morphology, a set  $\mathcal B$ such that
\eqref{eq81} holds is
 called a set  of {\rm structuring elements of $\mathcal T$}
 and $\mathcal B=\{X\in \mathcal D(\mathcal T)\mid 0\in\mathcal T
X\}$ is called {\rm  the canonical set of
 structuring elements of $\mathcal T$.}
\end{definition}

\begin{proof}[Proof of Theorem \ref{theorem7.1}]$\;$

\medskip\noindent {\bf Proof of  \eqref{eq81}}.\newline  Let
$\mathcal B=\{X\in \mathcal D(\mathcal T)\mid 0\in\mathcal T X\}$. Then for any $\fxx\in \RR^N$,
\begin{align*}
\fxx\in\mathcal T X&\stackrel{\mathrm(1)}{\Longleftrightarrow}0
\in\mathcal T X-\fxx\stackrel{\mathrm(2)}{\Longleftrightarrow}0\in\mathcal
 T(X-\fxx)\stackrel{\mathrm(3)}{\Longleftrightarrow}X-\fxx\in\mathcal B\\
&\stackrel{\mathrm(4)}{\Longleftrightarrow} X-\fxx=B\text{ for
some }B\in\mathcal B\stackrel{\mathrm(5)}{\Longleftrightarrow}\fxx+B
\subset X\text{ for some }B\in\mathcal B.
\end{align*}
The equivalence (2) follows from the  translation invariance of $\mathcal T X$; (3) is just the definition of $\mathcal
B$; and (4) is a restatement of (3). The implication from left to right in (5) is obvious. The implication from right
to left in (5) is the point where the monotonicity of $\mathcal T$ is used: Since $B\subset X-\fxx$, it follows from
the monotonicity of $\mathcal T$ that $X-\fxx\in\mathcal B$.\newline Let now $\fxx=\infty$. Since $\mathcal T $ is
standard,  $\mathcal B$ is not empty (it contains $\SN$ because $\mathcal T(\SN)=\SN$) and we have
$$\infty\in \mathcal TX\Leftrightarrow \infty \in X\Leftrightarrow
\exists B\in \mathcal B,\; \infty +B\subset X,$$ because $\infty
+\SN=\{\infty\}$.

\skipaline {\bf Proof that $\mathcal B$ is standard if $\mathcal T$ is standard monotone.}\newline   Since $\mathcal
T(\SN)=\SN,$ $\mathcal B$ contains $\SN$ and is therefore not empty.
  The other properties are straightforward.


\skipaline{\bf Proof that \eqref{eq81} defines a standard monotone
set operator if $\mathcal B$ is standard.}\newline
  Using \eqref{eq81}, it is a straightforward calculation
   to check that $\mathcal T$ is
monotone and translation invariant, and that $\mathcal T(\SN)=\SN$, $\mathcal T(\emptyset)=\emptyset$. The equivalence
$\infty\in\mathcal TX$ if and only if $\infty\in X$ follows from the fact that $\mathcal B$ is not empty.  $\mathcal T$
sends bounded sets onto bounded sets and complementary sets of bounded sets onto complementary sets of bounded sets by
definition of a standard set $\mathcal B$.
\end{proof}

\begin{exercise} Check that if $\mathcal T$ is standard monotone, then its canonical set of structuring elements
satisfies (ii). \finex
\end{exercise}
 $\mathcal B_0=\{X\mid0\in\mathcal T X\}$ is not the only set that can be used to represent $\mathcal T$. A monotone
operator $\mathcal T$ can have many such sets and here is their characterization.


\begin{proposition}\label{reductiondeselementstructurants}
Let $\mathcal T$ be a translation invariant standard monotone set
operator and let $\mathcal B_0$ its canonical set of structuring
elements. Then
 $\mathcal B_1$ is  another standard set of structuring elements
  for $\mathcal T$ if and only if it satisfies
\begin{enumerate}[(i)]\setlength\itemsep{2pt}

\item $\mathcal B_1\subset \mathcal B_0$,

 \item  for all $B_0 \in
\mathcal B_0$, there is $B_1\in \mathcal B_1$ such that
$B_1\subset B_0$.
\end{enumerate}
\end{proposition}
\begin{proof}   Assume that $\mathcal T$ is
obtained from some set $\mathcal B_1$ by \eqref{eq81} and let $\mathcal B_0$ be the canonical set of structuring
elements of $\mathcal T$. Then for every $B_1\in \mathcal B_1$, $\mathcal T B_1=\{\fxx\mid\fxx+B\subset B_1 \text{ for
some }B\in\mathcal B_1\}$. It follows that $0\in \mathcal TB_1$ and therefore $B_1\in \mathcal B_0$.  Thus $\mathcal
B_1\subset \mathcal B_0$. In addition, if $B_0\in \mathcal B_0$, then $0\in \mathcal TB_0$, which means that
$0\in\{\fxx\mid\fxx+B_1\subset B_0 \text{ for some }B_1\in\mathcal B_1\}$, that is $B_1\subset B_0$ for some $B_1\in
\mathcal B_1$.

Conversely, let $\mathcal B_1$ satisfy (i) and (ii) and let
$$\mathcal T_1X=\{\fxx\mid\exists B_1\in \mathcal
B_1,\;\fxx+B_1\subset X\}.$$ Using (i), one deduces that $\mathcal
T_1X\subset \mathcal TX$ for every $X$ and using (ii) yields the
converse inclusion.  Thus $\mathcal B_1$ is a structuring set for
$\mathcal T$. The fact that $\mathcal B_1$ is standard is an
obvious check using (i) and  (ii).
\end{proof}


\section{The Sup-Inf form}

\begin{lemma}\label{theorem7.2}
Let $T:\mathcal F\to\mathcal F$ be a standard monotone function
operator,  $\mathcal T$ a standard monotone translation invariant
set operator and $\mathcal B$ a set of structuring elements for
$\mathcal T$. If $T$ and $\mathcal T$ satisfy the commutation of
thresholds $ \mathcal T
\levelset_{\lambda}u=\levelset_{\lambda}Tu$, then $T$ has the
``sup-inf" representation
\begin{equation}\label{eq84}
Tu(\fxx)=\sup_{B\in\mathcal B}\inf_{\fxy\in \fxx+ B}u(\fxy).
\end{equation}
 \end{lemma}

\begin{proof}

For $u\in\mathcal F$, set  $\tilde T u(\fxx)=\sup_{B\in\mathcal
B}\inf_{\fxy\in \fxx+B}u(y)$. We shall derive the identity
$T=\tilde T$ from the equivalence
\begin{equation}\label{eq7iff}
\tilde T u(\fxx)\geq\lambda \Longleftrightarrow  T
u(\fxx)\geq\lambda.
\end{equation}
Assume first that $\fxx\in \RR^N$. Then
\begin{align*}
&Tu(\fxx)\geq\lambda\stackrel{\mathrm(1)} {\Longleftrightarrow}
Tu(\fxx)\geq\mu \text{ for all } \mu<\lambda\stackrel{\mathrm(2)}
{\Longleftrightarrow}
\fxx\in\levelset_{\mu} Tu \text{ for all } \mu<\lambda\\
&\stackrel{\mathrm(3)}{\Longleftrightarrow} \fxx\in\mathcal T\levelset_{\mu} u \text{ for all
}\mu<\lambda\stackrel{\mathrm(4)} {\Longleftrightarrow} \exists B\in \mathcal B,\;\fxx+B\subset \levelset_\mu u\text{
for all } \mu<\lambda\\&\stackrel{\mathrm(5)} {\Longleftrightarrow} \text{There is a } B\in{\mathcal B}\text{ such that
}\inf_{\fxy\in \fxx+B}u(\fxy)
\geq\mu\text{ for all }\mu<\lambda\\
&\stackrel{\mathrm(6)} {\Longleftrightarrow} \sup_{B\in{\mathcal
B}}\inf_{\fxy\in \fxx+B}u(\fxy)\geq\lambda\stackrel{\mathrm(7)}
{\Longleftrightarrow}\tilde T u(\fxx)\geq\lambda.
\end{align*}
Equivalence (1) is just a  statement about real numbers and (2) is
the definition of a level set. It is at (3) that we replace
$\levelset_{\mu} Tu$ with $\mathcal T \levelset_{\mu}u$.
Equivalence (4) follows by the definition of $\mathcal T$ from
$\mathcal B$ by \eqref{eq81}. The equivalence (5) is   the
definition of the level set $\levelset_{\mu} u$.  Equivalence (6)
is another statement about real numbers, and (7) is the definition
of $\tilde T$.
\newline Assume now that $\fxx=\infty$. Since for all $B\in
\mathcal L$, $\infty+B=\{\infty\}$, one obtains $\tilde Tu(\infty)=u(\infty)$.  By assumption $Tu(\infty)=u(\infty).$
 This completes the proof of \eqref{eq84}.
\end{proof}

From the preceding result, we can easily derive a general form for
translation and contrast invariant standard monotone operators.
\begin{theorem}\label{fullequivalence} Let $T:\mathcal F\to\mathcal F$
 be a translation
and contrast invariant standard monotone operator. Then it has a
``sup-inf" representation \eqref{eq84} with a standard set of
structuring elements.
\end{theorem}
\begin{proof}
 By the  level set extension
 (Theorem \ref{evansspruckextension}),  $T$ defines a unique  standard monotone set operator $\mathcal T:
\mathcal L\mapsto \mathcal L$.  $\mathcal T$ is defined by the
commutation of thresholds, $ \mathcal T
\levelset_{\lambda}u=\levelset_{\lambda}Tu $. By Lemma
\ref{theorem7.2}, the commutation with thresholds is enough to
ensure that  $T$ has  the sup-inf representation \eqref{eq84} for
any set of structuring elements $\mathcal B$  of $\mathcal T$.
\end{proof}

\begin{definition} \label{canonicalform}
As a consequence of the preceding theorem, the canonical set of
structuring elements of $\mathcal T$ will also be called {\rm
canonical set of structuring elements of $T$.}
\end{definition}

The next theorem closes the loop.

\begin{theorem} Given any  standard subset $\mathcal B$ of
 $\mathcal M$,    Equation \eqref{eq84},
 \[
Tu(\fxx)=\sup_{B\in\mathcal B}\inf_{\fxy\in\fxx+ B}u(y),
\] defines a contrast and
translation invariant standard monotone function operator from
$\mathcal F$ into itself.
\end{theorem}
\begin{proof} By Theorem \ref{3.5bis}, it is enough to  prove that
   $T$ is the stack filter
of  $\mathcal T$, the standard monotone set operator associated with $\mathcal B$. Let us call  $T'$ this stack filter
and let us check that $Tu(\fxx)\geq \lambda\Leftrightarrow T'u(\fxx)\geq \lambda$.\newline we have
$T'u=\sup\{\lambda,\;\fxx\in \mathcal T(\levelset_\lambda u)\}.$ Thus by \eqref{eq81},
$$T'u(\fxx)\geq\lambda\Leftrightarrow \forall\mu<\lambda,\;\exists
B, \;\fxx+B\subset \levelset_\mu u.$$ On the other hand,
 \begin{eqnarray}
 \nonumber
  Tu(\fxx)=
  \sup_{B\in\mathcal B}\inf_{\fxy\in\fxx+B}u\geq\lambda
   &\Leftrightarrow& \\\nonumber
  \forall\mu<\lambda,\;\exists  B\in\mathcal B, \inf_{\fxy\in \fxx+B}u\geq\mu
   &\Leftrightarrow&  \\\nonumber
 \forall\mu<\lambda, \exists B\in \mathcal B,\; \fxx+B\subset \levelset_\mu u. & &
\end{eqnarray}
Thus, $T=T'$.
\end{proof}

We end this section by showing that sup-inf operators  can also be represented as inf-sup operators, $$Tu(\fxx)=
\inf_{B\in\mathcal B}\sup_{\fxy\in\fxx+B}u(\fxy).$$
 This is done, in the
mathematical morphology terminology, by ``duality". The dual
operator of a function operator is defined by $\tilde Tu=-T(-u).$
Notice that $\tilde{\tilde T}=T$.

\begin{proposition} \label{infsupformaswell}
 If $T$ is a
standard monotone, translation invariant and contrast invariant
operator, then  so is $\tilde T$.  As a consequence,  $T$ has a
dual ``inf-sup" form
$$Tu= \inf_{B\in\tilde{\mathcal
B}}\sup_{\fxy\in\fxx+B}u(\fxy),$$ where $\tilde{\mathcal B}$ is
any set of structuring elements for $\tilde T$
\end{proposition}
\begin{proof}
  Setting $\tilde g(s)=-g(-s)$, it is easily checked that
$\tilde g$ is a contrast change if and only if $g$ is. One has by the contrast invariance of $T$,
$$\tilde T(g(u))=-T(-g(u))=-T(\tilde g(-u))=-\tilde
g(T(-u))=g(-T(-u))=g(\tilde Tu).$$ Thus, $\tilde T$ is contrast invariant. The standard monotonicity and translation
invariance of $\tilde T$ are obvious. Finally, if we have $\tilde Tu(\fxx)=\sup_{B\in\tilde{\mathcal
B}}\inf_{\fxy\in\fxx+B}u(\fxy)$, then
$$Tu=-\sup_{B\in\tilde{\mathcal
B}}\inf_{\fxy\in\fxx+B}(-u(\fxy))=-\sup_{B\in\tilde{\mathcal
B}}(-\sup_{\fxy\in\fxx+B}u(\fxy))=\inf_{B\in\tilde{\mathcal B}}\sup_{\fxy\in\fxx+B}u(\fxy).$$
\end{proof}

\begin{exercise}
Check the standard monotonicity and translation invariance of $\tilde T$. \finex
\end{exercise}

\section{Locality and isotropy}
For linear filters,  locality  can be defined by the fact that the
convolution kernel is compactly supported.  This property is
important, as it guarantees that the smoothed image is obtained by
a local average. Morphological filters may need a locality
property for the same reason.
\begin{definition}\label{deflocality} We say that a translation
invariant function operator $T$ on $\mathcal F$ is local if there
is some  $ M\geq 0$ such that
$$(u=u'\hbox{ on  } B(0,M))\Rightarrow Tu(0)=Tu'(0).$$
\end{definition}
 The point 0 plays no special
role in the definition. By translation invariance it is easily
deduced from the definition that for $\fxx\in \RR^N$, the values
of $Tu(\fxx)$ only depend upon the restriction of $u$ to
$B(\fxx,M)$.

\begin{proposition}\label{localityofT}  Let $T: \mathcal F\to
\mathcal F$ be a contrast and translation invariant standard
monotone
 operator and $\mathcal B$ a set of structuring elements for
$T$. If  $T$ is local, then  $\mathcal B_M=\{B\in \mathcal  B\mid B\subset \overline{B(0,M)}\}$ also is a set of
structuring elements for $T$. Conversely, if all elements of $\mathcal B$ are contained in $\overline{B(0,M)}$, then
$T$ is local.
\end{proposition}
\begin{proof} We prove the statement with the sup-inf  form for $T$ given by Theorem \ref{fullequivalence},
\begin{equation}\label{bornerlesB}
Tu(\fxx)=\sup_{B\in \mathcal B}\inf_{\fxy\in B}u(\fxx+\fxy).
\end{equation}
Consider the new function $u_\varepsilon(\fxx)=u(\fxx)-\frac 1\varepsilon d(\fxx, B(0,M))$, where we take for $d$ a
distance function on $\SN\subset  \RR^{N+1}$, so  that $u_\varepsilon\in \mathcal  F$. Take any $B\in \mathcal B$
containing a point $\fxz\notin \overline{B(0,M)}$ and therefore not belonging to $\mathcal B_M$. Then $\inf_{\fxy\in B}
u_\varepsilon(\fxy)\leq u(\fxz) - \frac 1\varepsilon d(\fxz,B(0,M))< Tu(0)$ for $\varepsilon $ small enough. So we can
discard such $B$'s  in the computation  of $Tu(0)$ by \eqref{bornerlesB}. Since by the locality assumption
$Tu(0)=Tu_\varepsilon(0)$, we obtain
$$Tu(0)=Tu_\varepsilon(0)=\sup_{B\in \mathcal
B_M}\inf_{\fxy\in B}u(\fxy).$$ By the translation  invariance of
all all considered operators, this proves the direct statement.
The converse statement is straightforward.
\end{proof}

We end this paragraph with a definition and an easy characterization of isotropic operators in the sup-inf form. In the
next proposition, we actually consider a more general setting, namely the invariance of $T$ under some geometric group
$G$ of transformations of  $\RR^N$, for example the isometries.  Since we use to extend the set and function operators
to $S_N$, we must also extend such transforms by setting $g(\infty)=\infty$ for $g\in G$. Also, define the operator
$I_g$ on functions $u:\SN\to\RR$ by $I_gu(\fxx)=u(g\fxx)$.
\begin{definition}\begin{itemize}
\item We say that $\mathcal B$ is invariant under a group $G$ of transformations of $\SN$ onto $\SN$ if, for all $g\in
G$, $B\in\mathcal B$ implies $gB\in\mathcal B$.

\item If, for all $g\in G$, $TI_g=I_gT$ (resp. $\mathcal Tg=g\mathcal T$), we say that $T$ (resp. $\mathcal T$) is
invariant under $G$.

\item In particular, we say that $T$ (resp. $\mathcal T$) is {\rm isotropic} if it commutes with all linear isometries
$R$ of $\RR^N$, and {\rm affine invariant} if it commutes with all linear maps $A$ with determinant 1.
\end{itemize}
\end{definition}

\begin{proposition}\label{isotropyetB} Let
$G$ be any group of linear maps : $g:\RR^N\to \RR^N$ extended to $\SN$ by setting $g(\infty)=\infty$. If $T$ (resp.
$\mathcal T$) is translation invariant and invariant under $G$ and $\mathcal B$ is a standard set of structuring
elements for $T$ (resp $\mathcal T$), then $G\mathcal B=\{gB \mid g\in G,\; B\in\mathcal B\}$ is another,
$G$-invariant, standard set of structuring elements. Conversely, if $\mathcal B$ is a standard and $G$-invariant set of
structuring elements for $T$ (resp. $\mathcal T$), then this operator is $G$-invariant (and translation invariant.)
\end{proposition}
\begin{proof} All the verifications are straightforward. The only
point to mention is that the considered groups are made of
transforms sending bounded sets onto bounded sets and
complementary sets of bounded sets onto complementary sets of
bounded sets.
\end{proof}
\begin{exercise} Prove carefully Proposition \ref{isotropyetB}.
\finex
\end{exercise}

\skipaline{\bf Some terminology}.
\newline It would be tedious to
state theorems on operators on $\mathcal F$ with such a long list of requirements as {\it  Standard Monotone,
Translation and Contrast Invariant, Isotropic}.  We shall call such operators {\it $\SMTCII$ operators} because they
retain the essential requirements of  morphological smoothing filters . All the examples we consider in this book are
actually $\SMTCII$ operators. Not all are local, so we will specify it when needed. Operators can be still more
invariant, in fact affine invariant, and we will specify it as well.  Since all of these operators $T$ have an inf-sup
or a sup-inf form, we always take for $\mathcal B$ a standard structuring set reflecting the properties of $T$, that
is, bounded in $B(0,M)$ when $T$ is local and invariant by the same group as $T$. A last thing to specify is this: We
have restricted our analysis to operators defined on $\mathcal F$. On the other hand, their inf-sup form permits to
extend them to all measurable functions and we shall still denote the resulting operator by $T$. $Tu$ can then assume
the $-\infty$ and $+\infty$ values. All the same, it is an immediate check to see that this extension still is monotone
and commutes with contrast changes:

\begin{proposition}\label{propertiesofextensionofinfsup}
Let $T$ be a function operator in the  {\rm inf-sup} or {\rm sup-inf} form associated with a standard set of
structuring elements $\mathcal B\subset \mathcal M$. Then $T$ is  monotone and contrast invariant on the set of all
bounded measurable functions of $\SN$.
\end{proposition}
\begin{exercise}
Prove Proposition  \ref{propertiesofextensionofinfsup}. \finex
\end{exercise}
\section[The operators who's who]{The who's who of monotone contrast invariant
 operators\label{sectionwhoiswho}}

The aim of this short section is to draw a synthetic picture of an
equivalence chain built up in this chapter and in Chapter
\ref{Chap6}.  We have constructed three kinds of objects,
\begin{itemize}
\item contrast and translation invariant standard monotone
function operators $T:\;\mathcal F\to\mathcal F$; \item
translation invariant standard monotone set operators $\mathcal T$
defined on $\mathcal L$; \item standard sets of structuring
elements  $\mathcal B$.
\end{itemize}
The results proven so far can be summarized  in  the following
theorem.

\begin{theorem}\label{whoiswho} Given
 any of the standard objects
 $T$, $\mathcal T$ and $\mathcal B$ mentioned above, one can pass
  to any other one by using one of the six formulae given below.
\begin{eqnarray*}
    \mathcal B\to T, & &Tu(\fxx)=\sup_{B\in\mathcal
B}\inf_{\fxy\in \fxx+ B}u(\fxy)\hbox{;} \\
    \mathcal B\to\mathcal T, & &\mathcal T X=\{\fxx\mid\exists B\in\mathcal B,
    \;\fxx+B\subset X\}\hbox{;} \\
    \mathcal T\to  T, & &Tu(\fxx)=\sup\{\lambda\mid
\fxx\in{\mathcal T}\levelset_\lambda u\}\hbox{;} \\
    T\to \mathcal T, & &\mathcal T(\levelset_0u)=\levelset_0(Tu) \hbox{;}  \\
    \mathcal T\to \mathcal  B, & &\mathcal B=\{B\in\mathcal L\mid 0\in\mathcal TB\}\hbox{;}\\
    T\to \mathcal B, & &\hbox{ by }T\to\mathcal T \hbox{ and }
    \mathcal T\to\mathcal B.
\end{eqnarray*}%
In addition,  $\mathcal B$ can be bounded in some $B(0,M)$ if and only if $T$ is local; $T$ or $\mathcal T$ is
$G$-invariant, for instance isotropic, if and only if it derives from some $G$-invariant (isotropic) $\mathcal B$. If
an operator has the inf-sup  or sup-inf form for some $\mathcal B$, it can  be extended to all measurable functions on
$\RR^N$ into a monotone and contrast invariant operator.
\end{theorem}

\begin{proof}
 Theorem \ref{theorem7.1}
yields $\mathcal T\to \mathcal B$ and $\mathcal B\to \mathcal T$; Theorem \ref{3.5bis} yields $\mathcal T\to T$;
Theorem \ref{fullequivalence} yields $T\to\mathcal T\to\mathcal B$; Theorem \ref{evansspruckextension} yields $T\to
\mathcal T$. The final statements come from Propositions \ref{localityofT}, \ref{isotropyetB} and
\ref{propertiesofextensionofinfsup}.
\end{proof}

\medskip\noindent So we get a full equivalence between all objects, but we have left apart the commutation  with thresholds
property. When we define a set operator $\mathcal T$ from a function operator $T$ by the level set extension, we know
that $\mathcal T: \mathcal L\to \mathcal L$ is upper semicontinuous and that the commutation with thresholds
$\levelset_\lambda(Tu)=\mathcal T(\levelset_\lambda u)$ holds.  Conversely,  if we define  a function operator $T$ as
the stack filter of a standard monotone set $\mathcal T$, we do not necessarily have the commutation of thresholds;
this is true only if $\mathcal T$ is  upper semicontinuous on $\mathcal L$ (see Theorem \ref{3.5bis}) and this upper
semicontinuity property is not always granted for interesting monotone operators, particularly  when they are affine
invariant.  Fortunately enough, the commutation with thresholds is ``almost" satisfied for any stack filter as we state
in Proposition \ref{commutationalmosteverywhere} in the next section.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%ù
\subsection{Commutation with thresholds
almost everywhere\label{commutationalmosteverywhere}} In this section we always  assume the considered sets to belong
to $\mathcal M$ and the considered functions to be Lebesgue measurable.
 We say that a set $X$ is contained in  a set $Y$ almost everywhere
if $$\hbox{measure}(X \setminus Y) = 0,$$
 where $\hbox{measure}$
denotes the usual Lebesgue measure in $\RR^N$. We say that $X=Y$
almost everywhere if $X \subset Y$ and $Y\subset X$ almost
everywhere. We say that two functions $u$ and $v$ are almost
everywhere equal if $\hbox{measure}(\{\fxx, u(\fxx) \neq
v(\fxx)\}) = 0.$

\begin{lemma} \label{lemmapp2} Let
$(X_\lambda)_{\lambda \in \RR}$ be a nonincreasing family of sets of $\mathcal M$,
 that is $X_\lambda \subset X_\mu$ if $\lambda \geq \mu$. Then, for almost
 every $\lambda$ in $\RR$,
\begin{equation} X_\lambda = \bigcap_{\mu < \lambda} X_\mu, \qquad \hbox{
almost everywhere. } \label{enspp}
\end{equation}
\end{lemma}

\begin{proof}
Consider an integrable and strictly positive continuous function $h \in L^1(\RR^N)$ (for instance, the gaussian.)
 Set
$m(X) = \int_X h(\fxx) d\fxx$.  We notice that $m(X)=0$ if and
only if $\hbox{measure}(X)=0$. The function $\lambda \rightarrow
m(X_\lambda)$ is nonincreasing. Thus, it has a countable set of
jumps.  Since every countable set has zero Lebesgue measure, we
deduce that for almost every $\lambda$,
$$ \lim_{\mu \rightarrow \lambda} m(X_\mu) = m(X_\lambda). $$
As a consequence, for those $\lambda$'s, $m(\bigcap_{\mu <
\lambda} X_\mu \setminus X_\lambda) = 0$, which implies
(\ref{enspp}).

\end{proof}


\begin{corollary} \label{II.1.bis}
Let $(X_\lambda)_{\lambda\in \RR}$ be a family of measurable subsets of $\SN$ such that  $X_\lambda \subset X_\mu$ for
$\lambda \geq \mu$, $X_\lambda =\emptyset$ for $\lambda\geq\lambda_0$, $X_\lambda=\SN$ for  $\lambda\leq \mu_0$. Then
the function $u$ defined on $\SN$ by the superposition principle
$$ u(\fxx) =  \sup\{\lambda\mid\fxx \in X_\lambda \}$$
is bounded and satisfies for almost every $\lambda$, $X_\lambda =
\levelset_\lambda u$  almost everywhere.
\end{corollary}

\begin{proof} It is easily checked that $\mu_0\leq u\leq\lambda_0$.
  We have
$$\levelset_\lambda u = \{ \fxx\mid \sup\{\mu, \fxx \in X_\mu\} \geq \lambda \}$$
Now, if $\fxx \in X_\lambda$, we have $\sup\{\mu\mid\fxx \in
X_\mu\} \geq \lambda $ which implies $\fxx \in \levelset_\lambda
u$. Thus, $X_\lambda \subset \levelset_\lambda u$. Conversely, let
$\lambda$ be chosen so that $X_\lambda = \cap_{\mu < \lambda}
X_\mu$ almost everywhere.  This is by Lemma \ref{lemmapp2}  true
for almost every $\lambda \in \RR$. Then if $\fxx \in
\levelset_\lambda u$, we have by definition of $u$, $\fxx \in
X_\mu$ for every $\mu < \lambda$. Thus $\fxx \in \bigcap_{\mu <
\lambda} X_\mu$. We conclude that $X_\lambda u \subset
\bigcap_{\mu < \lambda} X_\mu$ and therefore $\levelset_\lambda u
\subset X_\lambda$ almost everywhere.
\end{proof}

\begin{exercise}\label{almosteverywhereequalityoflevelsets} By using Corollary \ref{II.1.bis} show that if two measurable functions $u$ and $v$ are such that
$\levelset_\lambda u=\levelset_\lambda v$ almost everywhere for almost every $\lambda$, then $u$ and $v$ are almost
everywhere equal.  \finex
\end{exercise}


\begin{proposition}\label{commutationalmosteverywhere} Let $\mathcal T: \mathcal L\to \mathcal M$ be a standard monotone set
operator and $T$ its stack filter. If $u\in\mathcal F$ then for
almost every level $\lambda\in \RR$,
$$\levelset_\lambda(Tu)=\mathcal T(\levelset_\lambda(u))\; \hbox{ almost everywhere.}$$
\end{proposition}

\begin{proof} Since $Tu$ is obtained from the sets
$\mathcal  T(\levelset_\lambda u)$ by superposition principle,
this is an immediate consequence of Corollary \ref{II.1.bis}.
\end{proof}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Exercises}



\begin{exercise}
It is useful to have a test for $\mathcal B$ to determine whether
or not the operator $\mathcal T$ can be expected to be upper
semicontinuous on   $\mathcal L$. Prove that the
translation-invariant monotone operator in Theorem
\ref{theorem7.1} defined by a given set $\mathcal B$ is upper
semicontinuous on $\mathcal L$ if and only if the following
condition holds: If $\bigcap_{n\in\mathbb N}\mathcal T
X_n\ne\emptyset$, then there is a $B\in\mathcal B$ such that
$\fxx+B\subset\bigcap_{n\in\mathbb N} X_n$, where
$\fxx\in\bigcap_{n\in\mathbb N}\mathcal T X_n$ and
$(X_n)_{n\in\mathbb N}$ is any nonincreasing  sequence in
$\mathcal L$.\finex
 \end{exercise}

\begin{exercise}Suppose that $\mathcal B\subset \mathcal L$ contains exactly one set.
Show that $\mathcal T$ is u.s.c. Generalize this
 to the case where $\mathcal B$ contains a finite number of sets. \finex
\end{exercise}


\begin{exercise}Use Theorem \ref{fullequivalence} and Proposition
 \ref{reductiondeselementstructurants} to show that
the extrema killer $T_a$
 can be represented as a sup-inf function operator with the structuring elements
\[
\mathcal B_a=\{B\mid B\text{ is compact, connected, meas\,$(B)=a$, and } 0\in B\}\cup\{\infty\}. \finex
\]
Check that  $\mathcal B_a$ is  standard.
\end{exercise}

\begin{exercise}
Let $\mathcal B=\{\{\fxx\}\mid\fxx\in D(0,1)\}$,
$D(0,1)=\{\fxx\mid|\fxx|\leq1\}$ and consider the associated set
operator $\mathcal T$ and  the associated function operator $T$,
{\it defined on all measurable sets and functions of $\RR^N$} by
formulas \eqref{eq81} and \eqref{eq84}.

\smallskip\noindent 1) Check that $Tu(\fxx)=\sup_{\fxy\in\fxx+D}u(\fxy)$.

\smallskip\noindent 2) Let $(q_n)_{n\in\NN}$ be a countable dense set in $\RR^N$
and consider $u$ defined by $u(\fxx)=1-1/n$ if $\fxx=q_n$ and $u(\fxx)=0$ otherwise. Show that $\mathcal
T\levelset_1u\ne\levelset_1 Tu$. The operator $T$ in this exercise is  one of the classic image operators called a
\textit{dilation}. Check that $T$ commutes with thresholds when its domain of definition is restricted to $\mathcal F$
and the domain of $\mathcal T$ to  $\mathcal L$. This example shows that this
 restriction is  useful to get a simple theory.\finex
\end{exercise}

\begin{exercise}  Show the following property used
in the  proof of Lemma\label{lemmapp} : if
 $h$ is a positive continuous
integrable function on $\RR^N$ and if we set $m(X)=\int_{X}h(\fxx)d\fxx$, then for every measurable set $X$, $m(X)=0$
if and only if $\hbox{measure}(X)=0$.\finex
\end{exercise}



\section{Comments and references}

The formalism presented in this chapter is due to Matheron \cite{Matheron:1975:RSI} in the case of set operators and to
Serra \cite{Serra:1982:IAM} and Maragos \cite{Maragos:1989:RTM} in the case of function operators. Serra's formalism is
actually more general than the one presented here; it will be developed in Chapter \ref{chapter14}, which is about
``nonflat'' morphology. Our presentation relating the sup-inf form of the operator directly to contrast invariance and
establishing the full equivalence between sup-inf operators and contrast-invariant monotone operators is original. The
fact, proven in Proposition \ref{commutationalmosteverywhere} that commutation  with thresholds occurs almost
everywhere without further assumption was proven in \cite{guichard:mma}.

The mysterious ``set of structuring elements'' has received a great deal of attention in the literature. Here are a few
references: on finding the right set of structuring elements \cite{Salembier:1992:SEA,Svalbe:1992:DMF}; on simplifying
them \cite{Schonfeld:1994:OSE}; on decomposing them into simpler ones as one does with linear filters
\cite{Park:1995:DAS,Zhuang:1994:DMS,Zhuang:1986:MSE}; on reducing the number \cite{Richardson:1991:LBS}.

\ifodd\count0
    \clearpage
    \leavevmode
    \thispagestyle{empty}
    \clearpage
\else\relax
\fi
