%% REFERENCE A UN APPENDICE SUR LE THM DE LEBESGUE : A SUPPRIMER.

%%REMARQUES, INFORMATIONS ET CHOSES A FAIRE (14 Septembre 98).  C'EST UN PENSE-BETE POUR MOI
%% : NE PAS EFFACER 

%%ERREUR A CORRIGER : On dit que les ensembles de niveau de la periodisee sont compacts : faux
%%ou a preciser pour le moins. En fait ils sont periodiques et leur fonction distance aussi. Le
%%mieux est donc de donner un corollaire a Evans-Spruck pour les ensembles periodiques et 
%%fonctions periodiques.
%%
%%Je change la definition de "threshold", car sa forme actuelle ressemble trop a un X :

%A FAIRE : LE FILTRE INFSUP TUEUR D'EXTREMA EXTREMA KILLER
%ATTENTION : p  EST PARFOIS UN VECTEUR ET PARFOIS UN SCALAIRE : ARRANGER

%%\varepsilon et \epsilon

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


%\newtheorem{definition}{Definition}
%\newtheorem{proposition}{Proposition}
%\newtheorem{def_and_prop}{Definition and Proposition}
%\newtheorem{proof}{Proof}
%\newtheorem{exercice}{Exercice}
%\newtheorem{corollary}{Corollary}
%\newtheorem{Remark}{Remark}
%\newtheorem{Theorem}{Theorem}

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

%A FAIRE : expliquer l'interet numerique d'Osher-Sethian : fonction distance evite
%la quantification spatiale.  Il faut remarquer que le niveau de gris $u(x)$ est pauvre
%en information (peut subir des chgts de contraste, etre quantifie), alors que la position
% des $X_\lambda u$ est riche en information.  Le fait de considerer l'image comme
%la fonction distance des ses niveaux de gris permet de jouer sur un echange precision-spatiale
%precision niveau de gris : "une image est la fonction distance de ses ensembles de niveaux."

% 1-J'AI MIS "\notation" ou "\not" a tous les endroits ou il faudra 

%2-inclure un symbole correspondant dans l'index de notations, a distinguer de l'index
%courant. 

% Quand je veux me referer a une figure dont le nom est \FIGURE1 par exemple,
%, j'ecris Figure \ref{FIGURE1}. 

%3-Il faudrait definir l'operateur $\med$ de sorte qu'il apparaisse toujours en romain,
% comme $\inf $ ou $\sup$.
%% OK

%4-Il y a la meme notation pour les dilations et erosions d'ensembles et de fonctions. 
%Est-ce genant ?

%5-Probleme a regler : $\med^- $place le $-$ au dessus de med dans les formules entre 
%doubles dollars.
%% OK

%6-Remplacer partout $\med_k$ par $\med$, car l'indication de k n'est pas utile.
%(ce qui est a verifier)

%J'AI CORRIGE TOUS LES CHAPITRES SAUF (ANCIENS NUMEROS) : LE 6, LE 11 ET LE 12  LA SECTION
%"UNIQUENESS" DANS 8 ET TOUJOURS DANS 8 LES SECTIONS CONCERNANT MEDIAN ET AFFINE INVARIANT.  

%7-Figure 7.1 page 86  a refaire  OK
%Harmoniser la notation pour les courbures principales, qui est parfois $k_i$ et parfois
%$\lambda_i$.

%TOUTES CORRECTIONS DU MANUSCRIT REPORTEES SAUF : FIGURES, IMAGES ET CHAPITRE 6
%]%NOUVEAUX COMMENTAIRES, CORRECTIONS DE FEVRIER 2001
%%\newline
%%VERIFIER   RATIONAL CAR IL Y A UN SYMBOLE BIZARRE "ZQ" DANS CHAP 2 CORRESPONDANT
%%A RATIONAL VERIFIER EGALEMENT RELATIVE (symbole bizarre).
%%\newline
%%DEFINIR LA MEAN CURVATURE DANS LE CHAPITRE 5 et LA MCM DANS LE CHAPITRE 6
%%\newline
%%AJOUTER LE PROBLEME DE l'X SUR LA REGULARITE DE LA FONCTION DISTANCE ET LES 
%%EXERCICES (CORRIGES) DE CALCUL DIFFERENTIEL
%%\newline
%%IDEE D'EXERCICES : ETUDE COMPLETE DE L'AMLE





\part{Linear Image analysis \label{PART1}}

\def\rbarre{\overline{\real}}
\chapter{The Heat Equation  \label{chapter1}}
\thispagestyle{empty}


\section{Image linear smoothing and the Laplacian \index{linear smoothing} 
\index{laplacian!mean value}}
We note 
{\it $\fxx = (x_1, ..., x_N)$ \notation
} a point of $\real^N$, $\fxx = (x, y)$ \notation
 if
$N=2$ and
$|\fxx|=(x_1^2+...+x_N^2)^\frac 12$\notation. \index{euclidean norm} If $\fxx,
\fxy
\in
\real^N,$ we denote by
$\fxx.\fxy= x_1y_1+...+ x_Ny_N$ their scalar product\index{scalar product}.
\notation  Consider a bounded function
$u_0(\fxx)$, which we interpret as an image : $u_0(\fxx)$ is the observed ``grey
level" at
$\fxx$.  We write, when $u(x,y)$ is a smooth enough function,
$$u_x  = \frac {\partial u}{\partial x}, \quad u_y = \frac{\partial u}{\partial
y}, \quad u_{xy} = \frac{\partial^2u}{\partial x\partial y}$$ \notation
and, in the same way, if $u_0(\fxx)=u_0(x_1,..., x_N)$,
$$u_i =\frac{\partial u}{\partial x_i}, \quad u_{ij}=\frac{\partial^2
u}{\partial x_i \partial x_j}, \quad \hbox{etc.}$$ \notation
We denote the gradient of $u$ by
\index{differential operators!gradient}
$$Du = (u_x,u_y)$$ when $u(\fxx) = u(x,y)$ and  \notation
$$Du = (u_1, ..., u_N)$$ when $u(\fxx) = u(x_1, ..., x_N)$.  The  Laplacian of
$u$ is denoted by $$\Delta u = u_{xx}+u_{yy}$$ if $N=2$ and 
$$\Delta u= u_{11}+...+u_{NN}$$ in general. \index{laplacian} \notation
\index{differential operators!laplacian}


Assume we wish to establish a more reliable value
$M_hu_0(\fxx)$ of
$u_0(\fxx)$ as a mean value of $u_0$ over a neighborhood of $\fxx$ with size
$h$.
\index{mean value} As for an obvious (but useful) example, let us mention the
case where
$Tu_0(\fxx)=(M_hu_0)(\fxx)$ is obtained as the  mean value of $u_0$ in a
neighborhood of $\fxx$ and let us take $N=2$.  We set 

\fb&
M_hu_0(\fxx)= \frac {1}{\pi h^2}\int_{D(\fxx,h)}u_0(\fxy)d\fxy,
\label{Meanvalue}
\fe&
In this case, the locality means that only values of $u_0$ inside a disk $D(\fxx,h)$
around  $\fxx$ matter.  When $h$ tends to zero, we get a more and more local estimate of
the  value of $u_0$ at $\fxx$.  The parameter $h$ characterizes the ``locality" of the
considered operator, that is, the size of the neighborhood involved in the
filtering operation. The question arises of whether such an operation can be made
independent of $h$.  A first answer is to analyze the asymptotic expansion of
$M_hu_0(\fxx)$ as $h$ tends to zero.  Clearly, if $u_0$ is continuous at $\fxx$,
we have $M_hu_0(\fxx)\to u_0(\fxx)$.  If we assume that $u_0$ is twice
continuously  differentiable ($C^2$) at $\fxx$, then it is easily seen that in
fact
\footnote{We always denote in this text by $o(h)$ a function of $h$ which tends to zero
faster than $h$, by $O(h)$ a function such that, for some constant $C$, $|O(h)|\leq C|h|$,
and by $\varepsilon (h)$ a function tending to zero as $h$ tends to zero. Thus an 
$o(h)$ function can also be written : $h\varepsilon(h)$. \notation}
 
\PMEAN


\fb& 
\frac {M_hu_0(\fxx)-u_0(\fxx)}{h^2}= \frac 1 8 \Delta u_0(\fxx) + \varepsilon(h) 
\label{Laplacian}
\fe&
 In order to prove this formula, let us set, without loss of generality,
$\fxx=0$. Then for $\fxy =(x,y)$ in $D(0,h)$, we have by Taylor formula

$$
u_0(\fxy)=u_0(0)+Du_0(0).\fxy + \frac 1 2 ((u_0)_{xx}x^2+(u_0)_{yy}y^2+2(u_0)_{xy}xy
)+o(h^2).
$$ Taking the mean value over $D(0,h)$, that is, applying $M_h$, we obtain

$$(M_hu_0)(0)=u_0(0) + \frac {1}{2\pi
h^2}((u_0)_{xx}(0)\int_{D(0,h)}x^2dxdy+(u_0)_{yy}(0)\int_{D(0,h)}y^2dxdy ) + o(h^2).$$
Since
$$
\frac {1}{2\pi h^2}\int_{D(0,h)}x^2dxdy=\frac {1}{4\pi h^2}\int_{D(0,h)}(x^2+y^2)dxdy
$$
$$
= \frac {1}{4\pi h^2}\int_0^h 2\pi r^3dr= \frac {h^2}{8},
$$
we obtain the announced formula (\ref{Laplacian}).
This formula suggests the following result : consider for any $t$  a  
sequence of real numbers $h$ and integers $n$ such that $nh^2\to
t$.  Set $u^n = M_{h}^nu_0$.  Then it is to be expected that $u^n(\fxx)\to u(t, \fxx)$
where $u(t,\fxx)$ satisfies the heat equation associated with (\ref{Laplacian}),

\begin{equation}
\frac{\partial u}{\partial t}(t,\fxx)= \frac 1 8 \Delta u(t, \fxx), \quad u(0)=u_0.
\label{Heatequation}
\end{equation}
This convergence result will be obtained
in Section \ref{Iteratedlinear}.  We need some preliminaries on the heat equation. In
Section
\ref{Heat} below,  we shall prove that the heat equation
 has a unique solution for a given initial datum $u_0$ and is equivalent to the
convolution of $u_0$ with Gaussian kernels of increasing width.


\PGAUSS

\section{\label{Heat}Existence and uniqueness of solutions of the
heat equation \index{heat equation!existence and uniqueness of solutions}} 

Define an image $u_0(\fxx)$, $\fxx\in \real^N$, as a real function which is
primarily defined on the hypercube $[0,1]^N$, and subsequently extended to $C=[-1, 1]^N$
by  symmetry across the coordinate hyper-planes. \index{image extension} This extension satisfies for every 
$\fxx = (x_1, ..., x_N)$ in $C$, 
\fb& \label{symetries}
u(\varepsilon_1 x_1, ..., \varepsilon_N x_N)=u(x_1, ..., x_N)
\fe&
where $(\varepsilon_1, ..., \varepsilon_N)$ takes all possible values in $\{-1, 1\}^N$.
We then extend $u(\fxx)$ by periodization into a function on all of $\real^N$ which is
2-periodic with respect to all variables, so that

\fb&
 \label{periodicite}
u( x_1+2n_1, ..., x_N+2n_N)=u(x_1, ..., x_N)
\fe&
for all $(n_1, ...,  n_N)\in \relative^N$.

\PPROLONGE


 The aim of these successive
extensions is first to preserve the  continuity properties of $u$ across the
boundary of $[0,1]^N$ and second to have $u$ defined on all of $\real^N$, so that (e.g.)
convolutions of $u$ with another function can be defined easily.  This way of
extending $u$ is classical in image processing and used in most compression and
transmission standards. It is easily checked that if $u$ is continuous on $[0,1]$, its
extension to $\real^N$ defined in the preceding way also is continuous. 

\begin{Defi}Whenever a function
$u_0$ defined on $\real^N$  satisfies the  periodicity condition
(\ref{periodicite}), we shall say that
$u_0$ belongs  to $L_C$. \notation \index{L$_C$ space of functions}  If it is
bounded, we say that it belongs to $L_C^\infty$. \notation \index{L$_C^\infty$
space of functions}   If it is integrable, that is, $\int_C |u_0(\fxx)|d\fxx
<\infty$, we say that
$u_0$ belongs to
$L_C^1$ \index{L$_C^1$ space of functions} \notation. We endow theses spaces
with  norms, which we shall use  alternatively in the statements to come.
$$\hbox{The } L^\infty_C \hbox{ norm } \index{$L^\infty_C$ norm}\notation :
||u||_{\infty}=\sup_{\fxx \in C}|u(\fxx)|$$ 

$$\hbox{ and the } L^1_C \hbox{ norm } \index{$L^1_C$ norm}:\notation
||u||_{L^1(C)} =
\int_C|u(\fxx)|d\fxx.$$
\end{Defi}
If in addition the function satisfy the symmetries (\ref{symetries}), we say that it 
is symmetric.
\newline
When $||u-v||_\infty\to 0$, we 
say that $u$ converges to $v$ uniformly. 
\index{convergence!uniform} \index{uniform convergence}  When
$||u-v||_{L^1(C)}\to 0$, we say that $u$ converges to $v$ in $L^1_C$.
\index{convergence!$L^1$} \index{$L^1$ convergence} When we assume that a
function 
$u\in L_C^\infty$ is continuous, or $C^m$, or $C^\infty$, this means that $u$ has such
properties on all of $\real^N$ and not only on $C$.  If $u$ is continuous,
then it is  uniformly continuous.  Indeed, by periodicity,
$\sup_{\fxx\in\real^N}|u(\fxx+h)-u(\fxx)|=\sup_{\fxx \in C}|u(\fxx+h)-u(\fxx)|$ and by the
compactness of $C$, $\sup_{\fxx \in C}|u(\fxx+h)-u(\fxx)|=o(1)$.  In the same way, if $u$
is $C^1$, notice that 
$\sup_{\fxx\in \real^N}|Du|(\fxx) = \sup_{\fxx\in C}|Du|(\fxx)$, etc.
\newline
We shall
also consider functions $g$ integrable on all of $\real^N$ ; in such a case, we 
write $$||g||_{L^1}=||g||_{L^1(\real^N)} = \int_{\real^N}|g(\fxx)|d\fxx.$$
We recall a classical density result in $L^1$ : (See e.g. \cite{Rudin:1966:RCA})
\begin{pro}\label{densite} \index{approximation of the $L^1$ space by the space of continuous functions}
If $g\in
L^1(\real^N)$, then there exists a sequence $g_n$ of continuous
functions which are zero  outside a compact set such that $g_n \to g$ in $L^1(\real^N)$,
that is, $\int_{\real^N}|g_n(\fxx) -g(\fxx)|d\fxx \to 0$ as $n\to +\infty$.
\newline
If $u\in L^1_C$, there exists a sequence of continuous functions $u_n\in L^1_C$ such
that $||u_n-u||_{L^1(C)}\to 0$. 
\end{pro}

\PBLUR

A consequence of the density result, also classical is :
\begin{pro}\label{continuiteL1}
If $u\in L^1_C$, then $$\int_C |u(\fxx-\fxy)-u(\fxx)|d\fxx = \varepsilon(|\fxy|).$$
If $u\in L¹(\real^N)$, then
 $u\in L^1_C$, then $$\int_{\real^N} |u(\fxx-\fxy)-u(\fxx)|d\fxx = \varepsilon(|\fxy|).$$
\end{pro}
\paragraph{Proof}
Fix $\varepsilon>0$.  By Proposition \ref{densite}, we can find $v\in L^\infty_C$,
continuous, such that $||u-v||_{L^1(C)}\leq \varepsilon$.  Since $v$ is uniformly
continuous,
we have $\sup_{\fxx \in \real^N}|v(\fxx -\fxy)-v(\fxx)|\leq \varepsilon$ for 
$|\fxy|<\eta$ small enough. Thus
$$\int_C |u(\fxx-\fxy)-u(\fxx)|d\fxx \leq $$
$$\quad\int_C |u(\fxx-\fxy)-v(\fxx-\fxy)|d\fxx
+\int_C |v(\fxx-\fxy)-v(\fxx)|d\fxx + \int_C |v(\fxx)-u(\fxx)|d\fxx \leq 3\varepsilon.
$$
The proof of the second statement is an obvious adaptation of the first.
\enddemo
   
 
We shall
use  multi-indices for derivation, which we denote by $\alpha =(\alpha_1, ...,
\alpha_N)\in \natural^N$, or $\beta = (\beta_1, ..., \beta_N)\in
\natural^N$.\notation We write $\fxx^\alpha$ and $|\fxx|^\alpha$ for
$$x_1^{\alpha_1}x_2^{\alpha_2}...x_N^{\alpha_N} \hbox{  and  }
|x_1|^{\alpha_1}|x_2|^{\alpha_2}...|x_N|^{\alpha_N}$$
respectively.\notation We shall abbreviate the
partial derivatives of a function $g$ by setting
$$\partial^\alpha g= 
\frac{\partial^{\alpha_1+...+\alpha_N}}{\partial x_1^{\alpha_1}...\partial
x_N^{\alpha_N}}g.$$ \notation
We write $g\in C^\infty$ if $g$ is differentiable of any
order. \notation
\begin{Defi}
\index{Schwartz class}
We say that a function $g$ defined on $\real^N$ belongs to the Schwartz class
$\cal S$ \notation if $g\in C^\infty$ and for each pair of  multi-indices
$\alpha$,
$\beta$ there is a constant $C$ such that
$$|\fxx|^\beta|\partial^\alpha g(\fxx)|\leq C.$$
\end{Defi}
\begin{pro}\label{schwartz}
If $g\in \cal S$, then $g$ is integrable on
$\real^N$ :
$\int_{\real^N}|g(\fxx)|d\fxx<\infty$.  For all multi-indices $\alpha, \beta$ the
function
$\fxx^\beta\partial^\alpha g$ also belongs to $\cal S$. 
In addition, for all $\alpha$, $\partial^\alpha g$ is uniformly continuous on
$\real^N$.
\end{pro}
\paragraph{Proof}

The second statement immediately follows from the Leibnitz rule for
differentiating a product. The first one follows from the fact that we can
write $|g(x)|\leq \frac C {1+|\fxx|^{N+2}}$, which is an integrable function on 
$\real^N$. Finally, every continuous function on $\real^N$ tending to zero at infinity  also
is uniformly continuous, so that the last statement is valid.
\enddemo
\begin{pro}{\bf (The Gaussian and the heat equation  )} \index{PDE!heat equation} \index{function!gaussian} \index{gaussian kernel} \index{gauss function|see{gaussian kernel}}\index{heat equation}
\label{gaussienne}\newline
For all $t>0$, the function $\fxx\to G_t(\fxx)=\frac 1{(4\pi t)^{\frac N 2}} 
e^{-\frac{ |\fxx|^2}{4t}}$\notation belongs to $\cal S$ and satisfies the heat
equation 
$$\frac {\partial G_t}{\partial t} - \Delta G_t = 0.$$
\end{pro} \index{heat equation}
\paragraph{Proof}
It is enough to prove the first statement for the function
$g(\fxx)=e^{-|\fxx|^2}$. An easy induction argument shows that $\partial^\alpha
g(\fxx)=P_\alpha(\fxx)e^{-|\fxx|^2}$, where $P_\alpha$ is a $n$-variable
polynomial.  Using the fact that for every $k$, $x^ke^{-x^2}\to 0$ as
$x\to \infty$ concludes the argument. An easy calculation shows that $G_t$ satisfies the
heat equation.
\enddemo

The main operation in linear image filtering is the convolution of the
image with positive integrable functions.  (The prototype of such a
``convolution kernel",  is the Gauss function).

\begin{pro}{\bf (and definition of the convolution)}
\label{convolution} \index{convolution}
Let $u$ be a function in $L_C^1$  and $g\in L^1(\real^N)$. Set  
 $(g\conv u)(\fxx)=\int_{\real^N}u(\fxx-\fxy)g(\fxy)d\fxy$.  Then $(g\conv u)(\fxx)$ is 
defined for almost every $\fxx \in C$.  The convolution function $g\conv u$ belongs 
to $L^1_C $ and we have
\fb& \label{convolL1}
||g\conv u||_{L^1(C)}\leq ||g||_{L^1(\real^N)}||u||_{L^1(C)}.
\fe&
If in addition  $u$ is bounded, then $g\conv u$ is also bounded and 
\fb& \label{convolLinfini}
||g\conv u||_{L^\infty(C)}\leq
||g||_{L^1(\real^N)}||u||_{L^\infty(\real^N)}.
\fe&
\end{pro}
\paragraph{Proof}
 Let us start by proving that $g\conv u$ is well defined and
belongs to $L_C^\infty$ and that (\ref{convolL1}) holds. This is an direct
consequence of Fubini Theorem (\cite{Rudin1996:LCA}), which yields
$$||g\conv u||_{L^1(C)}\leq\int_C(\int_{\real^N}|u(\fxx-\fxy)g(\fxy)|d\fxy) d\fxx =
\int_{\real^N}(\int_C |u(\fxx-\fxy)g(\fxy)|d\fxx)d\fxy.$$
Using the periodicity of $u$, this last integral is equal to
$$\int_{\real^N}\int_C |u(\fxx)|d\fxx)|g(\fxy)|d\fxy =
||u||_{L^1(C)}||g||_{L^1(\real^N)}.$$
Relation (\ref{convolLinfini})
is an obvious consequence of the definition of $g\conv u$ and the 2-periodicity is 
easily checked.
\enddemo

\begin{Exercice}
Check that $g\conv u$ is 2-periodic. 
Show that if, in addition to the assumptions of Proposition \ref{convolution}, 
$g$ is even and $u$ is  symmetric, i.e. satisfies the symmetry relations (\ref{symetries}), then $g\conv u$ also is symmetric.
\end{Exercice}
We shall also be led to consider the convolution of a function in $L^1_C$ with an 
integrable function $g\in L^1(\real^N)$.   The next lemma gives  a useful
general condition on 
$g$ in order that  the convolution of a function $u$ in $L^1_C$ with  $g\in
L^1(\real^N)$   be bounded.

\begin{lem}
\label{C(g)}
Let $g\in L^1(\real^N)$ be an integrable and locally bounded function such that 
for any $R>0$, $g^R(\fxx) = \sup_{\fxy\in B(\fxx, R)}g(\fxy)$ also belongs to
$L^1(\real^N)$.  Then there exists a constant $C(g)$ such that for any $u\in L^1_C$, 
$g\conv u$ is in $L^\infty_C$ and 
\fb&
\label{effetregularisant}
||g\conv u||_{L^\infty(C)}\leq C(g)||u||_{L^1(C)}.
\fe&
\end{lem}

\paragraph{Proof}
We set $\fxz = (z_1, ..., z_N) \in (2\rational)^N$.  The hypercubes 
$\fxz + C$ cover $\real^N$ and for every $\fxy \in \fxz + C$, we have 
$|\fxy-\fxz|\leq \hbox{diam}(C)$, where 
$$\hbox{diam}(C)= \sup_{\fxy, \fxz\in
C}|\fxy-\fxz|= 2\sqrt N.\notation$$ Thus, using the 2-periodicity of
$u$,
$$|(g\conv u)(\fxx)|\leq\int_{\real^N}
|u(\fxx-\fxy)g(\fxy)|d\fxy=\sum_{\fxz \in (2\rational)^N}\int_{\fxz+C}
|u(\fxx-\fxy)g(\fxy)|d\fxy\leq$$
$$
\leq (\int_C |u(\fxy)|d\fxy)\sum_{\fxz \in (2\rational)^N} \sup_{\fxy\in \fxz +
C}|g(\fxy)|,$$ which implies
$$|(g\conv u)(\fxx)|\leq  (\int_C |u(\fxy)|d\fxy)\int_{\real^N}|
g^{\hbox{diam}(C)}(\fxy)|d\fxy= C(g)||u||_{L^1(C)}.$$
\enddemo

Let us now focus on the case where the convolution kernel, like the Gauss
function, belongs to $\cal S$. 

\begin{pro}
\label{convolL1CS}
If $u\in L^1_C$ and $g\in \cal S$, then
 $g\conv u\in C^\infty(\real^N)\cap L_C^\infty$ and
 \fb&
\label{deriveeconvol}
\partial^\alpha(g\conv u) = (\partial^\alpha g)\conv u
\fe&
 for
every multi-index 
$\alpha$. 

\end{pro}


\paragraph{Proof}
By  Proposition \ref{schwartz},
$||g||_{L^1}=\int_{\real^N}|g(\fxx)|d\fxx <\infty$.  Thus by Proposition
\ref{convolution}, 
$g\conv u$  belongs to $L^1_C$. In order to prove
(\ref{deriveeconvol}), we notice that it is enough to  prove it for $\alpha = (1,0,...0)$.
Indeed, we know by Proposition
\ref{schwartz} that $\partial^\alpha g$ is in $\cal S$ if $g$ is, so that the
general case for (\ref{deriveeconvol}) follows from the case $\alpha =
(1,0,...0)$ by an obvious induction.
Using the Taylor expansion formula and setting $e_1=(1,0,...,0)$, 
$$(g\conv u)(\fxx+he_1)-(g\conv u)(\fxx) = \int_{\real^N} (g(\fxx+he_1-\fxy)-g(\fxx
-\fxy))u(\fxy )d\fxy=$$
$$= h\int_{\real^N} \frac {\partial g}{\partial x_1}(\fxx-\fxy)u(\fxy)d\fxy
+\frac {h^2}2\int_{\real^N} \frac{\partial^2 g}{\partial x_1^2}(\fxx+\theta he_1
-\fxy)u(\fxy)d\fxy,$$
where $0\leq \theta=\theta(\fxy)\leq1$.
Since $g\in \cal S$, 
$|\frac{\partial^2 g}{\partial x_1^2}(\fxx)|\leq 
\frac C{1+|\fxx|^{N+2}}$ and therefore, for $|h|\leq 1 $ :
$$
\frac {h^2}2|\int_{\real^N} \frac{\partial^2 g}{\partial x_1^2}(\fxx+\theta he_1
-\fxy)u(\fxy)d\fxy|\leq \frac {h^2}2\int_{\real^N}
\frac {C|u(\fxy)|d\fxy} {1+((|\fxx-\fxy|-1)^+)^{N+2}}=Ch^2.$$
(We note $r^+=\sup(r,0)$.)\notation   
Indeed, the last integral is finite, being the convolution of $u\in L^1_C$ with an
integrable function satisfying the assumptions of Lemma \ref{C(g)}.
So we deduce that $g\conv u$ is differentiable in $x_1$ and 
$\frac{\partial(g\conv u)}{\partial x_1} = (\frac{\partial g}{\partial x_1})\ast
u.$ \endproof

\begin{pro} \label{dirac}
Let $g\in \cal S$, $g\geq 0$, $\int_{\real^N}g(\fxx)d\fxx = 1$ and set
$g_t=\frac 1 {t^N}g(\frac \fxx t)$ for $t>0$.
\newline
i) If $u_0\in L^\infty_C$ is continuous, $g_t\conv u_0$ converges uniformly
to $u_0$, when $t \rightarrow 0$. In addition, we have a maximum principle~:
\fb&
\label{comparaisonconstantes}
\inf_{\fxx\in C}u_0(\fxx)\leq g_t\ast
u_0\leq\sup_{\fxx\in C}u_0(\fxx)
\fe&
\newline
ii) If we only know $u_0\in L^1_C$, then 
$$\int_C |(g_t\conv u_0)(\fxx)-u_0(\fxx)|d\fxx= ||g_t\conv u_0-u_0||_{L^1(C)}\to 0\;
\hbox{ as }\; t\to 0.$$
\end{pro}
\paragraph{Proof of i)}
We remark that 
\fb& \label{rem1} \int_{\real^N}g_t(\fxy)d\fxy = 1
\fe&
and 
\fb& \label{rem2}
\forall \eta>0, \; \int_{\fxy\in \real^N, \;|\fxy|\geq
\eta}g_t(\fxy)d\fxy \to 0 \; \hbox{ as } t\to 0.
\fe&
\newline
 Using (\ref{rem1}), we have
$$g_t\conv u_0(\fxx) -u_0(\fxx)=\int
g_t(\fxy)(u_0(\fxx-\fxy)-u_0(\fxx))d\fxy.$$
Now, as already mentionned, since $u_0$ is continuous on the compact $C$ and periodic, it
is in fact uniformly continuous, so that for
$|\fxy|\leq
\eta(\varepsilon)$ we have
$|u_0(\fxx-\fxy)-u_0(\fxx))|\leq \varepsilon$.
  Using this inequality and (\ref{rem2}) we obtain
$$
|g_t\conv u_0(\fxx)-u_0(\fxx)|\leq \int_{|\fxy|\leq
\eta}|g_t(\fxy)(u_0(\fxx-\fxy)-u_0(\fxx))|d\fxy + \int_{|\fxy|\geq \eta}
|g_t(\fxy)(u_0(\fxx-\fxy)-u_0(\fxx))|d\fxy
$$
$$\quad\quad\quad \leq \varepsilon + 2 ||u_0||_{L^\infty(C)} \int_{|\fxy|\geq
\eta}g_t(\fxy)d\fxy \leq 2\varepsilon \hbox{ for } t \hbox{ small enough.}
$$
Relation  (\ref{comparaisonconstantes}) immediately follows from the 
assumptions $g_t\geq 0$, $\int g_t =1$.\newline
{\bf Proof of ii)}  By Proposition \ref{continuiteL1}, if
$u\in L^1(C)$, then we can find for every $\varepsilon$ a real number $\eta (\varepsilon)$
 such that
$$\int_C|u(\fxx-\fxy)-u(\fxx)|d\fxx\leq \varepsilon \hbox{ for } |\fxy|\leq
\eta(\varepsilon).
$$ 
Thus, by Fubini Theorem again,  using $\int_{\real^N}g_t(\fxy)d\fxy =1$ and (\ref{rem2}):
$$
\int_C(\int_{\real^N}|g_t(\fxy)(u(\fxx-\fxy)-u(\fxx))|d\fxy)d\fxx\leq
$$
$$
\int_{|\fxy|\leq \eta(\varepsilon)} g_t(\fxy) (\int_C|u(\fxx-\fxy)-u(\fxx)|d\fxx)d\fxy 
+\int_{|\fxy|> \eta(\varepsilon)} g_t(\fxy) (2\int_C|u(\fxx)|d\fxx)d\fxy\leq 2\varepsilon
$$
for $t$ small enough. 
\enddemo
We now have all tools at hand to prove the main theorem of this section.
 \begin{th1}
{\bf (Existence and Uniqueness of solutions for the heat equation)}
\label{existenceuniquenessheat}\newline
Let $u_0\in L_C^1$.  Then
\newline
i) $u(t)=G_t\conv u_0$ satisfies, for all $t>0$ and $\fxx\in\real^N$, the heat
equation with initial value $u_0$, that is
 \fb& 
\label{equationchaleur}\frac {\partial u}{\partial
t}=\Delta u
\hbox { and }
\int_C |u(t, \fxx)-u_0(\fxx)|d\fxx \to 0 \hbox{ as }t\to 0.
\fe&
In addition, $u(t,\fxx)$ is $C^\infty$ for $t>0$ and $\fxx\in \real^N$, it belongs for every
$t>0 $ to $L^1_C$ and is uniformly bounded for  $t\in [t_1, +\infty[$ where $t_1$ is any
positive real number:
\fb& 
\label{bounded}
\sup_{\fxx\in \real^N, t\geq t_1} |u(t,\fxx)|\leq C(t_1)||u_0||_{L^1(C)}.
\fe&
\newline 
ii) Conversely, given $u_0$ as above, there is a unique solution $u(t, \fxx)$ of 
(\ref{equationchaleur}) belonging to $L^\infty_C$ for each $t>0$, bounded on
$[t_1, +\infty [$ for each $t_1>0$ and 
$C^3$ on $]0, +\infty[\times \real^N$.
\end{th1}

\PCOMPGAUSS

\paragraph{Proof}
 i)
By Propositions \ref{schwartz}  and \ref{gaussienne}, $G_t$ and its
derivatives belong to $\cal S$. By Proposition \ref{convolL1CS}, we have 
$$\frac {\partial u}{\partial t}-\Delta u = u\ast(\frac{\partial G_t}{\partial
t}-\Delta G_t),$$
 which is zero by Proposition \ref{gaussienne}. 
Relation (\ref{bounded}) 
follows from Lemma \ref{C(g)} applied to $u$ and 
$g=G_t$.  It is easily seen that $C(G_t)\leq C(t_1)$ is a
bounded function for $t\geq t_1$.
\newline  ii) Let us now show the uniqueness.  Let $v$ and $w$ be two solutions of the 
heat equation  (\ref{equationchaleur}) with the same initial datum $u_0\in
L_C^1$ and  bounded for $t\geq t_1>0$.  Thus $u=v-w$ satisfies the
heat equation with initial datum
$u_0=0$ and is bounded again on each interval $[t_1, +\infty [$, $t_1>0$.
Let us assume by contradiction that $u(t,\fxx)\neq 0$, denote by $u(t)$ the partial
function $\fxx \to u(t, \fxx)$ and set
$u_h(t,\fxx)=(G_h\conv u(t))(\fxx)$.  Then, by Propositions \ref{convolution} and
\ref{convolL1CS}, $u_h$ satisfies the same properties as
$u$, is again solution of the heat equation and we have by Lemma \ref{C(g)} the additional
property that 
$u_h(t, \fxx) \to 0$ uniformly as $t\to 0$.  Indeed, using the initial value condition 
in (\ref{equationchaleur}), 
$$||u_h(t)||_{L^\infty(C)}=||G_h\conv u(t)||_{L^\infty(C)}\leq
C(G_h)||u(t)||_{L^1(C)}\to 0 \hbox{ as } t\to 0.$$
In addition, $u_h(t,\fxx)$ is
bounded. Choosing $h$ small enough and changing 
$u$ into $-u$ if necessary,
we can assume by Proposition \ref{dirac} that $u_h(t,\fxx)> 0$ at some
$(t,\fxx)$.  We now consider the  new function $u^\varepsilon (t, \fxx) =
e^{-\varepsilon t}u_h(t,\fxx)$. This continuous and periodic (in $\fxx$) function belongs for every  $t\geq 0$ to
$L_C^\infty$ and tends uniformly to zero as
$t\to
\infty$ or $0$. Thus, its supremum is attained at a point $(t_0, \fxx_0)$ such that $t_0>0$ and $\fxx_0\in
C$.  At $(t_0, \fxx_0)$, we must have $\frac {\partial u^\varepsilon}{\partial t}(t_0,
\fxx_0)=0$ and $\Delta u^\varepsilon (t_0, \fxx_0)=e^{-\varepsilon t}\Delta u_h\leq 0$. Since $u_h$ is a
solution of the heat equation, we have
\newline
$$0=\frac{\partial u^\varepsilon}{\partial t}(t_0, \fxx_0)=(-\varepsilon
u^\varepsilon + e^{-\varepsilon t}\frac {\partial u_h}{\partial
t})(t_0, \fxx_0)$$
$$=-\varepsilon u^\varepsilon(t_0, \fxx_0) +e^{-\varepsilon t}\Delta
u_h(t_0, \fxx_0)\leq -\varepsilon u^\varepsilon(t_0,\fxx_0)<0.$$

This yields a contradiction and we conclude that the solution of the heat
equation is unique.
\enddemo

\zbibnote
{
The Riesz theorem \cite{Rudin:1966:RCA} states that every continuous translation invariant function $u\to Tu$ operator is a convolution $u\to g\ast u$ where $g$ is a smoothing kernel. This is one of the fundamental theorems of both mechanics and signal processing \cite{Mallat:1998:WTS}.
 If, in addition, $u \geq 0\Rightarrow Tu\geq 0$, then $g\geq 0$ is a nonnegative kernel. The Gauss kernel is then paragdimatic, since,  as we shall show in the next chapter, it is the only one to be stable 
by iterated convolutions. 
 There are several types of continuity for $T$, leading to several types of properties for $g$.  For instance, if $T$ is continuous from
$L^2(\real^N)$ into $C^0(\real^N)$ then $g\in L^2(\real^N)$.   Thus, all linear stable image filtering operators are described by their convolution kernel 
$g$.  Hence the analysis of convolutions performed in Section 2.2 as a necessary tool for image processing.  The existence and uniqueness proof of Theorem \ref{existenceuniquenessheat} is classical and to be found in all classical treatises on Partial Differential Equations like Evans \cite{Evans:1998:PDE}, or  Brezis \cite{Brezis:1983:AFT}.  In this chapter, we have used the classical Lebesgue integral.  A short and comprehensive presentation can be found in Rudin \cite{Rudin:1966:RCA}.
}


\chapter{Applications of the heat equation to image analysis. \label{chapter2}}

\section{\label{Iteratedlinear}Convergence of iterated smoothing
filters to the heat equation}
 
In this section, we prove roughly that the heat equation (or the convolution
by a Gauss kernel at different scales) is the  asymptotic state of any iterative
linear isotropic  smoothing. 

\begin{Defi}
\index{function!radial} \index{pseudo-radial function} \index{radial function}
\index{function!pseudo-radial} 
 Let $g(\fxx)\in L^1(\real^N)$ be a real function, which we understand as  a
smoothing kernel \index{smoothing kernel} with which we intend to convolve images.  We say that $g$ is radial if
$g(\fxx)=g(|\fxx|)$ only depends on the norm of $\fxx$.  We  say that $g$ is pseudo-radial if
it satisfies the following relations : \end{Defi}
\fb&
 \int_{\real^N} g(\fxx)d\fxx = 1
\label {integrale=1}
\fe&
 and, for every  $i, j=1,..,N$, such that $i \neq j$,
\fb&
\int_{\real^N} \fxx_ig(\fxx)
= \int_{\real^N}\fxx_i\fxx_jg(\fxx)d\fxx = 0,
\label {momentsnuls}
\fe& 
\fb& 
\int_{\real^N}\fxx_i^2g(\fxx)d\fxx =\sigma.
\label {momentsordredeuxegauxa2}
\fe&

\begin {Exercice}\label{sigmaindifferente} Show  that if $g$ is a radial function, then an adequate rescaling $ag(\frac \fxx b)$ of 
$g$ satisfies the relations (\ref{integrale=1}) and (\ref{momentsordredeuxegauxa2})
with $\sigma=2$ and
preserves the zero moment relations (\ref{momentsnuls}). Thus, there is no loss of
generality in assuming that these relations are true for $g$.
\end{Exercice} 
 We consider  rescalings of
$g$,  
\fb&
\label{rescaling}
g_h(\fxx)=\frac 1 {h^{\frac N 2}}g(\frac \fxx
{h^{\frac 1 2}}),
\fe&
 which concentrate
$g$ and maintain (\ref{integrale=1}) and (\ref {momentsnuls}).   \PCONCENT
In the following, we note
$g^{n\ast} = g\conv g\ast...\conv g$\notation, the $n$-times convolution of a function
$g$.  Our main concern is the behavior of $g_h^{n\ast}$ as $n\to \infty$ and $h\to 0$. 
Let us first see what happens with the convolution by $g_h$ as $h\to 0$.

\begin{th1}\label{asymptotiquelineaire}  
Let $g(\fxx)\in L^1(\real^N)$ be a radial or pseudo-radial function satisfying the
 conditions (\ref {integrale=1}) to (\ref{momentsordredeuxegauxa2}).
Assume further that
\fb&
\label{momentsd'ordre3bornes} 
\int_{\real^N}|g(\fxz)||\fxz|^3d\fxz=C<+\infty.
\fe&
 Then
for every $C^3$ function $u\in L_C^\infty$, 
\fb&
\label{laplacienapparait}
(g_h\conv u)(\fxx)-u(\fxx) = h\frac \sigma 2\Delta u(\fxx) + O(h^\frac 3 2),
\fe&
where $|O(h^\frac 3 2)(\fxx)|\leq C h^\frac 3 2 \max_{\fxx\in C}||D^3u(\fxx)||$.
\end{th1}
\paragraph{Proof}
Using (\ref{integrale=1}), a rescaling inside the integrals and a Taylor expansion of
$u$, 
$$(g_h\conv u)(\fxx)-u(\fxx) = \int_{\real^N}h^{-\frac N 2}g(\frac \fxy{h^\frac 1
2})(u(\fxx-\fxy)-u(\fxx))d\fxy= \int_{\real^N}g(\fxz)(u(\fxx-h^\frac 1 2
\fxz)-u(\fxx))d\fxz
$$
$$=\int_{\real^N}g(\fxz)(- h^\frac 12 Du(\fxx).\fxz + \frac h 2 D^2u(\fxx)(\fxz,
\fxz))d\fxz - \frac 1 6 h^\frac 3 2
\int_{\real^N}g(\fxz)D^3u(\fxx-h^\frac 1 2\theta\fxz)(\fxz,\fxz,\fxz)d\fxz,
$$ 
where $\theta = \theta (\fxx, \fxz, h)$ belongs to $[0,1]$. Using the
moment information (\ref{momentsnuls}-\ref{momentsordredeuxegauxa2}) and the bound
(\ref{momentsd'ordre3bornes}), we obtain
$$|(g_h\conv u)(\fxx)-u(\fxx)-h\frac \sigma 2\Delta u(\fxx)|\leq C h^\frac 3 2 \max_{\fxx\in
C}||D^3u(\fxx)||,$$
where $C$ is defined in (\ref{momentsd'ordre3bornes}).
\enddemo
The former theorem shows a direct relation between the convolution with a smoothing kernel
and the heat equation.  This link will be completed by the  next theorem  : It
essentially states that if we set
   $(T_hu_0) =
g_h\conv u_0$, then  iterates of $T_h $, $((T_h)^nu_0)(\fxx)$, tend to
$u(t,\fxx),$ where $u(t,\fxx)$  is solution of the heat equation.

\begin{th1}
\label{convergenceverschaleur}
Let  $g(x)\in L^1(\real^N)$ be a radial or pseudo-radial nonnegative function
satisfying the moment conditions (\ref {integrale=1} to
\ref{momentsordredeuxegauxa2}),
(\ref{momentsd'ordre3bornes}) and set
$g_h(\fxx) = \frac 1 {h^\frac N 2}g(\frac \fxx{h^\frac 1 2})$ and $T_h u=g_h\conv u$.
Then
\fb&
\label{convergence}
((T_h)^nu_0)(\fxx)\to u(t,\fxx) \hbox{ in } L^1(C) \hbox{ as } n\to +\infty, \; nh\to t,
\fe&
where  $u(t,\fxx)=G_t\conv u_0\in L_C^\infty$ is the solution of the heat
equation (\ref{equationchaleur})  with initial value $u_0$,
$$
\frac {\partial u}{\partial t}=\frac\sigma 2\Delta u
\hbox { and }
\int_C |u(t, \fxx)-u_0(\fxx)|d\fxx \to 0 \hbox{ as }t\to 0.
$$
\end{th1}

 \PLINEAR

The preceding theorem means that from the asymptotic, scale
independent viewpoint, all local linear isotropic ``low pass" iterated filters are equivalent to
the heat equation (and to the convolution with Gaussian kernels with increasing width).
\paragraph{Proof} Without loss of generality  (see Exercise \ref{sigmaindifferente}),
we take $\sigma =2$.
In this proof,  $O(h^\alpha)$ denotes any function of $t$ and $\fxx$ such that
$|O(h^\alpha)|\leq Ch^\alpha$ where $C$ does not depend upon $\fxx$ and $t\in [t_1, t_2]$, a
fixed interval of
$]0, +\infty[$. We shall write $T_hu(t, \fxx)$ for what would be more properly
written $(T_h(u(t)))(\fxx)$, where $u(t)$ denotes the function
$\fxx\to u(t,\fxx).$ In the same way, we shall write $T_h^2u(t, \fxx)$ 
for $(T_h^2(u(t)))(\fxx).$

Using Formula (\ref{laplacienapparait}) in Theorem
\ref{asymptotiquelineaire}, 
we have 
\fb&
\label{consist}
T_h u(t,\fxx)-u(t,\fxx)= g_h\conv u(t, \fxx)-u(t, \fxx) = h\Delta u(t,\fxx) + O(h^\frac 3
2),
\fe&
because $||D^3u(t,\fxx)||$ can be bounded independently of $(t, \fxx)$ on the compact set
$[t_1, t_2]\times C$.
Since $u(t, \fxx) $ is a solution of the heat equation, we also have
\fb&
\label{chaleurdiscrete}
u(t+h, \fxx) - u(t, \fxx) = h\Delta u(t,\fxx) + O(h^2),
\fe&
and, since $u$ is $C^\infty$, the behavior of $O(h^2)$ is again uniform on the compact set $[t_1, t_2]\times C$.
By substracting (\ref{chaleurdiscrete}) from (\ref{consist}), we obtain
\fb&
\label{comparaisondiscretcontinu}
T_hu(t, \fxx) - u(t+h, \fxx) = O(h^\frac 3 2).
\fe&
We notice that if $u\leq C$, then $T_hu\leq C$.  As a consequence, $T_h(O(h^\alpha))$ also
is an $O(h^\alpha)$, uniformly in $t\in [t_1, t_2[, \fxx\in \real^N$.  Thus, applying
$T_h$ to both sides of (\ref{comparaisondiscretcontinu}), we obtain
\fb&
\label{utile-1}
(T_h)^2u(t, \fxx) - T_hu(t+h, \fxx) = O(h^\frac 3 2).
\fe&
We can use Relation (\ref{comparaisondiscretcontinu}) with $t+h$ instead of $t$ and we 
then get
\fb&
\label{utile-2}
T_hu(t+h, \fxx) - u(t+2h, \fxx) = O(h^\frac 3 2).
\fe& 
By adding (\ref{utile-1}) to (\ref{utile-2}) we  obtain
\fb&
\label{secondeiteration}
T_h^2u(t, \fxx) - u(t+2h, \fxx) = 2O(h^\frac 3 2).
\fe&
We can iterate this process and get
\fb&
\label{niterations}
T_h^nu(t, \fxx) - u(t+nh, \fxx) = nO(h^\frac 3 2),
\fe&
provided $t_1\leq t+nh\leq t_2$.   Letting $n\to \infty$ and setting $h=\frac \tau n$
yields
\fb&
\label{util3}
T_h^nu(t, \fxx) - u(t+\tau, \fxx) = O((\frac \tau n)^\frac 1 2),
\fe&
provided $t_1\leq t+\tau\leq t_2$.  This would end the proof, could we take $t=t_1=0$.  Now,
we can't, but we can have it very small.  Fix $\varepsilon>0$ and 
$t_1$ small enough to have 
\fb&
\label{presdezero}
||u(t_1) -u_0||_{L^1(C)}=\int_C |u(t_1, \fxx)-u_0(\fxx)|d\fxx <\varepsilon.
\fe&
By Proposition \ref{convolution}, we have for every $u\in L^1_C$
$$||g_h\conv u||_{L^1(C)}\leq ||g_h||_{L^1(\real^N)}||u||_{L^1(C)}.$$
Since $\int g_h = 1$,  we deduce from (\ref{presdezero})
and this relation applied to $u=u(t_1)-u_0$ that
\fb&
\label{util4}
||T_h^nu(t_1, .)-T_h^nu_0||_{L^1(C)}\leq \varepsilon.
\fe&
By integrating Relation (\ref{util3}) on $C$  with $t=t_1$, we also
have
\fb&
\label{util5}
||T_h^nu(t_1, .) -u(t_1+\tau, .)||_{L^1(C)} = O((\frac \tau n)^\frac 1 2)<\varepsilon
\fe&
for $n$ large enough.
Combining (\ref{util4}) and (\ref{util5}) yields
$$\vert\vert T_h^nu_0 -u(t_1+\tau)\vert\vert_{L^1(C)}<\varepsilon$$
for $t_1$ small enough and $hn=\tau.$
By (\ref{}), we conclude that 
$$||T_h^nu_0 -u(\tau)||_{L^1(C)}\leq 2\varepsilon,$$
  for $nh=\tau$ and $n$ large enough, which concludes the proof.
\enddemo
 
\section{Directional averages and directional heat equations   \label{directional diffusions} }

The aim of this section is to show how to approximate directional second derivatives
 by using local averages. We consider a $C^2$ function $u$ from $\real^N$ into $\real$, and a  vector $\fxz$ of $\real^N$ with norm 1. 
 We can apply the Taylor formula around a point $\fxx$ by considering a perturbation
 of $\fxx$, $\fxx +h\fxz$ :
\fb&
\label{Taylordirectionnel}\index{Taylor formula, directional Taylor formula}
u(\fxx+h\fxz)=u(\fxx)+hDu(\fxx).\fxz+\frac {h^2}2 D^2u(\fxx)(\fxz, h\fxz) +o(h).
 \fe& 
 We define $T_h^{\fxz}$, the operator which computes the mean value of $u$ on a straight  segment oriented by $\fxz$,
$$T_h^{\fxz} u(\fxx)= \frac {1}{2h}\int_{h\in [-1,1]}u(\fxx + h\fxz)dh$$
Integrating  (\ref{Taylordirectionnel}) for $h\in [-1,1]$, we obtain.

\begin{pro} 
\label{laplaciendirectionnel} \index{directional average}
$$ T_h^{\fxz} u(\fxx) - u(\fxx) = \frac{1}{3} h^2 D^2u(\fxx)(\fxz,\fxz) + o(h^2) $$
\end{pro}
As a consequence, the iteration of the operator 
$T_h^{\fxz}$ intuitively corresponds to a directional heat equation,
 in the direction of $\fxz$,
 \fb&
 \label{directionalheatequation}\index{directional heat equation}
 \frac{\partial u}{\partial t}(t, \fxx)=\frac \sigma 2 D^2u(\fxx)(\fxz,\fxz).
 \fe&
 Notice that the directional averages, and the preceding equation, treat $u$ independently on each line paralel
to $\fxz$.  
 Exercise \ref{exercicediffusiondirectionnelle} formalizes this.

\begin{Exercice}
 \label{exercicediffusiondirectionnelle}
 Let, in arbitrary dimension $N$, $u_0\in L^1(C)$ be an initial datum.
Consider  the function
$g(s)=\frac 12\indic_{[-1,1]}(s)$.  
\newline
\newline
(i) Show that it satisfies the 
 the moment conditions (\ref {integrale=1} to
\ref{momentsordredeuxegauxa2}),
(\ref{momentsd'ordre3bornes}). Compute the variance $\sigma$ of $g$.
\newline
\newline
(ii)
 We set
$g_h(s) = \frac 1 {h^\frac 1 2}g(\frac s{h^\frac 1 2})$ and 
$T_h u(\fxx)=\int_\real u(\fxx+s\fxz)g_h(s)ds.$
By applying, in dimension $N=1$, Theorem \ref{convergenceverschaleur}, 
show that for any function $u_0$ in $L^1_C$,
\fb&
((T_h)^nu_0)(\fxx)\to u(t,\fxx) \hbox{ in } L^1(C) \hbox{ as } n\to +\infty, \; nh\to t,
\fe&
where  $u(t,\fxx)$  is the solution of the directional heat
equation  (\ref{directionalheatequation})  with initial value $u_0$,
\end{Exercice}

If we tune the vector $\fxz$ adequately at each point 
$\fxz$, the direction diffusion depending upon $u$ and $\fxx$, the  operator
is then no more linear but the same asymptotic analysis applies at each point.
The main choices we shall consider in this book are $\fxz=\frac {Du}{|Du|}$ and
$\fxz=\frac {Du^\perp}{|Du|}$, where $Du=(u_x, u_y)$ and $Du^\perp=(-u_y, u_x).$
We then get by applying Proposition \ref{laplaciendirectionnel}  the following asymptotic behaviours :


\begin{description}
\item{$\bullet$ Average in the direction of the gradient}  
We choose $\fxz(\fxx) = \frac{Du(\fxx)}{|Du(\fxx)|}$, so that
$$\frac{1}{|Du|^2} Du(Du, Du) = 3\lim_{h \rightarrow 0}  T_h^{Du/|Du|} u.$$
We shall interpret in the next section this differential operator as an "edge detector":
the Canny operator.

\item{$\bullet$ Average in a direction orthogonal to the gradient}
We choose $\fxz(\fxx) = \frac{Du(\fxx)^\perp}{|Du(\fxx)|}$, so that
$$\frac{1}{|Du|^2} Du(Du^\perp, Du^\perp) = 3\lim_{h \rightarrow 0}  T_h^{Du/|Du|} u.$$
This last operator will arise as the second term of the curvature motion.
\end{description}

\begin{Exercice}
We consider a $C^2$ function $u$, from $\real^2$ into $\real$.  Prove that there
 $\exists C>0$, such that
$$ D^2u(Du,Du)(\fxx) = C \lim_{h \rightarrow 0} \frac{1}{2h^2} (\min_{\fxy \in B(\fxx,h)} u(\fxy) + \max_{\fxy \in B(\fxx,h)} u(\fxy)-2u(\fxx)).$$


\end{Exercice}


\section{Edge detection and linear scale space \label{Edgedetection} } 

\subsection{The edge detection doctrine} \index{edge detection} \index{edge}
One of the uses of the linear theory is, in
dimension 2, ``edge detection''.  The assumption of the edge detection doctrine is that 
relevant information in an image is contained in the trace left in the image by the
apparent contours of physical objects which have been photographed. If an object with
some constant color, say, black, is photographed on a bright background, then it is
expected that its silhouette in the image is a closed curve across which the light
intensity $u_0(\fxx)$ varies strongly.  Let us call this curve an ``edge".  The local
detection of an edge  can {\it a priori} be done by computing the gradient $Du_0(\fxx)$. 
This gradient should have a large intensity
$|Du_0(\fxx)|$ and a direction $\frac {Du_0(\fxx)}{|Du_0(\fxx)|}$ which indicates the
direction normal to the silhouette curve. It therefore looks sound  to
simply  compute the gradient of $u_0$ and choose the points where this gradient is
large. This conclusion is a bit irrealistic for two reasons.
\newline
a) The points where the gradient is larger than a given threshold are likely to form
regions, and not curves.
\newline
b) Many points may have a large gradient because of tiny oscillations of the image, not
related to the real objects.  In fact, the digital images being always noisy, there is no reason to
assume the existence or computability of any gradient at all.
\newline
Objection b) is solved by defining a smoothing process : we associate with the image a
smoothed version  $u(t)$, depending of course upon a scale parameter $t$ measuring the
amount of smoothing. In the classical linear doctrine, this smoothing is made by
convolving the image with gaussians of increasing widths.
\newline
Objection a) is solved by defining edge points not as points where the gradient is
large only, but as points where some maximality property of the gradient is observed.
Let us take an example in dimension one.  Let $u(x)$ be a $C^2$ real function on $\real$ and
consider points where $|u'(x)| $ is maximal.  At these points, the second derivative
$u''(x)$ changes sign because extrema of the gradient correspond to a change from
concave to convex or conversely.  Thus we can look for  the ``edge points" of the smooth
signal among the  points where $u''(x)$ crosses zero.  Generalizing this in dimension 2 leads to
the Hildreth-Marr edge detection theory, or alternatively to the Canny edge detection
theory.  The only difference is that Hildreth and Marr replace, in dimension 2, $u''(x)$
by $\Delta u(\fxx) = 
\frac{\partial ^2u}{\partial x^2}(\fxx) + \frac {\partial ^2 u}{\partial y^2}(\fxx)$,
which is the only isotropic linear differential operator of order 2 generalizing $u''$.

\PTDLAGAUSS

Canny (\cite{Canny:1986:CAE}) instead, gives up the linearity and defines edge points as edges where 
the gradient is maximal in the direction of gradient. \index{canny edges detector} In other terms, an edge point
satisfies $g'(0) = 0$, where
$g(t)=|Du|(\fxx + t\frac {Du}{|Du|})$. This implies $D^2u(\frac {Du}{|Du|}, \frac
{Du}{|Du|})= 0$.  
\begin{Exercice}
Compute $g'(0)$ and check the mentionned implication.
\end{Exercice}
So the algorithms of Hildreth-Marr and Canny are as follows.
\newline
\newline
{\bf Edge detection algorithm 1 (Hildreth-Marr)}
\newline
$\bullet$  Convolve $u_0$ with gaussians $G_t$ of increasing widths.  We obtain a
multiscale image $u(t, \fxx)$.   
\newline 
$\bullet$ At each scale $t$ compute all points where $Du\neq 0$ and $\Delta u$ changes
sign.  Such points are called ``zero-crossings of the Laplacian", or shortly
"zero-crossings". \index{zero-crossings of the laplacian}
\newline
$\bullet$ (Optional) Eliminate the zero-crossings at which the gradient is small.
\PZEROCROSS
\PCARRECROSS
\newline\newline
In practice, the found ``edges" are displayed for a series of dyadic scales, $t=$ 2, 4, 8,
16, etc.
\newline\newline
{\bf Edge detection algorithm 2 (Canny's edge detector)}
$\bullet$  Here again, convolve $u_0$ with gaussians $G_t$ of increasing widths.  We obtain
a multiscale image $u(t, \fxx)$.   
\newline 
$\bullet$ At each scale $t$, find all points $\fxx$ where $Du(\fxx)\neq 0$ and  $D^2u(\frac
{Du}{|Du|},
\frac {Du}{|Du|})(\fxx)$ crosses zero. At such points, the function $t\to u(\fxx + t\frac
{Du}{|Du|})$ changes, when $t $ crosses 0, from concave to convex or conversely.
\newline
$\bullet$  At each scale $t$ : fix a threshold $\theta(t)$ and retain as ``edge points at
scale $t$" only the points which satisfy the preceding conditions and in addition
$|Du(\fxx)|>\theta(t)$. \PCANNY
\newline
\newline
\subsection {Discussion and objections}
 The Canny edge detector is generally preferred for its accuracy to the Marr-Hildreth
theory.  Their use and characteristics are, however, essentially the same.  There are many
variants and tentative improvements to the edge detection theory.  Now, the discussion
which follows adapts easily to the variants.  The first thing to be noticed is that,
thanks to Theorem \ref{existenceuniquenessheat} in the former section, we know that
 $u(t, \fxx) = G_t\conv u_0$ is a $C^\infty$ function provided $u_0$ is bounded.  Thus we
can indeed compute second order differential operators of $u(t, \fxx) $ for $t>0$.  In the
case of linear operators like the Laplacian or the gradient, the task is facilitated by the
formula proved in  Proposition \ref{convolL1CS}.       We have 
$\Delta u(t, \fxx)  = \Delta (G_t\conv u_0) = (\Delta G_t)\conv u_0,$  where (in dimension 2)
$$\Delta G_t(\fxx) = \frac{|\fxx|^2-4t}{16\pi t^3}e^{-\frac {|\fxx|^2}{4 t}}.$$
In the same way, the Canny edge detector makes sense because $u$ is $C^\infty$ at all
points where $Du(\fxx)\neq 0$.  Such points cannot be edge points.  
\newline\newline \PLOCALINCL
Thus, we can doubtless compute edge points thanks to those filters.  Let us now list the
drawbacks of such methods.  They are in fact well explained in the {\it Scale Space} theory
developed by Witkin and  Koenderink.
\newline
\newline
$\bullet$ {\bf The Scale Space theory.}  \index{scale space theory and edge detection} A first severe problem is the addition of an extra dimension
: the scale $t$ in computations and image understanding.
   We get no absolute definition of edges. We only can talk about ``edges at a
certain scale".  An answer to  this problem would be to try to track the  edges
across scales.  Indeed, as is noticeable in experiments, the ``main edges" resist a
convolution with a wide filter, but loose much of their spatial accuracy. On
the opposite side, if one makes a sharp low filtering, with a gaussian with
small variance, these edges  keep their correct location.
  Now, the ``main'' edges are then lost in a crowd of ``spurious''
 edges due to noise, texture, etc...  The ``scale space'' theory of 
Witkin \cite{Witkin:1983:SSF} proposes therefore to identify the main edges at a low
 scale, and then to ``follow them backward'' by making the scale
decrease  again.  This method could in theory give the exact 
location of all ``main edges".  However, its implementation is rather
 heavy from the computational viewpoint and unstable, because of  
the following-up of edges across scales and the multiple thresholdings
 involved in the edge detection at each scale. 
\newline
\newline
The tracking of edges across scales excludes  any thresholding of the gradient. 
Indeed, such a thresholding may remove edges at certain scales and not at other ones.
So one should trace across scales all ``zero-crossings", without consideration to their
likeliness to be  edges or not.  This makes the edge matching across scales very difficult :
indeed, the experimental sparseness of  zero-crossings associated with sharp edges is no
more true for zero-crossings at large. Small fluctuations of the image may generate 
``spurious" zero-crossing edges.  The same is equally true for Canny's detector, as is
again quite obvious in experiments.
\newline
In conclusion, the  ``edge detection theory" is more an attempt than an
established theory. After more than  30 years of existence, it has also become clear that no
robust technology can be based on it. Since  the edge detection devices depend upon
multiple thresholdings on the gradient, followed by ``filling the holes" algorithms,
there can be no  scientific agreement on the identity of ``edge points" in a given image.
\subsubsection{Contrast invariance}
As we shall see in the next chapters, the assumption of contrast invariance for image
operators will solve most of the technical problems associated with linear operators. 
We say that an image operator $u\to Tu$ is contrast invariant if it commutes with all
increasing functions $g$, i.e.,
\fb& g(Tu) = T(g(u)) \label{contrastinvariance0}
\fe&
In image processing, most images are known up to a contrast change because we ignore
both the lightning conditions  and the nonlinear response of the sensors.  The
commutation relation (\ref{contrastinvariance0}) ensures that the filtered image 
$Tu=g^{-1}(T(g(u)))$ does not depend upon $g$. Convolutions {\it are not} contrast
invariant, i.e. we have in general 
$$g(k\conv u)\neq k\conv g(u).$$ 
\begin{Exercice} Construct two simple functions $u$ and $g$ such that the above
commutation indeed fails.
\end{Exercice}
 In the same way, the operator $T_t : u_0\to u(t)$
associated with the heat equation  {\it is not} contrast invariant : one has
$$\frac{\partial(g(u))}{\partial t} = g'(u) \frac{\partial u}{\partial t}$$
and 
$$\Delta (g(u)) = g'(u)\Delta u + g''(u) |Du|^2$$
if $g$ is $C^2$.  Thus $g(u)$ is not necessarily a solution of the heat equation 
if $u$ is. (See Figure \ref{PCONTRAST_GAUSS}).

\PILLUSMORPH
%%\PCONTRAST_GAUSS


\section{Dynamic Shape \label{se:KVD}}

In \cite{Koenderink:1986:DS}, Koenderink and Van Dorn define a ``shape'' in $\real^N$, a closed subset $X$ of $\real^N$. They propose to smooth the shape by applying directly the heat equation
$\frac{\partial u}{\partial t} - \Delta u = 0$
to the characteristic function $\indic_X$ of $X$. (We set $\indic_X(\fxx) = 1$ if $\fxx \in X$, $=0$ otherwise).
Of course, the solution $G_t \conv \indic_X$ is no more a characteristic function. The authors define the evolved shape at scale $t$ by
$$X_t= \{\fxx, u(t,\fxx) \geq \frac{1}{2} \}$$
The value $\frac{1}{2}$ is chosen by an obvious requirement.
Let $X = \{(x,y) \in \real^2, x \geq 0 \}$, then we ask that
$$X_t= \{G_t \conv X \geq \lambda \} = X$$
which is only true if $\lambda = \frac{1}{2}$.


\PKVDSTRANGE \PKVDBAD

\noindent Let us mention some drawbacks of this shape evolution.

\begin{description}
\item{The non-local interactions:}
Take two close disks $D(\fxx_0,1)$ and $D(\fxx_1,1)$, with $|\fxx_0 - \fxx_1| = 1 + \epsilon$. Then the evolution of the union of both disks, considered as a single shape, is quite different from  the evolution of each disk separately, (see figures \ref{DS2} and \ref{DS1}).

\item{Creation of singularities.}
As another consequence, singularities of the orientation and curvature of the boundary of the shape may appear with the evolution. Thus, the smoothing creates new salient features!
\end{description}


\section{Curve evolution by the heat equation. \label{se:grayson}}

Let us go back to shapes whose boundary can be described by a finite set of rectifiable Jordan curves.
We call rectifiable Jordan curve a simple  closed curve of the plane, i.e. a curve  without self-crossings and with  finite length.  We also  assume that these Jordan curves do not meet, so that the Jordan curve structure is uniquely defined. Let us then focus on the smoothing of a single Jordan curve, with finite length.

We parameterize the initial curve by length
$$s \in [ 0, L ] \rightarrow \fxx_0(s),$$
where $s$ is the curve length between $\fxx(0)$ and $\fxx(s)$. We have
$\fxx_0(s) = (x(s), y(s)) \in \real^2$. A first obvious idea in order  to smooth the curve is to convolve $x(s)$ and $y(s)$ by a smoothing kernel.
The kernel must be as local as possible in order to ensure the analysis of local curve features. Thus, we are naturally led to iterate a smoothing kernel $M_h$, with $h\rightarrow 0$. By Theorem 
\ref{convergenceverschaleur}, we know that all such processes boil down to the application of the heat equation.



\fb& \label{1star}
\frac{\partial \fxx}{\partial t}(t,s) = \frac{\partial^2 \fxx}{\partial s^2}(t,s), \qquad
s \in [0, L],\;\; t\in [0, +\infty[.
\fe&
$$\fxx(0,s) = \fxx_0(s)$$
Here, we must notice two very important facts which advocate against the method.
\begin{enumerate}
\item When $t>0$, $s$ is no more a length  parameter of the evolved curve $\fxx(t)$.
\item Maximum principle holds for $x(t,s)$ and $y(t,s)$ as scalar solutions of the heat equation. In addition, $x(t,s)$ and $y(t,s)$ are, as proved in chapter \ref{chapter1}, $C^\infty$ functions of $(t,s)$, for $t>0$.
{\bf Now, this does not imply that the curve $\fxx(t,s)$ behaves smoothly!} In fact, it can easily be seen (see Figure \ref{MACKW1L}) that a smooth curve may generate by this evolution  self-crossings which by further smoothing entail the appearance of singularities.
\end{enumerate}
\begin{Exercice}
Construct a $C^\infty$ map : $\sigma \in [0,1]\to \fxx(\sigma) \in \real^2$ such that the curve
$\{\fxx(\sigma), \; \sigma\in [0,1]\}$ is a square. Deduce that a curve can have a $C^\infty$ parameterization
without being smooth.
\end{Exercice}


\PMACKWONE

\section{How to restore locality and causality ? \label{restorelocalityandcausality}}
\subsection{Localization of the ``Dynamic Shape'' method.}
The main objective of this treatise is to redefine the preceding smoothing processes in such a way that they are local and do not create new singularities. This can be done, as we shall prove further on, by {\it alternating} a small scale linear convolution with a natural normalization process.

In the case of the Dynamic  Shape analysis, we define an alternate  Dynamic Shape algorithm in the following way.




\paragraph{Algorithm.} Iterated local Dynamic Shape algorithm, or Merriman-Bence-Osher algorithm.
\begin{enumerate}
\item Convolve the initial shape $\indic_{X_0}$ with $G_h$, $h$ small.
\item Define $X_1= \{\fxx, G_h \conv \indic_{X_0}(\fxx) \geq \frac{1}{2} \}$.
\item Set $X_0 = X_1$ and go back to 1.
\end{enumerate}

In fact the Dynamic Shape  method is a {\it median filter} (see Chapter \ref{chapitremedian}) and the preceding Merriman-Bence-Osher algorithm an {\it iterated median filter}.
We can anticipate that the application of an  alternate median filter yields, as $h \rightarrow 0$ and the number of iterations tends to infinity, a ``motion by mean curvature'' which will be defined in Chapter \ref{chaptermainequation}  as one of the main objects of  Chapters \ref{Asymptotic} and following.

\PKVDLOCALIZED


\subsection{Renormalized heat equation for curves.}
In \cite{Mackworth:1992:TMC} Mackworth-Mokhtarian noticed the loss of causality of the heat equations applied to curves. Their solution, at least formally, looks like the solution given to the nonlocality of the Dynamic Shape method. Instead of applying the heat equation for long times (or, equivalently, to convolve the curve $\fxx(s)$ with Gaussians $G_t(s)$ of arbitrary width, they do the following.
\newline
\newline
\noindent {\bf Algorithm :  Renormalized heat equation for curves.}
\begin{enumerate}
\item Convolve the initial curve $\fxx_0(s_0)$, parameterized by its length parameter $s_0\in [0, L_0]$,  with a Gaussian $G_h$ ; $h$ is small.
\item Let $L_n$ be the length of the curve $\fxx_n$ obtained after $n$ iterations and $s_n\in [0,L_n]$ its arc length parameter. Set, for $n \geq 1$, $\tilde x_{n+1}(s_n) = (G_h \conv \fxx_n)(s_n)$. Then reparameterize $\tilde x_{n+1}(s_n)$ by its arc length parameter $s_{n+1}\in [0, L_{n+1}]$, which yields a curve $\fxx_{n+1}(s_{n+1})$.
\item Iterate.
\end{enumerate}

\begin{th1} \label{consistencedecourberenormalisee}
Let $\fxx_0(s_0)$ be a $C^2$ curve parameterized by length.  When $h$ tends to zero, there is a constant
$c$ such that
\fb& (G_h \conv \fxx_0)(s_0) - \fxx_0(s_0) = c h^2 \frac{\partial^2 \fxx_0}{\partial s_0^2} +o(h^2) \label{2star}\fe&
\end{th1}


\paragraph{Proof} Direct application of Theorem \ref{asymptotiquelineaire}.
\endproof
\begin{Exercice}
Compute the constant $c$ of Theorem \ref{consistencedecourberenormalisee}.
\end{Exercice}


We notice that (\ref{2star}) is consistent with  the following evolution equation(as $h\to zero$):
\fb& \label{3star} \frac{\partial \fxx}{\partial t} = \frac{\partial^2 \fxx}{\partial s^2} (= Curv(\fxx)(s)) \fe&
This equation is \underbar{not} the heat equation (\ref{1star}).
Indeed, in (\ref{3star}), we assume that $s$ denotes the length parameter of evolved curve $\fxx(t)$ at time $t$ (and \underbar{not} the initial parameterization).
We shall consider this last, nonlinear,  curve evolution in Chapter \ref{chapter4bis}.

\PMACKWTWO

%% NEED TO BE PUT SOMEWHERE...
\PMODEFINDING

\newpage
\zbibnote
\noindent{\bf Section \ref{Iteratedlinear}~:}
To make local averages of the grey level in order to restore an image is one of the first tools proposed in early image processing in the sixties \cite{Golay:1972:SDL},
\cite{Helstrom:1967:IRM}.
The classical remark that the difference between an image and its local average is proportional to its laplacian is one of the most fruitful formulae in image processing.  Gabor (quoted in \cite{Lindenbaum:1994:GCI}) used it as an image restoration tool, as we pointed out in the introduction. See also Hummel \cite{Hummel:1983:GBH}, \cite{Hummel:1987:DGB}. As we commented in the introduction, Burt and Adelson \cite{Burt:1983:LPC} based on this simple remark their Laplacian pyramid representation, one of the ancestors to the theory of wavelets. Our proof that iterated convolutions of radial kernels converge to a gaussian is a version of the De Moivre-Laplace formula (Central Limit Theorem \cite{Breiman:1968:P}) adapted to Image Processing.
Its relevance for image processing is high, since it leads to recommend gaussian filtering as the unavoidable linear smoother.  We shall prove
this fact from the "scale space" point of view in Section \ref{Linearaxioms}.
\newline

\noindent
{\bf Section \ref{directional diffusions}~:} Directional diffusions have a long story since Hubel and Wiesel showed the existence of direction sensitive cells in the visual areas of the neocortex. 
There has been a blow-up in publications on directional linear filters since (e.g.) the 
seminal paper of Daugman
\cite{Daugman:}
\newline

\noindent
{\bf Section \ref{Edgedetection}~:}
The use of gaussian filtering is so widespread in image analysis that it is hard to find a "first paper".  The Hildreth-Marr \cite{Marr:1980:TED}
 paper on edge detection is seminal as well as the famous David Marr book, 
Vision \cite{Marr:1982:V}. Now, the term "edge detection" in TV image transmission is present as early as 1959 \cite{Julesz:1959:MCT}.  The idea that the computation of derivatives in an image necessitates a previous smoothing has been strongly developped in the Dutch Image Analysis school 
(\cite{Florack:1994:LSS}, \cite{Blom:1991:SDP}. See also the books of Florack
\cite{Florack:1997:IS}, Romeny \cite{Romeny:1998:FEV} and Lindeberg \cite{Lindeberg:1994:SSTa}. See also \cite{Falzon:1994:SAD}. Now,
the Canny edge detector \cite{ Canny:1986:CAE} is probably the most famous image analysis operator, and is based on a second derivative. Deriche \cite{Deriche:1987:UCC} derived a recursive implementation. 
The general image analysis framework by which an image is associated its smoothed version at several scales is called "scale space". The term originates in Witkin \cite{Witkin:1983:SSF}, 1983, who proposed to track the zero-crossings of the Laplacian of the smoothed image accross scales.  Yuille and Poggio \cite{Yuille:1985:FTZ}, proved that this tracking works for 1-D signals.  Hummel \cite{Hummel:1986:RBZa}, \cite{Hummel:1989:RZC} and Yuille and Poggio \cite{Yuille:1986:STZ} analysed the conjectures of Marr and Witkin according to which the image is completely recoverable from its edges at different scales.  A wavelet-based attempt to the same aim is proposed in Mallat \cite{Mallat:1998:WTS}. A general and insightful theory of image scale space is 
presented in Koenderink \cite{Koenderink:1984:SI}.
\newline

\noindent
{\bf Section \ref{se:KVD}~:}  This section is based on the famous paper of Koenderink and Van Doorn \cite{Koenderink:1986:DS}, proposing to analyse a shape by convolving its characteristic function with a gaussian. 
\newline
\noindent
{\bf Section \ref{se:grayson}~:} We use the first version of curve analysis proposed by Mackworth and Mokhtarian \cite{Mackworth:1986:SBD}. See also
Horn and Weldon \cite{Horn:1986:FCC}.
\newline
\noindent
{\bf Section \ref{restorelocalityandcausality}~:} The solution to a restoration of causality and locality for the Dynamic Shape was found by 
Merriman, Bence and Osher \cite{Merriman:1992:DGM} who devised this algorithm for totally independent reasons : they looked for a clever numerical implementation of the mean curvature motion equation.  In \cite{Mackworth:1992:TMC}, the model errors of \cite{Mackworth:1986:SBD} were corrected and the right intrinsic equation proposed. This 1992 paper contains, however, several inexact statements about the properties of the intrinsic equation.  The right theorems and proofs can be found in Grayson \cite{Grayson:1987:HESa}, 1987.


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

\part{Contrast Invariant Image Analysis \label{PART2}}

\chapter{Contrast invariant classes of functions and their level
sets \label{Levelsets} \label{chapter3}} 
\thispagestyle{empty}

\index{level sets} \index{contrast change} \index{contrast invariant classes of functions}
{\it
 Let $u(\fxx) $ a real function, which we interpret again as an image.  Define the
level set of $u$ with level $\lambda$ by $\levelset_\lambda u =\{\fxx, u(\fxx) \geq
\lambda\},$ for $ \lambda \in \rbarre$. (We denote by $\rbarre$ the set $\real\cup\{-\infty,
+\infty\}$).\notation 
Obviously, 
$$\levelset_{-\infty}u=\real^N, \; \; \levelset_{+\infty}u=\emptyset.$$
 The level sets of a function have two striking properties.  The first one
is that they give a complete account of the function.  Indeed, we can reconstruct $u$ from its
level sets
$\levelset_\lambda u$ by the formula
$$u(\fxx) = \sup \{\lambda, \fxx \in \levelset_\lambda u \}.$$
 \begin{Exercice}
Show this last formula, which is true for any real function $u$.
\end{Exercice}
 The second one is 
their global invariance by contrast change. We say that two functions $u$ and $v$ have
globally the same level sets if for every $\lambda $ there is $\mu$ such that $\levelset_\mu
v =
\levelset_\lambda u$, and conversely. If we apply to
$u$ a contrast change understood as  a continuous
increasing function $g$, then it is easily checked that $v=g(u)$ and $u$ have globally the same level
sets. (Every level set of $u$ is a level set of $v$ and conversely).
\begin{Exercice}
Check this fact, for any real valued fonction $u$ and any increasing continuous function $g$.
\end{Exercice}
We shall investigate more general contrast changes, which are nondecreasing, but neither continuous nor increasing. This is justified by 
the technology where such contrast changes are used systematically for image digitization. In
that case, we shall see that the level sets of $g(u)$ are either level sets of $u$ or strict level sets of $u$, that is, sets of the form $\{\fxx, u(\fxx)>\lambda \}$.  We shall prove a converse
statement : assume that a function $v$  has the same level sets  as another function $u$
in the preceding sense.  Then $v$ is obtained from $u$ by a
contrast change $v=g(u)$.}

\section{From an image to its level sets, and conversely. \label{fromimagetolevelsets}}


\skipaline
In the following proposition, we give structure properties of the family of level sets
$\levelset_\lambda u$ of a function $u$.  Conversely, given a family of sets $(X_\lambda)_{\lambda\in\real}$
satisfying the structure properties, we construct a function $u$ such that $\levelset_\lambda
u=X_\lambda$ for every $\lambda$.  This explains a main technique of mathematical morphology, consisting in
handling directly the level sets of a function and ensuring reconstruction
(\cite{Matheron:1975:RSI}). 

 In the whole book, we take the conventions on infima and suprema of subsets of
$\rbarre$ that 
$$\inf(\emptyset) = +\infty, \; \; \; \sup(\emptyset) = -\infty.$$

\index{image reconstruction from the level sets}

\begin{pro} \label{II.1}
%§label II.1
If $u : \real^N \rightarrow \rbarre $ is a
function and 
$X_\lambda = \levelset_\lambda u$ denote its level sets, then

(\ref{II.1}.i) $X_\lambda \subset X_\mu$ if $\lambda >
\mu,$  $X_{-\infty}=\real^N$.

(\ref{II.1}.ii) $X_\lambda = \cap_{\mu < \lambda} X_\mu$ for every
$\lambda >-\infty$.
\newline
Conversely, if $(X_\lambda)_{\lambda \in \real}$ is a family of
subsets of $\real^N$ satisfying (\ref{II.1}i) and (\ref{II.1}.ii), then the function
with values in $\rbarre$,

(\ref{II.1}.iii) $u(\fxx) = \sup\{ \mu , \fxx \in X_\mu \}$
satisfies $\levelset_\lambda u = X_\lambda$ for every $\lambda\in \rbarre$.
\end{pro}

\PLSBIRD
%%\PLLIGNESBIRD
\PSLS
%% FRED : A DEPLACER \PLLS

\paragraph{Proof of Proposition \ref{II.1} }

Relation (\ref{II.1}.i) is obvious and so is Relation (\ref{II.1}.ii), since $u(\fxx) \geq
\lambda$ if and only if $u(\fxx) \geq \mu$ for every $\mu <
\lambda$. Conversely, we define a function $u$ from the set of sets
$(X_\lambda)_{\lambda \in \real}$ by
\fb&  u(\fxx) = \sup \{\lambda\in\rbarre, \fxx \in X_\lambda \} 
\label{iii.1}\newline
%§label iii.1
\fe&
Let us prove that for every $\lambda\in \rbarre$, 
\fb& \levelset_\lambda u = X_\lambda \label{iii.3}\newline
%§label iii.3
 \fe&
Indeed, if $\fxx$ belongs to $X_\lambda$,  then from (\ref{iii.1})
we deduce that
$u(\fxx)\geq \lambda$, so that $\fxx$ belongs to $\levelset_\lambda u$.
Thus, $X_\lambda \subset \levelset_\lambda u$.
Conversely, if  $\fxx$ belongs to $\levelset_\lambda u$ with $\lambda>-\infty,$ then $u(\fxx)\geq \lambda$
and therefore $\sup \{\mu, \fxx \in X_\mu \}\geq \lambda$.  Thus for any $\mu < \lambda$,
there exists $\mu '$ such that $\lambda \geq \mu '\geq \mu$ and $\fxx \in X_{\mu '}$.  
By (\ref{II.1}.i) we then have $\fxx \in X_\mu$.  Thus, $\fxx$ belongs to $X_\mu$ for
every $\mu < \lambda$. From (\ref{II.1}.ii),
 we conclude that $\fxx$ belongs to $X_\lambda$.
The case $\lambda=-\infty$ is easily checked : Since $X_{-\infty}=\real^N$, we
obviously have $\levelset_{-\infty}u\subset X_{-\infty}.$ 
\enddemo

\begin{rem}\label{remarqueutilesurlesniveauxdegrisbornes}
Notice that if $u(\fxx)<\+\infty$ for every $\fxx$, then $\levelset_{\infty}u=\emptyset$. Conversely, if
 $X_\infty=\emptyset$,  the reconstructed function $u$ from the $X_\lambda$
satisfies
$u(\fxx)<+\infty$ for every
$\fxx$. In the same way,
  $u(\fxx)>-\infty$ for every $x$ if and only if
$$\bigcup_{\lambda>-\infty} X_\lambda = \real^N.$$
\end{rem}
\begin{Exercice}
Show that if $X_\lambda =\real^N$ for $\lambda<\lambda_0$, then $u\geq \lambda_0$ and if 
$X_\lambda = \emptyset$ for $\lambda>\lambda_0$, then $u\leq\lambda_0.$
\end{Exercice}

\PQUANTIF

\begin{pro}  Let $u(\fxx)$ be a real function and  $\levelset_\lambda u=\{\fxx,
\; u(\fxx)\geq \lambda\}$ its level sets for $\lambda\in \real\cup \{+\infty\} $.
\fb& \hbox{If  } \mu_n\nearrow \lambda, \hbox{ then  } \levelset_\lambda
u=\bigcap_n
\levelset_{\mu_n} u,
\fe&
 \fb& \label{ensembledeniveaustrictuniond'ensemblesdeniveaularges}
 \{\fxx, \; u(\fxx)>\lambda\} = \bigcup_{\mu>\lambda} \levelset_\mu u.
 \fe&

\end{pro}
\paragraph{Proof}
Relation (\ref{ensembledeniveaustrictuniond'ensemblesdeniveaularges})
follows from the obvious equivalence 
$u(\fxx)> \lambda \Leftrightarrow (\exists \mu>\lambda, \; u(\fxx)\geq \mu).$
\enddemo

\subsection{Functions and level sets defined almost everywhere\label{functionsandlevelsetsdefinedalmosteverywhere}}

Let us give a  statement simpler  than Proposition \ref{II.1}, provided we consider functions and sets defined almost everywhere. We say that a set $X$ is contained in  a set $Y$ almost everywhere if
$ \meas(X \setminus Y) = 0$, where $\meas$ denotes the usual Lebesgue measure in $\real$ (length in dimension 1, area in dimension 2, volume in dimension 3...). 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 $\meas(\{\fxx, u(\fxx) \neq v(\fxx)\}) = 0.$
More generally, we say that a property $P(\lambda),\; \lambda\in \real^N$, is true `` almost everywhere'' or ``for almost every $\lambda$'' if it is true for every
$\lambda$, with the exception of a set with zero $N$-dimensional Lebesgue  measure.

\begin{lem} \label{lemmapp} Let $(X_\lambda)_{\lambda \in \real}$ be a nonincreasing family of sets, i.e. $X_\lambda \subset X_\mu$ if $\lambda \geq \mu$. Then, for almost every $\lambda$ in $\real$, 
\fb& X_\lambda = \bigcap_{\mu < \lambda} X_\mu, \qquad \hbox{ almost everywhere } \label{enspp} \fe&
\end{lem}

\paragraph{Proof}

Let us consider an integrable strictly positive continuous  function $h \in L^1(\real^N)$.
 Set
$m(X) = \int_X h(\fxx) d\fxx$.  We notice that $m(X)=0$ if and only if $\meas(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}).

\endproof
\begin{Exercice}  Show the property used in the former proof : if $h$ is a positive continuous
integrable function on $\real^N$ and if we set $m(X)=\int_{\real^N}h(\fxx)d\fxx$, then for every
measurable set $X$,
$m(X)=0$ if and only if $\meas(X)=0$.
\end{Exercice}

\begin{cor} \label{II.1.bis}
Let $(X_\lambda)_{\lambda\in \rbarre}$ a family of subsets of $\real^N$ such that
$X_{-\infty} = \real^N$, $X_\lambda \subset X_\mu$ for $\lambda \geq \mu$. Then the function $u$ defined by
$$ u(\fxx) =  \sup\{\lambda, \fxx \in X_\lambda \}$$ satisfies for almost every $\lambda$, $X_\lambda = \levelset_\lambda u$ almost everywhere. This function has values in $\rbarre$.
\end{cor}

\paragraph{Proof}
We proceed as in the proof of Proposition \ref{II.1}. We have
$$\levelset_\lambda u = \{ \fxx, \sup\{\mu, \fxx \in X_\mu\} \geq \lambda \}$$
Now, if $\fxx \in X_\lambda$, we have $\sup\{\mu, \fxx \in X_\mu\} \geq \lambda $
which implies $\fxx \in \levelset_\lambda u$. Thus,  $X_\lambda \subset \levelset_\lambda u$ everywhere.
Conversely, let $\lambda$ be chosen such that
$X_\lambda = \cap_{\mu < \lambda} X_\mu$ almost everywhere, which by Lemma \ref{lemmapp} is true for almost every $\lambda \in \real$.
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.
\endproof
We end this subsection with a last useful lemma ensuring that if we know almost everywhere the  level sets of a function for almost all levels, then the function itself can be retrieved, up to a set with measure zero.

\begin{lem}
\label{ensemblesdeniveaumodifiespresquepartout}
Let $v$ be a function and $(Y_\lambda)_{\lambda\in\real}$ be a family of sets such that
$$\levelset_\lambda v=Y_\lambda, \;\hbox{ a.e. in } \lambda, \; \hbox {a.e. in } \fxx.$$
Then $v(x)=\sup\{\lambda, \; \fxx\in Y_\lambda,\} \;\hbox{ a.e. in } \fxx.$
\end{lem}

\paragraph{Proof}
Let $N$ be the  negligible subset of $\real$ such that $\levelset_\lambda  u=Y_\lambda$ almost everywhere and for all $\lambda\in\real\setminus N$. We choose $\Lambda\subset \real\setminus N$, a countable, dense 
subset of $\real$. We then still have
$$v(\fxx)=\sup\{\lambda\in \Lambda, \; u(\fxx)\in \levelset_\lambda v\}.$$
Let now $N_\lambda =(\levelset_\lambda u\setminus Y_\lambda)\cup(Y_\lambda\setminus\levelset_\lambda u)$
for $\lambda\in \Lambda$ and $M=\bigcup_{\lambda\in  \Lambda} N_\lambda.$  We have $\meas(M)=0$ and, 
for $\fxx\in \real^N\setminus M,$
$v(\fxx)=\sup\{\lambda\in \Lambda, \; \fxx\in \levelset_\lambda v, \;\}=\sup\{\lambda\in\Lambda, \;
\fxx\in Y_\lambda.\}.$

\enddemo


\begin{Exercice}
Construct a simple example of family  $X_\lambda\subset \real^2,\; \lambda\in \rbarre$ for which $u$ attains 
the values $+\infty$ and $-\infty$ on subsets of $\real^2$ with positive measure.
\end{Exercice}

\PHISTOINT

\section{Contrast changes and level sets. \label{contrastchangesandlevelsets}}



\PCCONTRAST

\begin{Defi}
We  call contrast change \index{contrast change} any nondecreasing function
$g: \real\to \real$. We also consider its natural extension  from
$\rbarre$ into $\rbarre$ obtained by  setting 
$$g(+\infty)=\sup_{\real} g,\; \; g(-\infty) = \inf_{\real} g.$$
Without risk of confusion, we systematically adopt this extension.
\end{Defi}

\noindent  The next lemma defines a pseudoinverse $g^{(-1)}$\notation to any
nondecreasing function $g$.

\index{pseudo inverse of nondecreasing function}
\begin{lem} \label{inversiondefonctioncroissante}
Let $g : \rbarre\to \rbarre$ be a real nondecreasing function and set for every $\lambda\in
\rbarre$,
$$\gmoins(\lambda)= \inf\{r,\; g(r)\geq \lambda\}.$$
Then
\fb& 
\label{inversion1}\hbox{if }\lambda\leq g(\gmoins(\lambda)), \hbox{  then 
} g(s)\geq
\lambda
\Leftrightarrow s\geq \gmoins(\lambda).
\fe& 

\fb& \label{inversion2}\hbox{if }\lambda> g(\gmoins(\lambda)), \hbox{  then 
} g(s)\geq
\lambda
\Leftrightarrow s> \gmoins(\lambda).\fe&
\end{lem}

 \paragraph{Proof}
Assume first that $ \lambda\leq g(\gmoins(\lambda))$. If
$g(s)\geq
\lambda$, then $s\geq
\gmoins(\lambda)$ by the definition of $\gmoins(\lambda)$. Conversely, if
$s\geq \gmoins(\lambda)$, we obtain
$$g(s)\geq g(\gmoins(\lambda))\geq \lambda \hbox{ and therefore }\; g(s)\geq
\lambda.$$ This yields (\ref{inversion1}). 
\newline 
\newline
Assume now that $\lambda> g(\gmoins(\lambda))$.  Then $g(s)\geq \lambda$ implies
$g(s)>g(\gmoins(\lambda))$. Thus,
$g$ being nondecreasing,
$s>\gmoins(\lambda)$. Conversely, assume that  $s>\gmoins(\lambda)$. Then  there exists
by definition of
$\gmoins$ some
$r<s$ such that $g(r)\geq \lambda $ and therefore
$g(s)\geq g(r)\geq \lambda.$
\enddemo
\begin{Exercice}
Compute $g^{(-1)}$ for the following functions :
\newline$\bullet$ $g(s)=\max(0,s)$
\newline $\bullet$ $g(s)=1$ if $s\geq 0$, $s$ otherwise. 
\end{Exercice}
\noindent The next theorem explains in which sense level sets are conserved by a
nondecreasing contrast change $g$.

 \begin{th1} \label{changementdecontrasteetensemblesdeniveau} Let $g$ be a real
nondecreasing function and
$u(\fxx)$ a real function defined on $\real^N$.  Then every level set of $g(u)$, 
$\levelset_\lambda (g(u))$, satisfies one of the following properties
\fb& \label{niveau1}
\exists \mu, \; \levelset_\lambda (g(u)) = \{ \fxx, u(\fxx) \geq g^{-1}(\lambda) \} =
  \levelset_{g^{(-1)}(\lambda)} u,
\fe&
\fb&
\label{niveau2}
\exists \mu, \; \levelset_\lambda (g(u)) =  
\{ \fxx, u(\fxx) > g^{-1}(\lambda)\}.
\fe&
\end{th1}

\paragraph{Proof}
Following Lemma \ref{inversiondefonctioncroissante}, we have for each $\lambda$ the
alternative (\ref{inversion1}-\ref{inversion2}), that is
$$(g(s)\geq \lambda \Leftrightarrow s\geq \gmoins(\lambda))\;\; \hbox{ or
}\;\;(g(s)\geq \lambda \Leftrightarrow (s>\gmoins(\lambda)).$$
This yields the alternative
$$\levelset_\lambda (g(u)) = \{\fxx, g(u(\fxx))\geq \lambda\}= \{\fxx, u(\fxx)\geq
\gmoins(\lambda)\} = \levelset_{\gmoins(\lambda)}u,$$
or
$$\levelset_\lambda (g(u)) = \{\fxx, g(u(\fxx))\geq \lambda\}= \{\fxx,
u(\fxx)>\gmoins(\lambda)\} $$
\enddemo
\begin{Exercice}
Let $g$ : $\real \to \real$ be a nondecreasing function and $u$ : $\real^N\to \real$ a real function. Show that 
$$\forall \lambda\in\real, \; \forall \varepsilon>0, \; \exists \mu, \; \hbox{  such that  } \levelset_\lambda (g(u))\supset \levelset_\mu u \hbox{  and  }
\meas(\levelset_\lambda (g(u))\setminus\levelset_\mu u)<\varepsilon.$$

\end{Exercice}

\skipaline 
\drem
 Let us give a very simple example of  functions $u$ et $g$ where both cases
(\ref{niveau1}) et (\ref{niveau2}) occur.  Let us set for $x\in \real$,
$u(x)=x$ and $g(x) = x$ if $x\leq 0$, $g(x)=x+1$
if $x>0$.  Then the level set $\levelset_1 (g(u))$ is not a level set of $u$ but we
have
$$\levelset_1(g(u)) =
]0,+\infty[=\{\fxx, u(\fxx) > 0 \}.$$
\frem

\begin{Exercice}
Compute in that case all level sets of $u$ and $g(u)$ and compare them.
\end{Exercice}

Let us state a converse statement to Theorem
\ref{changementdecontrasteetensemblesdeniveau} : it states roughly that if the level
sets of $v$ are level sets of $u$, then $v=g(u)$ for some contrast change.

\PGPLUS


\begin{th1} \label{existenced'unchangementdecontraste} Let $u$ and $v$ be two
real functions on $\real^N$ such that the following alternative holds for every 
 $\mu \in \real$ :
\fb& \label{niveauaniveau1}
\exists \mu, \; \levelset_\lambda v = \levelset_\mu u, \hbox{ or}
\fe&
\fb& \label{niveauaniveau2}
\exists \mu, \; \levelset_\lambda v =
\{ \fxx, u(\fxx) > \mu \}.
\fe&
Then, there exists a real nondecreasing function $g:\rbarre\to \rbarre$ such that
$v=g(u)$. In addition, $g$ can be defined by the simple formula
\fb& \label{definitiondeg}
g(\mu) = \sup \{\lambda, \levelset_\lambda v\supset \levelset_\mu u\}.
\fe&
\end{th1}
\noindent
{\bf Proof}  \newline
{\bf Step 1}.  We first show that  $v(\fxx) \geq
g(u(\fxx))$. By applying (\ref{II.1}.ii) with $\mu$ replaced by
$g(\mu)$, we see that the ``$\sup$" in 
 the definition of $g$, (\ref{definitiondeg}) is in fact a ``$\max$", so that
\fb&   \label{supatteint}
\levelset_{g(\mu)}v\supset \levelset_\mu u.
\fe&
Let us apply Relation (\ref{supatteint}) with $\mu = u(\fxx)$.
We obtain $$\levelset_{g(u(\fxx))}v\supset \levelset_{u(\fxx)}u\owns \fxx$$
and therefore $v(\fxx)\geq g(u(\fxx)).$


\skipaline
{\bf Step 2.}
Let us now show that $v(\fxx) \leq g(u(\fxx))$.  We apply the assumption
(\ref{niveauaniveau1}-\ref{niveauaniveau2}) to $\lambda = v(\fxx)$ and call
$\mu(\fxx)$ the corresponding value of  $\mu$. Thus 
\fb& \label{niveauaniveau1bis}
\levelset_{v(\fxx)}v = \levelset_{\mu(\fxx)} u, \hbox{ or  }
\fe&
\fb& \label{niveauaniveau2bis}
\levelset_{v(\fxx)}v=
\{ \fxx, u(\fxx) > \mu(\fxx) \}.
\fe&

\skipaline 
Assume first that (\ref{niveauaniveau1bis}) holds. 
Since $\levelset_{v(\fxx)}v \owns \fxx$, we deduce from
(\ref{niveauaniveau1bis}) that $\levelset_{\mu(\fxx)}u\owns \fxx$ and therefore
$u(\fxx)
\geq \mu(\fxx)$. Thus 
$$\levelset_{v(\fxx)} v = \levelset_{\mu(\fxx)}u \supset
\levelset_{u(\fxx)}u,$$ which, by definition of $g$, yields
$v(\fxx)\leq g(u(\fxx))$.

\skipaline
Assume now that (\ref{niveauaniveau2bis}) holds.
Since $\levelset_{v(\fxx)}v= \{\fxx, u(\fxx) > \mu(\fxx)\}=\bigcup_{\mu>\mu(\fxx)}\levelset_\mu u$ and 
$\fxx\in
\levelset_{v(\fxx)}v$,  we deduce the existence of $\mu >\mu(\fxx)$  such that
$\fxx\in
\levelset_\mu u$ and therefore $u(\fxx)\geq \mu$. Thus
$$\levelset_{v(\fxx)} v \supset \levelset_\mu u\supset \levelset_{u(\fxx)}u,$$
which, again by definition of $g$, implies that $v(\fxx)\leq g(u(\fxx)).$
\enddemo


%\MONOGRAPH


%%ULM%% \PHISTOINT
%%ULM%%
%% \PLOSTDATA

We conclude this section with a simple to remember statement : il all level sets of $v$ are level sets of 
of $u$, then $v=g(u)$ for some $g$.  The precise statement is 

\begin{cor}
\label{changementdecontrastenonbijectif}
If $v$ and $u$ are two real functions such that all level sets of $v$ are level sets of
$u$, then there is a nondecreasing function $g:\rbarre\to\rbarre$ such that $v=g(u)$.  An
instance of such a function $g$ is
\fb&
\label{fonctionsg}
g(\mu) = \sup\{\lambda, \levelset_\lambda v\supset \levelset_\mu u\}. \quad
\fe&
\end{cor}


\section{Semicontinuous contrast changes \label{semicontinuousconstrastchanges}}
In this section, we adress the case where the considered contrast changes are upper semicontinuous (or lower semicontinuous), which makes sense for digital image processing because threshold functions and quantization functions usually are u.s.c. or l.s.c..  The results  of this section are not used in the next chapters. 
\begin{Defi}
\index{function!semi-continuous}
 We say that a real nondecreasing function $g:\rbarre\to\rbarre$ is {\it upper semi-continuous}
if for all $r<+\infty$,
$$g(r) = \lim_{\rho \rightarrow r^+} g(\rho) = \lim_{\rho \rightarrow r, \rho > r}
g(\rho)$$

\end{Defi}

\begin{cor}\label{sigestusc} Assume $g$ is a nondecreasing upper semi-continuous function.  
Then for every $\lambda\in \rbarre$ and every $s<+\infty$, 
\fb& 
\label{inversion3} 
 g(s)\geq
\lambda
\Leftrightarrow s\geq \gmoins(\lambda).
\fe& 
\end{cor}
\begin{Exercice} Show that the condition $s<+\infty$ is necessary : Take $g(s)=0$ for all $s$ and 
$\lambda=1$.  Then check that  $g^{-1}(1)=+\infty$, while  $g(s)\geq 1$ is impossible.
\end{Exercice}

\paragraph{Proof} Assume first that $g^{(-1)}(\lambda)<+\infty.$
If $g$ is upper semi-continuous, then the ``inf" defining $\gmoins(\lambda)$ also is a
minimum. Indeed,
let $r_n\searrow \gmoins(\lambda).$  Then by definition of $\gmoins(\lambda)$, we have 
$g(r_n)\geq \lambda$.  
 Since $g$ is upper semi-continuous, we also have $$g(\gmoins(\lambda))\geq \lim_n g(r_n)\geq
\lambda.$$
By Lemma \ref{inversiondefonctioncroissante}, we therefore have
\fb& 
g(s)\geq
\lambda
\Leftrightarrow s\geq \gmoins(\lambda). \fe&
If now $g^{(-1)}(\lambda)=+\infty$, we have $g(s)\geq \lambda$ only if $s=+\infty$, which is
excluded by the condition $s<+\infty$ we have put on (\ref{inversion3}).
Thus   $\lambda\leq g(\gmoins(\lambda))$  and the conclusion of
(\ref{inversion1}) holds.   
\enddemo
The next corollary shows that upper semicontinuous contrast changes preserve level sets.
\begin{cor}
\label{changementdecontrasteetensemblesdeniveaucasu.s.c.} Let $g$ be a real 
nondecreasing upper semi-continuous function and
$u(\fxx)$ a real function defined on $\real^N$.  Then every level set of $g(u)$, 
$\levelset_\lambda (g(u))$ satisfies
\fb& \label{niveau3}
\exists \mu, \; \levelset_\lambda (g(u)) = \levelset_\mu u,
\fe&
where $\mu=\gmoins(\lambda)$.
\end{cor}
\paragraph{Proof} 
Set,  as in  Lemma  \ref{inversiondefonctioncroissante}, $$\gmoins(\lambda)=
\inf\{r,\; g(r)\geq
\lambda\}.$$
According to Corollary \ref{sigestusc},  $g(u(\fxx)) \geq \lambda
\Leftrightarrow u(\fxx) \geq \gmoins(\lambda),$ which  proves (\ref{niveau3}).
(Notice that $u(\fxx)<+\infty$ for all $\fxx$, so that (\ref{inversion3}) holds for 
$s=u(\fxx)$.)
\enddemo

\PLOSTDATA

\newpage
\zbibnote

\noindent
{\bf Section \ref{fromimagetolevelsets}~:} Wertheimer \cite{Wertheimer:1923:ULG} noticed that the actual local values of grey levels could not be a relevant information to the human visual system. Contrast invariance is one of the fundamental model assumptions in Mathematical Morphology. The books of Matheron \cite{Matheron:1975:RSI} and Serra \cite{Serra:1982:IAM}, Serra\cite{Serra:1986:IMM} are seminal. In "flat morphology", images are decomposed into their level sets by the so-called threshold decomposition so that image analysis boils down to set analysis. Ballester et al. \cite{Ballester:1998:FCI} defined an "image intersection" whose principle it is to keep all pieces of bilevel sets common to two images.  
Monasse et al. \cite{Monasse:2000:FCC} defined recently a "fast level set transform" (FLST) whose principle it is to associate with every image the inclusion  tree of connected components of  level sets.  They show that the inclusion tree of connected components of upper and lower level sets can be fused into a single inclusion tree and use it, among other applications, for 
image registration.  See Monasse PhD \cite{PhD}.


\noindent
{\bf Section \ref{contrastchangesandlevelsets}~ and \ref{semicontinuouscontrastchanges}~:}
Contrast changes are a very practical and usual tool for improving image visualization.  They are implemented in any image analysis software. For level set-preserving contrast changes, see \cite{Caselles:1997:SPL}. Many references on contrast invariant operators will be given at the end of Chapter \ref{chapter5}. 


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


\chapter{Level lines and level surfaces. \label{chapter4}}
\section{Curves, their normal, their curvature  \label{sectioncourbes}}

In this section, we summarize what must be known about smooth curves of the plane, particularly Jordan
curves, that is, curves without selfcrossing points.  Such curves will appear in practice as boundaries
of smoothed shapes in an image, and more generally in the next section, as level lines of a smooth
enough image.

\begin{Defi} \index{curve!definition} \index{curve!Jordan} \index{Jordan curve}
\label{defJordan} We call planar curve and denote by $C$ the range of a
continuous map
$\fxx(s)~:s\in [a, b]\to
\real^2$.  If the restriction of $\fxx$ to $]a, b[$ is one to one, we say that 
$C$ is a Jordan curve.  If  in addition  $\fxx(a)=\fxx(b)$,
we say that $C$ is a closed  Jordan curve.  \index{parameterization of a curve}
We call the map
$\fxx(s)$ ``a parameterization of the curve $C$". We say that a  curve $C$ is $C^m$ ($m\in
\natural$, $m\geq 1$) if it admits a $C^m$ parameterization $\fxx(s)~: s\in
[a,b]\to \real^2$ such that $\forall s, \vert \fxx'(s)\vert =1$.    We
call such  a parameterization  euclidean.   \index{euclidean parameterization of a curve}      
 \end{Defi}
In shape analysis, the normal and curvature will play a central role and we define them now.

\begin{Defi} {\bf (and Proposition.)}\newline
\label{parametrisationseuclidiennes} Let $C$ be a simple
$C^2$ curve and
$\fxx_0$ a point of
$C$.  \newline
(i) $C$ admits in a neighborhood of $\fxx_0$ exactly two euclidean parameterizations  such
that
$\fxx(0)=\fxx_0$.   If $\fxx(s)~: [-a, a]\to \real^2$ is one such
parameterization of $C$, then  $\fxx(-s)$ is the other one.
In addition, all other euclidean
parameterizations of $C$ have the form $\fxx(s+\sigma)$ or $\fxx(-s +\sigma)$ for some
 $\sigma\in \real$. 
\newline
(ii) We call tangent vector at  $\fxx$ to $C$ (parameterized by an euclidean
parameterization 
$\fxx(s)$) the unit vector
$\tau (s) = \frac {\partial \fxx}{\partial s}.$  As a consequence of (i), if $\tau_1$ and
$\tau_2$ are two tangent vectors at $\fxx_0$, then either $\tau_1=\tau_2$ or
$\tau_1=-\tau_2$.
\newline
(iii)
The vector $\frac {\partial^2\fxx}{\partial s^2}(0)$ is independent by (i) of the choice of
the euclidean parameterization and it is orthogonal to $\tau(\fxx_0)$.  It is called {\rm
curvature vector} of the curve
$C$ at
$\fxx_0 $ and denoted by $Curv(\fxx_0)$.   
\newline
(iv)  We call {\rm generalized normal} the vector $\nbol(\fxx_0) = \frac
{Curv(\fxx_0)}{|Curv(\fxx_0)|}$ if $Curv(\fxx_0)\neq 0$ and equal to $0$ otherwise.

\end{Defi} 



\paragraph{Proof.} 

\noindent (i) Let $\fxx, p\in [a,b] \to \fxx(p)\in C$ be a $C^1$ parameterization of $C$
such that
$\forall p, \; \fxx'(p)\neq 0$ and $\fxx(p_0)=\fxx_0$. We seek for a new $C^1$
parameterization
$\tilde {\fxx}(s)=\fxx(\varphi(p))$  (with
$\varphi$ $C^1$ and one to one) such that 
$|\tilde {\fxx}'(s)|=1$, that is, 
$|\fxx'(\varphi(p))||\varphi'(p )|=1$. Taking into account that this relation implies
$\varphi'(p)\neq 0$, we have two choices, namely 
\fb&
 \label{ODE}\varphi'(p)=\frac 1 {|\fxx'(\varphi(p))|}
 \hbox{ or }
\varphi'(p)=-\frac 1 {|\fxx'(\varphi(p))|  } \hbox{ and } \varphi(0)=p_0.
\fe&
  Since $\fxx'$ is a Lipschitz function which never
vanishes, so is $\frac 1 {\fxx'}$.  By Cauchy-Lipschitz Theorem, $\varphi$ is uniquely
defined on $\real$ by each one of  both ordinary differential equations (\ref{ODE}) and we
get exactly two euclidean parameterizations $\tilde {\fxx}(s)$ such that
$\tilde {\fxx}(0)=\fxx_0$.  If
$\fxx(s)$ is another  euclidean parametrization, let $\fxx(\sigma)=\fxx_0$.  Then
$\fxx_1(s)=\fxx(s-\sigma)$ also is an euclidean parameterization and satisfies
$\fxx(0)=\fxx_0$. Thus either $\fxx(s)=\tilde {\fxx}(s+\sigma)$ or
$\fxx(s)=\tilde {\fxx}(-s+\sigma).$

 (ii) The statements of (ii) follow immediately from (i) by differentiation.
\newline (iii)
 Since
$|\tau(s)|^2=1$, we have by differentiation $\tau(s).\frac{\partial \tau(s)}{\partial
s}=0$, that is 
$\tau(s).\frac{\partial^2\fxx}{\partial s^2}=0$. Changing $s$ into $-s$ does not alter the
value of $\frac{\partial^2\fxx}{\partial s^2}$ at $s=0$.
\enddemo
\begin{Exercice}(i) Consider an euclidean parameterization for a circle with center 0 and radius 
$R$,
$s\to \fxx(s)=(R\cos\frac {2\pi s} R, R\sin \frac {2\pi s}R).$ Compute the normal and 
curvature and check that the curvature is $\frac 1 R$.
\newline (ii) Compute the curvature at $0$ of the parabola of equation 
$y=\frac a 2x^2.$
\newline (iii) Give the general formula for the curvature of 
a $C^2$ graph $y=\varphi(x)$. 
\end{Exercice}
 We must be able to compute the normal and curvature of a parameterized curve. Exercise 
 \ref{calculsdecourbures}
 yields some useful formulas.
\begin{Exercice} \label{calculdecourbures}
  \index {curvature of parametric curve}
   {\bf Parametric curves}. Let $\fxc(\sigma)$ be a parameterized $C^2$ curve
and $\fxx(s)$ an euclidean parameterization of the same curve. We assume that 
the reparameterization $\varphi(s)=\sigma$ is 
monotonic and satisfies $|\varphi'(s)|>0$. 
\newline
(i) Show that 
\fb& \label{pastoujoursdrole}
\varphi'(s)=\frac 1{|c'(\varphi(s))|}
\fe&
 (differentiate the relation
$\fxc(\varphi(s))=\fxx(s)$ and use $|\fxx'(s)|=1$.)
\newline
(ii) Show that 
\fb& \label{encore}
\fxx''(s)=Curv(\fxx)(s)=c''(\varphi(s))\varphi'(s)^2+c'(\varphi(s))\varphi'(s).
\fe&
Deduce from  \ref{pastoujoursdrole} that
\fb& \label{fatigant}
\varphi''(s)=-\frac{c''(\varphi(s))\varphi'(s).c'(\varphi(s))}{|c'(\varphi(s))|^3}
=-\frac{c''(\varphi(s)).c'(\varphi(s))}{|c'(\varphi(s))|^4}.
\fe&
(iii) Using \ref{fatigant} and \ref{encore}, show that the curvature vector of $\fxc$ is 
\fb& \label{mieuxvaut}
Curv(\fxc(\sigma))=x''(s)=\frac 1{\fxc'^2(\sigma)}(\fxc''(\sigma)
-(\fxc''(\sigma).\frac{\fxc'(\sigma)}{|\fxc'(\sigma)|})\frac{\fxc'(\sigma)}{|\fxc'(\sigma)|})
\fe&
(iv) Multiplying this formula by the vector normal to the curve, $\frac {\fxc(\sigma)^\perp}
{|\fxc(\sigma)|}$, deduce a simple formula defining a "scalar curvature" : 
\fb& \label{courburescalaire}\index{scalar curvature}
curv(\fxc(\sigma))=Curv(\fxc(\sigma)).\frac {\fxc(\sigma)^\perp}{|\fxc(\sigma)|}=
\frac{\fxc''(\sigma).\fxc'^\perp(\sigma)}{|\fxc'(\sigma)|^3}.
\fe&
\end{Exercice}


\section{The level line structure (topographic map) of an image. \label{se:topographic1}}

In view of the applications to shape analysis (see Sections \ref{se:KVD}, \ref{se:grayson}), it is quite useful to have a description of an image in terms of Jordan curves. If the image is assumed to be $C^1$, the implicit function theorem yields such a description. We therefore  begin  with the case of dimension 2 and then will
also define level surfaces of $u$ in higher dimension.

\begin{th1} 
\label{implicitfunctiontheoremdim2}
Let $u(\fxx) = u(x,y)$ be a $C^1$ function in a neighborhood of a point $\fxx_0$ such that $Du(\fxx_0) \neq 0$. Set  $\vec i = Du/|Du|(\fxx_0)$ and
$\fxx = \fxx_0 + x \vec i + y \vec j$, where $\vec j $ is a unit vector orthogonal to $Du(\fxx_0)$. Then, there exists a disk $D(\fxx_0,\eta)$ and a $C^1$ function $\phi(x)$:
$x\in [-\eta, \eta]\to \phi(x)\in \real$ such that if $\fxx = \fxx_0 + x \vec i + y \vec j\in D(\fxx_0, \eta),$
then $$u(x,y)=0\Leftrightarrow y=\phi(x).$$
\end{th1}

The preceding theorem ensures that if $u$ is $C^1$ and $Du(\fxx_0) \neq 0$, then around $\fxx_0$, the set $\{ u(\fxx) = u(\fxx_0)\}$  is a $C^1$ graph. The next corollary permits to globalize this result.


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

\begin{cor} 
Let $u$ be a $C^1$ function on $\real^2$, and $\lambda \in \real$  a level such that:
\begin{itemize}
\item $u^{-1}(\lambda)$ is compact.
\item $\forall \fxx \in u^{-1}(\lambda), Du(\fxx) \neq 0.$
\end{itemize}
Then $u^{-1}(\lambda)$ is a finite union of $C^1$ Jordan curves.
\end{cor}

\paragraph{Proof}
Indeed by the implicit function theorem, $u^{-1}(\lambda)$ is a $C^1$ graph around each of its points. Since $u^{-1}(\lambda)$ is compact,
 it can be covered by a finite number of disks inside each of which, by Theorem
\ref{implicitfunctiontheoremdim2}, $u^{-1}(\lambda)$ is a $C^1$ graph.
It is easily deduced  that $u^{-1}(\lambda)$ is a finite union of $C^1$ Jordan curves.
\enddemo

In fact, Sard's Theorem ensures that the preceding situation is generic in $\lambda$.

\begin{th1} (Sard \cite{Sard??})
Let $u$ be a real $C^1$ function on a rectangle $R$ of $\real^N$. Then for almost every $\lambda$ in $\real$, the set $u^{-1}(\lambda)$ is nonsingular, that is $\forall \fxx \in u^{-1}(\lambda), Du(\fxx) \neq 0$.
\end{th1}

\begin{cor}
Let $u : \real^2\to \real$ be a   function of $L^\infty_C$, i.e. $(2,2)$-periodic and 
 $C^1$  $\real^N$. Then for almost every $\lambda \in \real$,
  the set $u^{-1}(\lambda)$ is a union of $C^1$ Jordan
   curves which are either closed or end on the boundary of $R$.
\end{cor}
\paragraph{Proof}
We consider a level $\lambda$ for which $u^{-1}(\lambda)$ is nonsingular. By the 
implicit function theorem, this last set is a $C^1$ graph around each point and
its restriction to $C$ is compact. We can therefore cover $C\cap u^{-1}(\lambda)$
by a finite set of graphs and the statement follows.
\enddemo

\PLLIGNESBIRD



\section{The topographic map as a complete image representation. \label{se:topographic2}}

\begin{Defi}
Let $u$ be a $C^1$ function on a rectangle. We call topographic map of $u$  the map which associates with every nonsingular $\lambda$ (that is, every $\lambda$ such that $Du \neq 0$ on $u^{-1}(\lambda)$), the finite set of the oriented Jordan curves of $u^{-1}(\lambda)$.
By orientation, we mean  that we keep the information of whether $u(\fxx)>\lambda$ or $u(\fxx)<\lambda$ inside or outside the Jordan curve. These are either closed, or meet the boundary of the rectangle at their
endpoints.
\end{Defi}
\begin{th1} \label{theoremedelacourbedeJordan} 
\cite {Rudin:1966:RCA} The image of a Jordan curve $c$ divides the plane in two connected components, a bounded one and an unbounded
one.  In other terms, denoting for commodity
 by $c\subset \real^2$ the range of $c$, the set 
$\real^2\setminus c$ has exactly two connected components.  We denote by $Int(c)$ the 
bounded one.
\end{th1}

\begin{pro}
Let $u$ be a $C^1$ function on a rectangle. Then $u$ can be recovered from its topographic map.
\end{pro}




\paragraph{Proof}
Indeed, $u$ can be recovered from a set of level sets associated with a dense set of $\lambda$'s.  Now,  the
set of singular $lambda's$ has  zero measure. 
 Thus, its complementary set of nonsingular values is dense.
For each nonsingular value $\lambda$, the boundary of $\levelset_\lambda u$ is described by a finite set
of oriented Jordan curves.  We consider the filling operator $Interior$ which associates with each Jordan curve $c$ the
set $Interior(c)$ the unique bounded  connected component of $\real^2\setminus c$ (Theorem\ref{theoremedelacourbedeJordan}.)  Then, calling
$c_i$ the positively oriented Jordan curves, understood as those which surround points of $\levelset_\lambda$,
and $c_{j}, j\in J_i$ the negatively oriented curves which are contained in $Interior(c_i)$ and therefore surround a hole of $\levelset_\lambda u$, we have the reconstruction formula
$$\levelset_\lambda u = \bigcap_i (Int(c_i)-\bigcap_{j\in J_i}Int(c_{i,j})).$$
In computational terms, we ``fill'' the curves $c_i$ and then remove their holes to reconstruct
$\levelset_\lambda.$
\endproof

\begin{rem}
In practice, $u$ can be recovered in the following way: we keep the Jordan curves as arrays of vertices and we use a filling algorithm to reconstruct each $\levelset_\lambda u$. Then $u$ is obtained by the classical
$$u(\fxx) = \sup\{\lambda, \fxx \in \levelset_\lambda u \},$$
which is a finite $\sup$ to perform, since 
$\lambda$ assumes a finite number of values in a digital image.
\end{rem}







\section{Generalized level lines and topographic map \label{se:topographic3}}

The preceding definition of level lines is slightly restrictive and may be generalized.  In view of our definition of level sets, it may be advantageous to consider cases where the level set is smooth enough, so that its boundary is (e.g.) a union of Jordan curves.  By boundary, we mean here the topological boundary.  Let us give some examples.  If $c$ is a Jordan curve, then we may consider the function $u(\fxx)$  which is equal to 1 if  $\fxx$ is surrounded by the curve, 0 otherwise. We see that the implicit function theorem does not apply, and that the set $\{\fxx, u(\fxx)=1\}$ is not a level line.  The next definition, however, is adapted to this case :

\begin{Defi}\label{generalizedlevellines} Let $u$ be upper semicontinous, so that its level sets are closed. Consider the connected components of $X^c$, where $X$ is a level set, and assume that the boundary of each is a finite union of non crossing Jordan curves meeting each other at a finite number of points. 
Then, we say that these Jordan curves are level lines of $u$.
\end{Defi}



This definition may seem and is restrictive ; it has, however, the advantage of applying to a main example we will consider in the sequel : u.s.c. piecewise constant images, in particular images constant on pixels.  In that  case, each level set is a union of closed squares on a grid and it is easily checked that our definition applies and uniquely defines a set of Jordan curves which we call the level lines of the image. Conversely, these level lines uniquely define the associated level set and we can reconstruct from them the image.

As an example, let us consider a checkerboard image, where pixels have alternate values 255 (white) and 0 (black).  If we decide that the function is u.s.c., then the white pixels include their own boundaries and are connected.  The black pixels instead are disconnected.  Thus, the level lines of $u$ are simply all boundaries of all black pixels.  
		
 
\PLEVELPRUEBA





\section{The curvature of the level lines\label{thecurvatureofthelevellines}}



 In this section, we assume again that the dimension $N$ is 2.
Consider a real function  $u$ which is twice differentiable ($C^2$) in a  neighborhood of
$\fxx\in
\real^2$.  Without loss of generality, we choose the origin to stand at $\fxx$ so that in the
following we set $\fxx=0$ and we assume that $u(0)=0$.  In order to simplify the notation, we
shall omit the mention that computations are done at 0 and write $Du$ instead of $Du(0)$,
etc..  We denote by \index{differential operators!gradient} \index{gradient}
$Du = (u_x, u_y)$ the gradient of $u$ at $0$, by $|Du| =
(u_x^2+u_y^2)^{\frac 1 2}$ its euclidean norm.  If   $Du \neq 0$,
 we call ``orientation of the gradient" the normalized vector
$
\vec i=\frac {Du}{|Du|}.
%\label{Defnormal}
%§\quad label Defnormal
$
We set $Du^\perp = (-u_y, u_x)$, a vector orthogonal to $Du$ and 
$\vec j = \frac {Du^\perp}{|Du|}$.  Taking into account that $\vec
j$ and $\vec i$ are orthogonal and with norm equal to 1, we use them 
to define the Cartesian
coordinates of points $\fxx = (x,y)$ in a neighborhood of $0$.  Thus, we set 
$\fxx =  x\vec i + y\vec j$.  If $Du=0$, we simply choose for $\vec i$ and $\vec j=(\vec
i)^\perp$ two arbitrary orthogonal unit vectors. 

\PINTRINSICCOORD

 Since $u$ is $C^2$, we can by Taylor formula 
write 
\fb&
\label{xix.1}
%§\quad label xix.1
 u(\fxx) = px+ ax^2 + by^2+cxy + O(|\fxx|^3), 
\fe&
where $p=|Du|(0)\geq 0$ and, if $p>0$, 
\fb&
\label{F2}
%§\quad label F2
 \begin{array}{l} b=\frac{1}{2} \frac{\partial^2 u}{\partial
y^2} (0) = \frac{1}{2} D^2u(\frac {Du^\perp}{|Du|}, \frac {Du^\perp}{|Du|}) \\ \\
a=\frac{1}{2} \frac{\partial^2 u}{\partial x^2} (0) = \frac{1}{2} 
D^2u(\frac {Du}{|Du|}, \frac {Du}{|Du|}) \\ \\
c=\frac{\partial^2 u}{\partial x \partial y} (0) = D^2u(\frac {Du^\perp}{|Du|},
\frac {Du}{|Du|}) \\
\end{array}
\fe&
The Implicit Function Theorem  \ref{implicitfunctiontheoremdim2}
implies that in a neighborhood of 0, the set $\{\fxx, u(\fxx)\}$ is a $C^2$ graph whose
equation we can write $x=\varphi(y)$, where $\varphi$ is a $C^2$ function in a neighborhood of
0.  In order to see how $\varphi$ is related to $u$, we rewrite (\ref{xix.1}) as
$$
x=\varphi(y)=-\frac 1 p(ax^2 + by^2+cxy)+o(x^2+y^2).
$$
>From this equation we draw $x^2=o(y^2)$ and $xy = o(y^2)$, so that finally
\fb&
\label{equationintrinseque}
x=\varphi(y) = -\frac b p y^2 + o(y^2)
\fe&
Equation (\ref{equationintrinseque}) is the equation in intrinsic coordinates of the {\it
level line} \index{level line} $\{\fxx, u(\fxx) = u(0)\}$ of
$u$ at
$0$.   We deduce that $|\frac {2b}p| = \frac 1  R$ is the inverse of the radius of the
osculatory circle to this curve, which we call absolute curvature.  This and Relation
(\ref{F2}) justify the next definition.
\begin{Defi} \index{curvature} \index{differential operators!curvature}
\label{definitiondelacourbure}
Let $u$ be a real $C^2$ function defined around a point $\fxx\in \real^2$ such that
$Du(\fxx)\neq 0$.  Then we call curvature of $u$ at $\fxx$ the real number defined by
\fb&
 \curv(u)(\fxx)= \frac{1}{|Du|^3}  D^2u( Du^\perp, Du^\perp )(\fxx)=
\frac{u_{xx}u_y^2 -2u_{xy}u_xu_y + u_{yy}u_x^2}{(u_x^2+u_y^2)^{\frac 3 2}}(\fxx).
\label {curv(u)}
%§\quad label curv(u)
\fe&
\end{Defi}
Returning to the notations (\ref{F2}), we obtain
\fb& \label{F3}
%§\quad label F3
 b=\frac{1}{2} |Du| \curv(u)(0). 
\fe&
\begin{Exercice}
 Show that Formula (\ref{curv(u)})
can also be written in a compact way as
\fb&
\curv(u)(\fxx) = \div(\frac {Du}{|Du|})(\fxx),
\label {curvdiv}
%§\quad label curvdiv
\fe&
where we define, as usual, $\div (u) = \frac {\partial }{\partial x}u+\frac
{\partial}{\partial y}u=u_x + u_y$. \index{differential operators!divergence} \index{divergence}
Show that $\curv(u)$ does not depend  upon any $C^2$ increasing or decreasing
contrast change.  (Just substitute $g(u)$ to $u$ in the formula
(\ref{curv(u)}) defining the curvature.)  
\end{Exercice}
\begin{Exercice}
Let us make a useful verification. Our definition of curvature must match the intuitive
notion that the curvature of a circle is the inverse of its radius.  Define 
$u(\fxx) = |\fxx|^2$.  Then level lines are circles and the normal vector to level lines is 
$\vec n(\fxx) = -\frac {\fxx}{|\fxx|}$.  The level line
passing by $\fxx$  is a circle with radius $|\fxx|=R$.  We parameterize this circle by length~:
$C=\{(R\cos\frac s R, R\sin \frac s R)\}$. Then the tangent vector to the level line is
$\vec\tau(s) = (-\sin\frac s R,
\cos\frac s R)$ and $\frac{\partial\vec\tau(s)}{\partial s} = -\frac 1 R(\cos \frac s R, \sin
\frac s R) = \frac 1 R\vec n(\fxy(s)).$  Thus, the curvature of the level line (defined as the
modulus of the acceleration along the curve)  is $\frac 1 R$. Check that with
Formula \ref{curv(u)}, one has
$curv(u)(\fxx) = \frac 1R$.
\end{Exercice}


\begin{Exercice} \label{fonctionsradialessuffisent} Curvature and local comparaison of functions. \newline
We say that a function $f$ is radial and increasing if there exists an increasing function $g: \real^+ \rightarrow \real$ and $\fxx \in \real^2$ such that $f(\fxy) = g((\fxx-\fxy)^2)$.
Let $u(\fxx)$ be a $C^2$ function from $\real^2$ into $\real$. Assume that 
$Du(\fxx_0) \neq 0$. Our aim is to show that  there exist for every $\epsilon > 0$ two $C^2$ radial and increasing functions $f^+_\epsilon$ and $f^-_\epsilon$ such that
$$  f^-_\epsilon(\fxx_0) = u(\fxx_0) =  f^+_\epsilon(\fxx_0),$$
$$  Df^-_\epsilon(\fxx_0) = Du(\fxx_0) =  Df^+_\epsilon(\fxx_0),$$
$$  curv(f^-_\epsilon)(\fxx_0) +\epsilon = curv(u)(\fxx_0) =  curv(f^+_\epsilon)(\fxx_0) -\epsilon,$$
$$ f^-_\epsilon(\fxx) + o((\fxx-\fxx_0)^2) \leq u(\fxx) \leq  f^+_\epsilon(\fxx) + o((\fxx-\fxx_0)^2).$$
\noindent 1. Choose, without loss of generality,  $\fxx_0=(0,0)$, $Du(\fxx_0)=
 (p,0)$, with $p>0$.  Then for some $a,b,c$ we have by Taylor expansion
$$u(\fxx) = px + ax^2 +by^2 + cxy + o(x^2+y^2)$$
Show that for every $\epsilon>0$,
$$px + (b-\epsilon) y^2 + (-\frac{|c|}{\epsilon}+a) x^2 +o(x^2+y^2) \leq u(x,y) \leq  px + (b+\epsilon) y^2 + (\frac{|c|}{\epsilon}+a) x^2 +o(x^2+y^2).$$
\noindent 2. Let $f(x,y) = g((x-x_0)^2+y^2)$ be a radial function, show by an asymtotic expansion at $(0,0)$ that 
$$f(x,y) = g(x_0^2) - 2 x_0g'(x_0^2)x + \frac{1}{2}((4g''(x_0^2)x_0^2 + 2g'(x_0^2))x^2+ 2g'(x_0^2)y^2).$$
\noindent 3. Conclude. 
\end{Exercice}





\section{The principal curvatures of a level surface
 \label{theprincipalcurvaturesofalevelsurface}}

Following the same line as in the preceding section, we shall now  define
differential operators of $u$ invariant with respect to contrast changes, which
we  later on shall interpret as the ``principal curvatures" of the level surface of
$u$.  In the following, when $\fxz$ is a vector of $\real^N$, we denote by $\fxz^\perp$ the 
hyperplane orthogonal to $\fxz$, $\fxz^\perp =\{\fxy, \fxz.\fxy=0\}$.\notation

\begin{pro}\label{invariancedescourburesprincipales}
Let $u(\fxx)$ be a $C^2$ function in a neighborhood of a
point $\fxx_0$.  Assume that $Du(\fxx_0)\neq 0$ and consider the symmetric matrix
$D^2u(\fxx_0)$, which we write for simplicity $D^2u$.  Then the eigenvectors and
eigenvalues of the restriction of $D^2u$ to $Du^\perp$ are not altered by a $C^2$ contrast
change
$u\to g(u)$ satisfying $g'(s)>0$.
\end{pro}
\paragraph{Proof}
If $\fxy\in \real^N$, we denote by $\fxy\otimes\fxy$ the linear map 
$\fxx\to (\fxy\otimes\fxy)(\fxx) = (\fxx.\fxy)\fxy$ whose range is $\real \fxy$.  Its matrix on
the canonical basis of $\real^N$ is $(y_iy_j)_{1\leq i, j\leq N}$. An easy application of the 
chain rule shows that
$$D(g(u))= g'(u)Du \hbox{ and }$$
$$ D^2(g(u)) = g''(u) Du\otimes  Du + g'(u)D^2u.$$
This implies first that $Du^\perp = D(g(u))^\perp$ (we have assumed $\forall s, $ $g'(s)\neq 0$).   If $\fxy
\in Du^\perp$,  then $(Du\otimes Du)(\fxy)=0$ and therefore $D^2(g(u))(\fxy, \fxy) =
g'(u)D^2u(\fxy, \fxy).$  Thus, the matrices $D^2u$ and $D^2(g(u))$ are
proportional on $Du^\perp=D(g(u))^\perp$ and their eigenvectors and
eigenvalues are equal.
\enddemo

\begin{Exercice} By computing explicitly the coordinates $\frac{\partial}{\partial  x_i}(g(u))$
of  $D(g(u))$, check that $D(g(u))= g'(u)Du.$  By computing explictly
the values  $\frac{\partial^2}{\partial  x_i\partial x_j}(g(u))$, check the formula used 
in the preceding proof,
 $ D^2(g(u)) = g''(u) Du\otimes  Du + g'(u)D^2u.$
\end{Exercice}
We now proceed to  define locally the level
surface of a smooth function $u$.
\begin{th1} {\bf (Implicit function theorem)}\cite{} \index{implicit function theorem}
\label{implicitfunctiontheorem}
\newline
Let $u(\fxx) = u(x_1, x_2, ..., x_N)$ be a $C^1$ function in a neighborhood a
point $\fxx_0$.  Assume that $Du(\fxx_0)\neq 0$.  Set $\vec
i_N=\frac{Du}{|Du|}(\fxx_0)$ and $\fxx = \fxx_0+x_N\vec i_N + \fxy$, where 
$\fxy\in Du(\fxx_0)^\perp$.
Then there exists a ball
$B(\fxx_0, \eta)$ and a $C^1$ function
$\varphi(\fxy)~: \fxy\in B(\fxx_0,\eta)\cap \{\fxx, x_N=0\}\to
\varphi(\fxy)\in\real$ such that for every 
$\fxx = \fxx_0+\fxy +x_N\vec i_N\in B(\fxx_0, \eta)$,
$$u(\fxx)=0\Leftrightarrow
x_N= \varphi(\fxy)$$
In other terms, the equation $x_N=\varphi( \fxy)$ describes the set
$\{u(\fxx)=0\}\cap B(\fxx_0,\eta)$ as the  graph of a $C^2$ function 
$\varphi$.  Thus, we obtain a surface which we call ``level surface of $u$
around $\fxx_0$". If $u$ is $C^2$, then so is $\varphi$.
\end{th1}


As in Sections \ref{se:topographic1}, \ref{se:topographic2}, we can define a topographic map for $C^1$ images on a compact hyperrectangle. We begin by  eliminating all $\lambda$'s which are singular (i.e. $Du(\fxx)=0$ for some $\fxx \in u^{-1}(\lambda)$), and then decompose  $u^{-1}(\lambda)$ into a finite set of $C^1$ embedded oriented manifolds. The topographic map is thus uniquely defined and gives a complete representation of $u$, from which $u$ can be reconstructed.

By combining Proposition \ref{invariancedescourburesprincipales} and 
Theorem \ref{implicitfunctiontheorem}, we can do two useful things~: First, to give
a simple intrinsic form to the level surface around $\fxx_0$ and second to
interpret the eigenvalues introduced in Proposition
\ref{invariancedescourburesprincipales} as curvatures of lines drawn the level
surface of $u$.
\begin{pro}  \index{differential operators!principal curvatures} \index{principal curvatures}
Let $u$ be a $C^2$ function around a point $\fxx_0\in \real^N$.  Assume that
$p=|Du(\fxx_0)|\neq 0$ and denote by $\kappa_1, ..., \kappa_{N-1}$ the
eigenvalues of the restriction of $D^2u(\fxx_0)$ to $Du(\fxx_0)^\perp$.  Then,
setting $\vec i_N = \frac {Du}{|Du|}(\fxx_0)$ and choosing $\vec i_1, ..., \vec
i_{N-1}$ to be an orthonormal basis of eigenvectors of the restriction of $D^2u(\fxx_0)$
 to $Du(\fxx_0)^\perp$, we have for $\fxx = \fxx_0 +x_1\vec i_1+...
+x_N\vec i_N = \fxx_0 + \fxy$ small enough~: 
$$u(\fxx)=0\Leftrightarrow x_N  = -\frac 1
{2p}\sum_{i=1}^{N-1}\kappa_ix_i^2+o(|\fxy|^2).$$
\end{pro}
\paragraph{Proof}
Fixing the origin at $\fxx_0$, assuming without loss of generality that $u(0)=0$
and using the Taylor expansion formula, we obtain
$$u(\fxx) = Du(0).\fxx + \frac 1 2 D^2u(0)(\fxx, \fxx) + o(|\fxx|^2).$$
Setting $\fxx = x_N \vec i_N + \fxy$, where $\fxy\in Du(0)^\perp$, this can be
written 
$$u(\fxx)=px_N +\frac 1 2 D^2u(0)(\fxy,\fxy) + x_ND^2u(0)(i_N,\fxy) + \frac 12
x_N^2D^2u(0)(i_N, i_N) +
o(|\fxx|^2).$$
If $\fxx$ belongs to the level surface $\{u(\fxx)=0\}$ and $|\fxx|\leq \eta$, we 
deduce that $x_N^2 = o(|\fxx|^2) $ and
 by Theorem \ref{implicitfunctiontheorem} that
$$x_N = \varphi(\fxy)  = -\frac 1 p(\frac 1 2 D^2u(0)(\fxy,\fxy) +
x_ND^2u(0)(i_N, \fxy)) + o(|\fxx|^2).$$
This implies that $x_N=o(|\fxy|^2)$ and therefore by substitution
$o(|\fxx|^2)=o(|\fxy|^2)$, so that 
\fb&
\label{devloc}
x_N=\frac{-1}{2p}D^2u(0)(\fxy,\fxy) +o(|\fxy|^2).
\fe&
We have $\fxy\in\{x_N=0\}\cap B(0,\eta)= B(0,\eta)\cap Du(0)^\perp$.  Thus,
using an orthonormal basis of eigenvectors of the restriction  of $D^2u(0)$ to
$Du(0)^\perp$, and calling $x_i$, $i=1,...,N-1$ the coordinates on this orthonormal basis
of $Du(0)^\perp$,
$$x_N=\frac {-1}{2p}\sum_{i=1}^{N-1}\kappa_i x_i^2 + o(|\fxy|^2).$$
\enddemo
Let us now use our two-dimensional analysis and interpret the $\kappa_i$ as
curvatures.
\begin{pro} {\bf and definition of the principal curvatures. }
\label{definitionprincipalcurvatures}
Let $u$ be a $C^2$ function around $\fxx_0$ such that $Du(\fxx_0)\neq 0$.  Set
again $\vec i_N = \frac {Du}{|Du|}(\fxx_0).$  Then for every unit vector $\vec
\nu$ orthogonal to $Du(\fxx_0)$, the intersection of the level surface 
$\{u(\fxx)=0\}$ with the plane $\{x_N\vec i_N + t\vec \nu, (x_N,t)\in \real^2\}$,
is a $C^2$ curve for $|(x_N, t)|\leq \eta$.  The curvature of this curve 
at $\fxx_0$ is 
$$\kappa_\nu = \frac 1 {|Du(\fxx_0)|}D^2u(\vec \nu, \vec \nu).$$
In the case where $\vec \nu = \vec i_j$ is an eigenvector of $D^2u(\fxx_0)$
restricted to $Du(\fxx_0)^\perp$, this curvature $\kappa_j$ is called a
principal curvature of the level surface of $u$ at $\fxx_0$.


\end{pro}
\paragraph{Proof}
We apply Formula (\ref{devloc}) with $\fxx = x_N \vec i_N + t\vec \nu
= \varphi(t\vec\nu)\vec i_N + t\vec \nu.$
Thus
$$x_N = \frac {-1}{2|Du(\fxx_0)|}D^2u(\fxx_0)(\vec \nu, \vec \nu)t^2+o(t^2).$$
The curvature at 0 of this two-dimensional curve is 
$$\kappa(u)= \frac 1{|Du(\fxx_0)|}D^2u(\fxx_0)(\vec\nu, \vec\nu).$$
\enddemo

\begin{pro}
{\bf and Definition of  The Mean Curvature in dimension $N$}
The ``Mean Curvature'' is defined as the sum of the principal curvatures. It is also given by
$$curv(u) = |Du| div(Du/|Du|)$$
\end{pro}

\paragraph{Proof}
By the preceding proposition and since $\Delta u$ is the sum of the eigenvalues of $D^2u$, it is easily checked that 
$$ curv(u) = |Du| \Delta u - D^2(Du,Du)/|Du| $$
Now, with $Du = (u_{x_0}, ..., u_{x_N})$, we have
$$div(Du/|Du|) = \sum_i \frac{\partial }{\partial x_i} \frac{u_{x_i}}{|Du|}$$
$$ = \sum_i \frac{1}{|Du|^2}\frac{\partial^2 }{\partial x_i^2} u - (\frac{\partial }{\partial x_i} |Du|) u_{x_i}/|Du|$$
Combining all terms, we obtain
$$ div(Du/|Du|) = \frac{ \Delta u}{|Du|} -  \frac{D^2u(Du,Du)}{|Du|}$$
\endproof 

\section{Visualization of the topographic map.}

In pratice, the digital image is described by a matrix of values $u(i,j), 0 \leq i \leq n, 0 \leq j \leq m$. Those values are assumed to be a sampling of a continuous image
$\tilde u(x,y)$ such that $\tilde u(i,j)= u(i,j)$, at each location. The function $\tilde u$ is generally given by Shannon theory (\cite{Mallat:1998:WTS}). Now, since this Shannon interpretation can be heavy to implement and since we do not need such precision for a visualization, we shall in this book just display level lines as concatenations of vertical and horizontal lines bounding the pixels. This involves a zoom of factor 2 of the image size.

Defining a function $\phi_\lambda: \real \times \real \rightarrow \{0, 255 \}$ by
$$ 
\begin{array}{ll}
\phi_\lambda(a,b)= 0 & \hbox{ if } a < \lambda \hbox{ and } b \geq \lambda \\
\phi_\lambda(a,b)= 0 & \hbox{ if } a \geq \lambda \hbox{ and } b < \lambda \\
\phi_\lambda(a,b)= 255 & \hbox{ otherwise }
\end{array},
$$
and, given $\lambda$ and a digital image $u(i,j)$, we define
the image of the level lines at level  $\lambda$ of $u$ by:
$$
\begin{array}{l}
w(2i,2j)=255 \\
w(2i+1,2j)= \phi_\lambda(u(i+1,j),u(i,j)) \\
w(2i+1,2j+1) = \phi_\lambda(u(i+1,j+1),u(i,j)) \\
w(2i,2j+1) = \phi_\lambda(u(i,j+1),u(i,j)).
\end{array}
$$
Using the code $0=$black and $255=$white, the level line $\lambda$ of $u$ will appear as a black line on a white background in image $w$.
Of course, we can superpose several levels in order to obtain a joint map of several level lines, i.e. a  topographic map.  In order to be visually readable, this topographic map must not show
too many levels ; in practice not more than about twenty.  The removal of small level lines
can be very useful in order to improve the readability of the topographic map and we shall 
discuss filters performing this task in the last section  about the ``extrema killer'' in Chapter \ref{chapter5}.


\zbibnote

\noindent
{\bf Section \ref{sectioncourbes}~:}
For elementary presentations of the basic differential calculus used in this section, we refer to the books Cartan \cite{Cartan:1977:CD} and Spivak \cite{Spivak:1966:CM} where proofs of the Sard and implicit function theorems can be found. An introduction to the use of level lines in Computer Vision can 
be found in Caselles et al. \cite{Caselles:1997:TM}. \newline
\noindent
{\bf Section \ref{}~:}
\newline
\noindent The Jordan curve theorem is proved (e.g.) in Rudin \cite{Rudin:1966:RCA}. The reconstruction formula (\ref{LUIDONNERUNEREF}) permitting to rebuild a set 
from its boundary, when this boundary is made of a fine set of Jordan curves, is stated here in an elementary framework where the Jordan curve theorem is the only needed tool.  A more general construction assumes that the set to be reconstructed from its boundary is a set with finite perimeter.  Then it can be shown that its boundary can be defined in a unique way as a countable union of Jordan curves and the reconstruction formula is still valid.  
 A complete definition and proof of this general reconstruction formula, is given in \cite{AMCAMAMO}. \newline

{\bf Sections \ref{}~:} and \ref{} : It is a classical mathematical trick to define implictly a set as the the zero set of its distance function. In the case where the set is a curve, one can compute the curvature  of a curve at a point $\fxx$ by computing the curvature $curv (u)(\fxx)$ at the same point of the distance function to the curve.  This 
yields an intrinsic formula for the curvature, not linked to a parameterization of the curve. The same trick has been refreshed in recent years as a very useful numerical tool.  This started with Barles  report \cite{Barles??} on flame propagation and was extended by Sethian \cite{Sethian:1982:AFP} and 
Osher-Sethian \cite{Osher:1988:FPCa} in a series of papers on the numerical simulation of 
the motion of  surface by its mean curvature.

\chapter{The main contrast invariant equations.  \label{chaptermainequation} \label{chaptermainequations} \label{chapter4bis} }


\section{The normal and curvature of a shape as cues to recognition}

In this section, we shall link   shape recognition  and  scale space theory.  Let us
define a ``shape" as a closed bounded subset of $\real ^2$. Without loss of generality, we
shall assume that this subset, $X$, has a boundary made of a finite set of simple
closed curves (Jordan curves) with finite length.     This finiteness
assumption is computationally realistic and implies that
$X$ is a Cacciopoli set. The mathematician Renato Cacciopoli \cite{??} proposed a theory for
sets whose boundary has finite length, from which it can be deduced that the boundary of a
Cacciopoli set is made of an enumerable set of Jordan curves.  We restrict this assumption
to finiteness for obvious quantization reasons.  The main consequence of this
model for shapes is that they are fully described by the finite list of their boundary
Jordan curves.  The shape recognition problem can therefore be reduced to the
problem of recognition of the shape building elements~: the Jordan curves.
Thus, we shall in the following assume that the shape undergoing a recognition process is
described by a single Jordan curve.  In photographs of a natural environment, most
observed shapes are  partially occluded (hidden) and  distorted by perspective
deformations.   The shape recognition technology has therefore focused on local methods,
that is, methods which will work even if the shape is not fully in view and if the visible
parts are distorted. When we observe a Jordan curve, we can therefore not be sure
whether is belongs to one and the same object ; it may be the concatenation of several
objects occluding each other. {\it Thus, recognition has
to be based on local features of the Jordan curve and not on global one.  If the shape
boundary is in some degree smooth, those
 local features simply are derivatives of the curve, that is~: orientation, curvature,
etc.}.
Before starting with formal definitions of these geometric quantities, let us mention that
most local recognition methods indeed involve the ``salient" points of the shapes,
identified with inflexion points (where the curvature is zero) \index{inflexion points} and extrema of curvatures
(the ``corners" of the shape). \index{extrema of curvature} In such local recognition methods, a shape is reduced to a
finite code,  namely the coordinates of a set of \index{characteristic points}  {\it characteristic points}, corners and
inflexion point mainly.  The shape recognition is then reduced to a comparison
between finite shape codes by ``voting methods" like {\it geometric hashing}.  Let us now
return to what will be our main concern here, the definition and effective computation of
the normal and curvature to a shape.


\section{\label{Multiscalefeatures}Multiscale features and scale space}
 The above mentionned methods (and, as a matter of fact, all nonglobal
computational shape recognition methods) make two basic assumptions,
none of which is in practice true for the analyzed shapes (identified from now on
with Jordan curves)~:

\begin{itemize}
\item The shape has a smooth boundary\par 
\item The shape has a finite set of inflexion points and extrema of
curvature.
\end{itemize} \index{multiscale features}
 The fact that this assumption can however become a reality has been mathematically
 proved in 1986-87 by  Gage-Hamilton \cite{Gage:1986:HESa} and Grayson \cite{Grayson:1987:HESa} who proved the
possibility of smoothing a Jordan curve into a Jordan curve by the so called ``intrinsic
heat equation".
\begin{Defi} \index{PDE!intrinsic heat equation} \index{Intrinsic heat equation} 
\label{defchaleurintrinseque}  Let $\fxx(t,s)$ be a family of Jordan $C^2$ curves
and assume for each
$t$  that 
$s\to \fxx(t,s)$  is an euclidean parameterization.
We say that $\fxx(t,s)$ satisfies the {\rm intrinsic heat equation} if
\fb&
\label{heatintrinsicequation}
\frac {\partial \fxx}{\partial t}(t,s)= \frac{\partial^2\fxx }{\partial
s^2}(t,s)=Curv\;\fxx(t,s).
\fe&
\end{Defi}

\begin{th1} (Grayson) \index{Grayson theorem}  The intrinsic heat equation lets   any Jordan curve $\fxx(s)$ with
finite length evolve into a family of Jordan curves $\fxx(t,s)$ such that
$\fxx(0,s)=\fxx_0(s)$, the curve $\fxx(t,s)$ being for every positive scale $t$ a
$C^\infty$ Jordan curve, with  a finite set  of inflexion points and extrema
curvature.  The number of these ``characteristic points" is nonincreasing with
$t$.  In addition, there is  for every initial Jordan curve a scale $t_0$ such that the
curve $s\to\fxx(t_0,s)$ becomes convex and another scale $t_1$ for which the curve shrinks
to a point.
\end{th1}


  Of course, the initial shape
 $\fxx_0(s)$ may well have infinitely many  characteristic points and may even have unbounded
curvature
 everywhere.  The point is,
that anyway
$\fxx(t,s)$ has derivatives of any order for $t>0$ and the curvature has finitely many
zero-crossings and extrema for every fixed $t>0$.  Still better~: the
number of characteristic points  cannot but decrease when
the ``time parameter" $t$ increases, so that the scale space is {\it causal}
according to the Vision theory terminology.  The discovery of
Gage-Hamilton and Grayson has found a significant response in the Vision
Research, where several attempts to define {\it scale spaces} for shapes
had come very close to the equation studied by Gage-Hamilton and
Grayson. We call {\it shape scale space} any method allowing to smooth a
shape, the degree of smoothing being measured by  a positive real
parameter $t$, the {\it scale}.  Thus scale space associates with every initial
 Jordan curve $\fxx(0,s)=\fxx_0(s)$ a series of smoothed shapes,
$\fxx(t,s)$. It is expected that the intrinsic heat equation acts as a selective way of
eliminating spurious details of the shape, keeping a rougher but more
reliable version of the shape and a shorter code as well.  The matching of two instances
$\fxx_0(s)$ and
$\fxx_1(s)$ of a given shape should be done by comparing the characteristic points of
$\fxx_0(t,s)$ and
$\fxx_1(t,s)$ for a value of $t$ large enough. 
 Comparing the originals
$\fxx_0$ and $\fxx_1$ is simply impossible~: They are expected to depend highly upon the
conditions of observation.  Observation noise and distorsions of the initial Jordan curve
 make it impossible to  single out directly on $\fxx_0(s)$ the significant corners and
inflexion points.

\section{From image motion to curve motion.}
%%\section{From curve motion to image motion and conversely}
\subsection{Level lines as curves}
Let  $u$ be a real function which is twice
differentiable ($C^2$) in a  neighborhood of $\fxx$. We denote by $Du(\fxx) = (u_x,
u_y)(\fxx)$ the gradient of $u$ at $\fxx$, by $|Du(\fxx)| = (u_x^2+u_y^2)^{\frac 1 2}(\fxx)$
its euclidean norm. 
We consider the level curve of $u$
passing by $\fxx$ , defined as the set $$ \{ \fxy,  u(\fxy)= u(\fxx) \}$$
If we assume that $Du(\fxx) \neq 0$, by the Implicit Function Theorem, we know that the
level curve indeed is a curve, which inherits the smoothness of $u$ in a neighborhood of
$\fxx$.  
We set $Du^\perp = (-u_y, u_x)$, a vector orthogonal to $Du$.  The next lemma links the
intrinsic curvature of the level curve $Curv(\fxx)$ introduced in Definition
\ref{parametrisationseuclidiennes} and the curvature differential operator
$\curv(u)(\fxx)$ of Definition \ref{definitiondelacourbure}.


\begin{lem} 
\label{relationentrelescourbures}  Let $u(\fxx)$ be a $C^2$ real function~: $\real^2\to
\real$ and
$\fxx$ a point such that $Du(\fxx)\neq 0$.  Call $C$ the level line passing by $\fxx$. 
Then
\fb&
\label{relationentreCurvetcurv}Curv(\fxx)=-\curv(u)(\fxx) \frac {Du}{|Du|}(\fxx).
\fe&
\end {lem}

\paragraph{Proof}
Consider a level curve $\{\fxy, u(\fxy) = u(\fxx)\}$.  We notice that $\frac
{Du^\perp}{|Du|}$ is a unit vector tangent to the curve at $\fxx$.  Then there is by
Lemma \ref{parametrisationseuclidiennes} a single euclidean parameterization 
$\fxy(s)$ of the level curve such that 
\fb&
\label{abm}
\frac{\partial \fxy(s)}{\partial s}(0)=
\frac{Du^\perp}{|Du|}(\fxx)
\fe&
  Differentiating the relation $u(\fxy(s))=0$ we have
$Du(\fxy(s)).\frac{\partial \fxy(s)}{\partial s}=0$ and differentiating again at $s=0$
and using (\ref{abm}),
$$D^2u(\frac{Du^\perp}{|Du|},
\frac{Du^\perp}{|Du|})+Du(\fxx).\frac{\partial^2\fxy}{\partial s^2} = 0.$$
Using the definitions \ref{definitiondelacourbure} and \ref{parametrisationseuclidiennes}
of $\curv(u)$ and
$Curv(\fxx)$, this becomes
$$\curv(u)|Du|(\fxx) + Du(\fxx). Curv(\fxx)=0.$$
Noticing that $Curv(\fxx)$ is colinear to  $Du(\fxx)$, we deduce that
$$Curv(\fxx) = -\curv(u)\frac{Du}{|Du|}.$$
\enddemo 

The intrinsic heat equation is only one instance of a wide range of nonlinear equations
which move curves with a curvature-dependent speed. The only requirement for this dependence, which we
shall justify in Chapter \ref{Shapes} is that the higher the curvature, the higher the speed:

\begin{Defi}\label{defchaleurintrinseque2}
\index{curvature equation for curves}  Let $\fxx(t,s)$ be a family of Jordan $C^2$ curves
and assume for each
$t$  that 
$s\to \fxx(t,s)$  is an euclidean parameterization.
We say that $\fxx(t,s)$ satisfies a {\rm curvature equation} if it is $C^2$ and for some real
function 
$g(\kappa, t)$, nondecreasing with respect to $\kappa$ satisfies
\fb&
\label{generalcurvatureequation}
\frac {\partial \fxx}{\partial t}(t,s)=  g(t,|Curv \fxx(t,s)|)\nbol(t,s).
\fe&
\end{Defi}

\begin{Defi}\label{defequationgeneraledecourbure}  \index{curvature equation for images}
We say that $u(t, \fxx)$ satisfies a {\rm curvature equation} if it is $C^2$ and for some real
function 
$g(\kappa, t)$, nondecreasing with respect to $\kappa$ satisfies
\fb&
\label{generalcurvatureequationforimages}
\frac {\partial u}{\partial t}u(t, \fxx)=  g(\curv u, t)|Du|(t, \fxx).
\fe&
\end{Defi}
All of these equations are candidates to be curve or image scale spaces and one of our main tasks
in this book is precisely to single out the most relevant ones.  The definitions above are very
restrictive in that they assume a $C^2$ regularity of the image or the curve. Now, as we shall see,
this regularity requirement impossible to attain.  A more general and applicable
 definition of solutions for
 the 
above image equations will be introduced in Chapter \ref{chapter15} on viscosity solutions.
In the next section, we establish
a formal link between curve motions and curvature motions for images.



\subsection {Curvature equations for curves and real functions}
\begin{Defi} \index{PDE!curvature equations for curve} \index{curvature equations for curve} \index{normal flow}
\index{curve!PDE}
\label{normalflow}
Let u(t,\fxx) be $C^2$ function around a point $(t_0, \fxx_0)$ such that
$Du(t_0,\fxx_0)\neq 0$.  Then there exists a neighborhood $V$ of $\fxx_0$, a time 
 $t_1	>t_0$ and for $t\in [t_0,t_1]$ and $\tilde \fxx \in V$ a unique
$C^1$ vector function
$\fxx(t, \tilde \fxx)$ satisfying 
$\fxx(0, \tilde \fxx)=\tilde \fxx$, $u(t, \fxx(t, \tilde\fxx)) = u(t_0, \tilde\fxx)$ and such
 that $\frac
{\partial\fxx(t, \tilde\fxx)}{\partial t}$ is colinear to 
${Du}(t,\fxx(t, \tilde \fxx))$. We call $\fxx(t, \tilde
\fxx)$
the ``normal flow starting from $(t_0, \tilde \fxx )$". The normal flow satisfies the ordinary
differential equation
\fb&
\label{flotnormalcommeODE}
\frac {\partial \fxx}{\partial t}= -(\frac{\partial u}{\partial
t}\frac{Du}{|Du|^2})(t,\fxx(t)).
\fe&
\end{Defi}


\paragraph{Proof}
Differentiating the relation $u(t, \fxx(t))=0$ with respect to $t$ yields 
$\frac{\partial u}{\partial t} + Du.\frac{\partial \fxx}{\partial t} = 0$.  Thus
$\frac{\partial \fxx}{\partial t}$ is colinear to $Du$ if and only if
\fb&
\label{flotnormal}
\frac {\partial \fxx}{\partial t}= -(\frac{\partial u}{\partial
t}\frac{Du}{|Du|^2})(t,
\fxx(t)).
\fe&
This relation defines $\fxx(t)$ as the solution of an ordinary differential equation, with
initial condition $ \fxx(0) = \tilde \fxx$.  Since
$u$ is $C^2$,  the second member of (\ref{flotnormal}) appears to be a Lipschitz function
of
$(t,\fxx)$ provided $Du(t, \fxx)\neq 0$, which is ensured for $(t, \fxx)$ close enough to
$(t_0,
\fxx_0)$.  Thus, by Cauchy-Lipschitz Theorem, there exists $t_1>t_0$ such that   the O.D.E.
(\ref{flotnormal})  has a unique solution $\fxx(t, \tilde \fxx)$ for all 
$\tilde \fxx$ in a neighborhood of $\fxx_0$ and  $t\in [t_0, t_1]$.
 \enddemo



\begin{pro}
Let $u(t, \fxx)$ be a $C^2$ function such that $Du(t_0, \fxx_0)\neq 0$. Then $u$ satisfies
the  curvature motion equation 
\fb& \label{curvaturemotionequation}
\frac{\partial u}{\partial t} = \curv(u) |Du|
\fe&
in a neighborhood of $(t_0, \fxx_0)$ if and only if
the normal flow $\fxx(t)$ satisfies the intrinsic heat equation 
(\ref{heatintrinsicequation}),
$$
\frac {\partial \fxx}{\partial t}(t,s)= \frac{\partial^2\fxx }{\partial s^2}(t,s)
=Curv(\fxx(t,s)).
$$
\end{pro}
\paragraph {Proof}
 If (\ref{heatintrinsicequation}) holds, by (\ref{flotnormalcommeODE}), we get
$$-(\frac{\partial u}{\partial t}\frac{Du}{|Du|^2})(t,\fxx(t))= Curv(\fxx(t)).$$
By (\ref{relationentreCurvetcurv}), this yields
$$-(\frac{\partial u}{\partial t}\frac{Du}{|Du|^2})(t,\fxx(t))= \curv(u)\frac{Du}{|Du|},$$
which implies the curvature motion equation (\ref{curvaturemotionequation}).
Conversely, substituting in (\ref{flotnormalcommeODE}) the value of $\frac{\partial
u}{\partial t}$ given by (\ref{curvaturemotionequation}) yields
$$\frac{\partial \fxx}{\partial t} = -(\curv(u)|Du|\frac {Du}{|Du|^2})$$
and using (\ref{relationentreCurvetcurv}) we obtain
the heat intrinsic equation (\ref{heatintrinsicequation}), 
$\frac {\partial \fxx}{\partial t}(t,s)= Curv(\fxx(t))$.
\enddemo


\begin{cor} \label{equivalencedemouvementsdecourbeetdimages}
\index{curvature motion (equivalence of curve and image motion)}
Let $u(t, \fxx)$ be a $C^2$ function such that $Du(t_0, \fxx_0)\neq 0$ and $g(\kappa, t)$ a continuous
function, nondecreasing with respect to $\kappa$. Then $u$ satisfies
the  curvature motion equation (\ref{generalcurvatureequationforimages})
$$
\frac{\partial u}{\partial t}(t, \fxx) = g(\curv(u), t) |Du|(t, \fxx)
$$
in a neighborhood of $(t_0, \fxx_0)$ if and only if
the normal flow $\fxx(t)$ satisfies the intrinsic heat equation (\ref{generalcurvatureequation})
 (introduced in Definition
\ref{defchaleurintrinseque2}).
$$
\frac {\partial \fxx}{\partial t}(t,s)=  g(t,|Curv \fxx(t,s)|)\nbol(t,s)
$$
\end{cor}

\subsection{\label{introductiontoaffinecurveandimageequations}
Introduction to affine curve and image equations}


A particular  instance of curvature equation is, as we shall see, affine invariant and therefore
well suited to be used in shape recognition.
\begin{Defi}\label{definitiondesequationsaffines}
We call "affine morphological scale space" (AMSS) the   image evolution equation 
\fb& \label{AMSS1}
\frac{\partial u}{\partial t} = \curv(u)^\frac 13 |Du|(t, \fxx),
\fe& 
where $k^\frac 13$ means $\sgn(k)|k|^\frac 13$. We call "affine scale space" (ASS) the curve
evolution equation
\fb& \label{ASS1}
\frac{\partial \fxx}{\partial t}(t, s) = |Curv(\fxx(t,s))|^\frac 13 \nbol(t,s)
\quad (\quad =\frac{Curv(\fxx(t,s)}{|Curv(\fxx(t,s))^\frac 23}\quad).
\fe& 
\end{Defi}
It is easily seen that both considered equations are formally equivalent in the sense 
of Corollary \ref{equivalencedemouvementsdecourbeetdimages}. 
Let us now briefly give a first explanation for the "affine" denomination. A second explanation 
will be given in the next subsection.

\begin{Defi}\label{affineinvariancedequation} 
\index{affine invariance (of an image evolution equation)} We say that an image evolution equation  is 
{\rm affine invariant} if for every linear map 
$A$ with positive determinant,  there is a constant $c(A)$ depending only on $A$ such that $u(t, \fxx)$ 
is a solution of the curvature equation if and only 
$u(c(A), A\fxx)$ is.
\end{Defi}
 This definition is a bit 
puzzling but will be fully explained in Section \ref{Invariance}.
In Exercises \ref{invarianceaffinedeAMSS}, \ref{invarianceaffinedeASS}, 
we check that the AMSS and ASS equations indeed are affine invariant.

\begin{Exercice} \label{invarianceaffinedeAMSS}
(i) Let $u$ be a $C^2$ function, $A$ a $2\times 2$ matrix and 
set $v(\fxx)=u(A\fxx)$. Prove that at each point $\fxx$ such that $Dv(\fxx)\neq 0$, one 
has $\curv v(\fxx)|Dv(\fxx)|=|det A|^\frac 12 curv(u)(A\fxx)$.
\newline
(ii) Deduce that the AMSS equation \ref{AMSS1} is affine invariant, namely $u$ is solution 
of (AMSS) if and only if $v(\fxx) = u(A\fxx)$ is solution of 
$$\frac{\partial v}{\partial t} = (det A)^\frac 23\curv(v)^\frac 13 |Dv|(t, \fxx).$$
\end{Exercice}

\begin{Exercice}\label{invarianceaffinedeASS} Affine invariance of the affine scale space (ASS).
\newline  \index{affine invariance of the affine curve scale space}
 From Exercise \ref{calculdecourbures}, we know that if $\fxc(\sigma)$ is parametric $C^2$
 curve with $|\fxc'(\sigma)|>0$, then by Formula (\ref{mieuxvaut}),
 \fb& 
Curv(\fxc(\sigma))=x''(s)=\frac 1{\fxc'^2(\sigma)}(\fxc''(\sigma)
-(\fxc''(\sigma).\frac{\fxc'(\sigma)}{|\fxc'(\sigma)|})\frac{\fxc'(\sigma)}{|\fxc'(\sigma)|}).
\fe&
Using this formula, and projecting both members of the intrinsic heat equation on 
the normal vector $\fxc'(\sigma)^\perp$, we shall say that
 $\fxc(\sigma)$ satisfies a {\rm curvature equation} if 
\fb& 
\frac{\partial\fxc}{\partial t}.\frac{\fxc'^\perp}{|\fxc'|}=\frac {\fxc''.\fxc'}{|\fxc'|^3}.
\fe&
(i) Show that if $\fxc(\sigma)$ is an euclidean parameterization, then this definition coincides
with the usual one, (\ref{heatintrinsicequation}).
In the same way, we shall say that $\fxc$ satisfies an affine equation if for some
positive constant $\gamma>0$,
\fb& \label{affineprojeteesurnormale}
\frac{\partial\fxc}{\partial t}. \fxc'^\perp =(\fxc''.\fxc')^\frac 13.
\fe&
($a^\frac 13$ denotes $\sgn(a)|a|^\frac 13$).  Let $A$ be a $2\times 2$ matrix with positive 
determinant.
Our aim is to check that if $\fxc$ satisfies an affine motion, then 
so does $\fxy(\sigma)=A\fxc(\sigma).$
\newline 
(ii) Let $\fxx, \fxy\in\real^2$. Show that
$A\fxx.(A\fxy)^\perp=(\det A)\fxx.\fxy^\perp$ and 
$A(\fxx^\perp).(A\fxx)^\perp=(\det A)|\fxx|^2.$
\newline
(iii) Deduce the announced affine invariance.  More precisely, show that if 
$\fxc(\sigma)$ satisfies (\ref{affineprojeteesurnormale}), then $\fxy(\sigma)=A\fxc(\sigma)$
satisfies
\fb&  
\frac{\partial\fxy}{\partial t}. \fxy'^\perp =(det A)^\frac 23(\fxy''.\fxy')^\frac 13.
\fe&

\end{Exercice}

\subsection{\label{Geometricinterpretation}
The  Affine Scale Space as an intrinsic heat equation}

Denote by $\fxx (t,\sigma)$ a curve at scale $t$, parametrized by a  parameter $\sigma$.
In this paragraph, we shall show a formal equivalence between the Affine Scale Space,
\fb&
\label{kut}
%§label kut\quad
 \frac{\partial \fxx}{\partial t} =
|Curv(\fxx)|^\frac{1}{3} \nbol(\fxx)=|k|^\frac 13\nbol(\fxx),
\fe& 
where $k=|Curv(\fxx)|(\fxx)$ is a useful abbreviation for the curvature, and 
an ``intrinsic heat equation", \index{affine intrinsic heat equation}
\fb& 
\label{ihe} 
%§ label ihe\quad
\frac{\partial \fxx}{\partial t} =
\frac{\partial^2\fxx}{\partial \sigma^2} 
\fe&
where $\sigma$ is a special
parameterization of the curve  called affine length. \index{affine lenght}
Let us give some elements  of affine differential
geometry. We define an {\it affine length parameter}, or $\sigma$ of a Jordan curve as
a parameterization
$\fxx(\sigma)$ satisfying 
\fb& \label{defaff}  [\fxx_\sigma, \fxx_{\sigma\sigma} ] = 1\fe&
where $[ , ]$ stands for the determinant of two vectors.  Here and in the following, 
we write for clarity of the formulas $\fxx_{\sigma}$ for
$\frac{\partial\fxx}{\partial\sigma}$ and $\fxx_{\sigma\sigma}$ for
$\frac{\partial^2\fxx}{\partial\sigma^2}$.
If we denote by $s$ the arc length, and by $k=|Curv(\fxx)|(\fxx)$ the curvature, then a
tangent vector and the intrinsic normal vectors to the curve are given by
\fb& 
\label{tn} \tbol = \fxx_s \qquad \nbol = k^{-1} \fxx_{ss}\; (=\frac{Curv(\fxx)}{|Curv(\fxx)|}
\fe&
Moreover
\fb& 
\label{cs} \fxx_\sigma = \fxx_s \frac{\partial s}{\partial \sigma} \qquad
\hbox{ and }
\fe&
\fb& 
\label{css} 
\fxx_{\sigma\sigma} = \fxx_{ss} (\frac{\partial s}{\partial
\sigma})^2 + \fxx_s
 \frac{\partial^2 s}{\partial \sigma^2}
\fe&
Now (\ref{defaff}) implies
$$ [\fxx_s \frac{\partial s}{\partial \sigma} , 
\fxx_{ss} (\frac{\partial s}{\partial \sigma})^2 + \fxx_s
 \frac{\partial^2 s}{\partial \sigma^2}] = 1$$
$$ \Rightarrow \;\;\; [\fxx_s , \fxx_{ss}] (\frac{\partial
s}{\partial \sigma})^3 = 1 $$
Since by (\ref{tn}), $[\fxx_s , \fxx_{ss}] = k$, we conclude that
\fb& \label{ps} \frac{\partial s}{\partial \sigma} = k^{-\frac{1}{3}} \fe&


\vff
Let us now deal with $\fxx_{\sigma\sigma}$. Using (\ref{ps}) and (\ref{tn}) in
(\ref{css}) we obtain
$$ \fxx_{\sigma\sigma} = k^{\frac{1}{3}} \nbol +
 (\frac{\partial^2 s}{\partial \sigma^2}) \tbol $$

We deduce that equation (\ref{ihe}) is equivalent to
\fb& \frac{\partial \fxx}{\partial t} = k^{\frac{1}{3}} \nbol +
 (\frac{\partial^2 s}{\partial \sigma^2}) \tbol \fe&
Now, Epstein and Gage \cite{Epstein:1987:CSF}  have proved that
 the tangential component of such an equation does not matter as far as the geometric
evolution of the curve is concerned. Indeed, the tangential component
produces  a motion of the point along the curve itself and the whole curve evolution is
characterized defined by the normal velocity.
As a consequence, (\ref{ihe}) is equivalent to
Equation (\ref{kut})
on non-inflection points. Thus,  we have the following equivalence in terms of curve
evolution~:

$ \frac{\partial \fxx}{\partial t} =
k^\frac{1}{3} \nbol $  if and only if
$$ \frac{\partial \fxx}{\partial t} = \left\{ \begin{array}{ll}
0 & \xbol \hbox{ inflection point} \\
\fxx_{\sigma\sigma} & \xbol \hbox{ non-inflection point} \\
\end{array} \right.$$


\section{Curvature Motions in dimension $N$.}

We consider a flow $u(t,\fxx)$ where $\fxx$ is of dimension $N$ and where $u(0,\fxx) = u_0(\fxx)$, an initial $N$ dimensional image. We denote by $\kappa_i(u)(t,\fxx) $ the $i^{th}$ principal cuvature of $u$ the image at point $(t,\fxx)$. (Principal curvatures have been introduced section \ref{theprincipalcurvaturesofalevelsurface}). ($i$ is between $1$ and $N-1$). Let us now introduce major equations describing some interesting flows $u(t,\fxx)$.

{\bf The mean Curvature Motion}
$$ \frac{\partial u}{\partial t}(t,\fxx) = |Du| \sum_{i=1}^{N-1} \kappa_i(\fxx) $$

With this equation, the motion of a level-hypersurface of $u$ in the normal direction is proportional to the mean value of its principal curvatures.

{\bf The Gauss Curvature Motion of convex functions.}
We call convex functions, functions that have all their principal curvature with same sign. Example of such a function is the signed distance function to a regular convex shape.  

$$ \frac{\partial u}{\partial t}(t,\fxx) = |Du| \prod_{i=1}^{N-1} \kappa_i(\fxx)$$

The motion of a level-hypersurface of $u$ is now proportional to the product of its principal curvatures. However, this equation can not be applied, as is, on non convex functions due to the maximum principle (see Chapter \ref{chapter19}).


{\bf The Affine Invariant Curvature Motion.}
$$  \frac{\partial u}{\partial t}(t,\fxx) = |Du| |\prod_{i=1}^{N-1} \kappa_i(\fxx)|^{\frac{1}{N+1}} H\big(\sum_{1 \leq i \leq N-1} sgn(\kappa_i)\big) $$
where $H(N-1)=1$, $H(-N+1)=-1$ and $H$ null otherwise.

This motion is similar to the Gauss Curvature Motion. The affine invariance implies to use the power $\frac{1}{N+1}$ of the gaussian curvature, the maximum principle implies to cancel the motion at point where principal curvatures have different signs.


\zbibnote

\noindent{\bf Role of curvature in shape analysis}



We can mention \cite{Agin:1972:RDC} as one of the first references dealing with the role
of curvature in the representation and recognition of objects in Computer Vision.
The classical paper proposing to compute a  "multiscale curvature" 
in order to recognize objects in an image is Asada-Brady's
\cite{Asada:1986:CPS}, "The Curvature Primal Sketch". The title is an allusion to
the famous David Marr's "raw primal sketch", a set of geometric primitives extracted
from and representing the image.
This paper entailed a long series of more and more sophisticated attempts to represent
Shape from Curvature \cite{Dudek:1990:SRC, Dudek:1991:SRR} and to compute the curvature
correctly  \cite{Mundy:1995:ORS}.
\newline
\newline

\noindent{\bf Affine invariant curve shortening}


Affine invariant geometry seems to have been founded by Blaschke \cite{??}, which contains
definitions of the affine length and affine curvature.  
Curves with constant affine curvature are discussed in \cite{Maeda:1941:CPS}.
The name Affine Shortening and the corresponding curve evolution equation
was introduced by Sapiro-Tannenbaum in \cite{Sapiro:1993:AIS}.
Some mathematical properties were developped by the same authors 
in \cite{Sapiro:1993:ICE, Sapiro:1994:APC}
In \cite{Angenent:1998:AHF},
Angenent, Sapiro and Tannenbaum gave a first existence and uniqueness proof for the 
affine shortening.  
\newline
\newline

\noindent{\bf Curve shortening}
The mathematical study of the intrinsic heat equation (or curvature motion in dimension 2) 
was made in a series of brillant papers in differential geometry
whose titles sufficiently indicate the progress made :  Gage \cite{Gage:1983:IIA, Gage:1984:CSM}
 ("Curve shortening makes convex curves circular"), Epstein-Gage \cite{Epstein:1987:CSF}, 
Gage-Hamilton \cite {Gage:1986:HESa} "The heat equation shrinking convex plane curves",
"Given a curve in the plane, let it deform in the
                 direction of its curvature vector. It was conjectured
                 that the curve would collapse in finite time to a point
                 and that, as the curve collapsed, it would become
                 asymptotically close to a shrinking standard circle.
                 The authors prove this conjecture for a convex plane
                 curve. "
Finally, Grayson \cite{} whose paper  "The heat equation shrinks embedded plane curves to
                 round points" is commented in laconic terms by his referee:
"This paper contains the final solution of the
                 long-standing ``curve-shortening problem'' for plane
                 curves."
\newline
The first papers introducing the curve shortening and some variants in image processing
as means to do a multiscale analysis of curves (understood as shapes extracted from an image)
 were written by Kimia, Tannenbaum and Zucker \cite{Kimia:1992:ECF} and Mackworth-Mokhtarian
who propose the use of curve shortening as an efficient numerical tool for shape multiscale
analysis \cite{Mackworth:1992:TMC}.
\newline

\noindent
{\bf Mean curvature motion}
In his famous paper "Shapes of worn stones", Firey \cite{Firey:1974:SWS} 
proposed a model for the erosion of stones on a beach.
The surface of those stones evolves at a normal speed proportional to the 
speed of the Gauss curvature of the surface, and it was conjectured 
that the final shape of the stones is spherical.  The first 
attempt to make a mathematical definition of the mean curvature motion is 
Brakke \cite{Brakke:1978:MSM}.
We shall discuss in the next chapters the clever numerical 
implementation of the  same equation by Sethian (\cite{Sethian:1985:CEF}
"Curvature and the evolution of fronts")
 In \cite{Fred:1993:CDF}, a more general formulation of the mean curvature  motion  is proposed, which adapts to crystal growth and in general to the evolution of anisotropic solids.



\chapter{Monotone and contrast invariant operators.  The threshold decomposition principle \label{CIOMM} \label{chapter5}}
\thispagestyle{empty}

\section{Contrast invariant function operators}

In the following, we denote by $\cal F$ \notation a space of  functions defined on
$\real^N$ with values in $\real$ and denote by 
$\cal T$\notation the set of all level sets of functions of $\cal F$.  \index{$\cal F$
set of functions} If (e.g.)  $\cal F$ is the set of continuous real functions on
$\real^N$, then $\cal T$ \index{$\cal T$ set of subsets of $\real^N$} is the set of 
closed subsets of $\real^N$. If $\cal F$ is the set of Borel-Lebesgue measurable
functions then $\cal T$ is the set of Borel subsets of $\real^N$, etc. 
We assume that $\cal F$ is stable by continuous nondecreasing contrast changes $u\to g(u)$, i.e.
$g(u)\in \cal F$ whenever $u\in \cal F$.
 We consider function operators on $\cal F$,
$$T : u \in {\cal F} \rightarrow Tu,$$\notation 
where $Tu$ is a real function, $Tu(\fxx)\in \real$,
and set operators on $\cal T$, $$\setT  : X \in {\cal T} \rightarrow \setT X.$$\notation
\index{operator!set} \index{set operator}
\index{operator!function} \index{function operator}
Our main interest here is in {\it monotone}  operators, because they are
nonlinear generalizations of the linear smoothing by a nonnegative convolution kernel . 
 
\begin{Defi}
\index{operator!monotone} \index{monotone operator} \index{set monotone operator}
\label{defmonotonefonction}
We say that a function operator $T$ is
{\underbar{monotone}} if  
\fb&
 u \geq v \Rightarrow Tu \geq Tv. \label{vi.2}
%§\quad label vi.2
\fe& 
We say that a set operator $\setT $ is monotone
if 
\fb&
\label{defmonotoneensemble}
X\subset Y \Rightarrow \setT (X)\subset \setT (Y)
\fe&
\end{Defi}

\begin{Defi}
 \label{definitiondechangementdecontraste}\index{contrast change}
We call \underbar{continuous contrast change} any nondecreasing continuous function $g$ :  $\real\to \real$.
\end{Defi}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{Defi}
\index{operator!contrast invariance!definition} \index{contrast invariant}
\label{defmorphologique}
We say that $T$ is \underbar{contrast invariant} on $\cal F$ if for every
continuous contrast change
$g:\real\to \real$, one has $g(u)\in \cal F$ whenever $u\in \cal F$ and  
\fb& 
\label{vi.1}
\forall u\in {\cal F}, \; g(Tu) = T(g(u)).
\fe&
\end{Defi}

  The next proposition puts into evidence one of the main properties yielded by
contrast invariance : the conservation of grey levels. This conservation
property implies that, in contrast  to linear operators, contrast invariant operators
do not  create new grey levels in an image.  This means in practice that {\it images filtered
by a contrast invariant operator remain well contrasted.}  Fronts of $u$, which correspond to
gaps in  the range of $u$, are preserved.  In particular, binary images remain binary.
\newline
We denote by $R(u)\subset \real$\notation the range of a function $u$, that is,
$R(u)=\{s\in
\real,\exists \fxx, u(\fxx)=s.\}$
 
\begin{pro}\label{conservationofgreylevels}
 \label{morphoimpliquecaracteristique}
Let $T$ be a contrast invariant operator. Then for every function $u$, 
$R(Tu) \subset \overline{Ru}$. In particular, if $u$ attains a finite number of values, then
$Tu$ attains a subset of them.
\end{pro}
\paragraph{Proof}
We consider a continuous increasing function $g$ such that $g(s)=s$ when $s\in \overline{Ru}$,
$g(s)>s$ otherwise.  As an example of such function using the distance to the set $Ru$,
we can take
$$g(s) = s +\frac 12 d(s, Ru),$$
where $d(s,X)$ denotes the distance of $s$ to $X$. We have $d(s, Ru)=0$ if and only 
$s\in \overline{(Ru)}$. Thus $g(s)=s$ if and only $s\in \overline{(Ru)}$. In particular, 
$g(u) = u$.
Using this and the contrast invariance of $T$ we have
$$Tu = T(g(u)) = g(Tu).$$
Thus $(Tu)(\fxx)$ is for every $\fxx$ a fixed point of $g$ and therefore $(Tu)(\fxx)$ belongs
to $\overline{Ru}$, as announced.

\enddemo
Another interesting property of contrast invariant and translation invariant operators : they do not 
increase the Lipschitz constant of functions.  
In fact, the property is much more general,
 being true for all translation invariant operators 
 commuting with the addition of constants : $T(u + C)=Tu + C.$

\begin{lem} \label{Lips} %[Lipschitz]
%§label Lips\newline
Let $T$ be a monotone, translation invariant  operator commuting with the addition of constants.
If $u(\fxx)$ is a  Lipschitz function on $\real^2$ then  the
function $Tu(\fxx)$ is Lipschitz, with a lower or equal Lipschitz constant.
\end{lem}

\paragraph{Proof of lemma \ref{Lips}.}
Assume $u$ has a
Lipschitz constant equal to $K$. For any $\fxx$, $\fxy$, and $\fxz$,
we have 
\fb& 
%§label Lips1\newline
\label{Lips1} 
u(\fxy+\fxz) - K |\fxx-\fxy| \leq u(\fxx
+\fxz) \leq u(\fxy+\fxz) + K |\fxx-\fxy|\fe&
Since $T$ is  monotone, considering the above functions as functions of $\fxz$ applying
them $T$ and taking the value at 0 of the obtained functions, we obtain
$$ T (u(\fxy+\fxz) - K|\fxx-\fxy|)(0)
\leq 
T u(\fxx +\fxz) (0)
\leq 
T(u(\fxy+\fxz) + K |\fxx-\fxy|))(0). $$
Notice that by the translation invariance, $T(u(\fxy+\fxz))(0)= (Tu)(\fxy)$, etc. 
Using the  commutation of $T$ with the additions of constants and 
the translation invariance,  we therefore obtain
$$ (Tu)(\fxy) - K |\fxx - \fxy| \leq (Tu)(\fxx) \leq
(Tu)(\fxy) + K |\fxx - \fxy|.$$ \endproof
The preceding regularity preserving property of contrast invariant operators is 
generalized in Exercise \ref{preserveuniformecontinuite}.
\begin{Exercice}
\label{preserveuniformecontinuite}\index{uniform continuity (preservation by contrast invariant 
operator)}
We say that a function $u(\fxx)$ is {\it uniformly continuous} \index{uniform continuous (definition)}
if there exists a real nonnegative function $\varepsilon (s)$ such that $\varepsilon(s)\to 0$
when $s\to 0$ and for all $\fxx, \fxy \in \real^N$,
$$|u(\fxx+\fxy)-u(\fxx)|\leq \varepsilon(|\fxy|).$$
The function $\varepsilon(s)$ is then called a uniform continuity modulus of $u$.
Show that if $u$ is uniformly continuous and $T$ is translation invariant and commutes with the 
addition of constants, then $Tu$ also is uniformly continuous, with the same modulus as $u$.
(Adapt the proof of Lemma \ref{Lips}).
\end{Exercice}
\begin{Exercice} \label{operateursdecroissentlanormeinfinie}
Let $T$ be a monotone contrast invariant operator. Show that 
\newline
(i) T(C)=C for every constant function $C$.
\newline
(ii) $u\geq C\Rightarrow Tu\geq C$, $u\leq C\Rightarrow Tu \leq C$.
\newline
(iii) $ \sup |Tu(\fxx)-Tv(\fxx)|\leq \sup |u(\fxx)-v(\fxx)|.$
\newline
Indication : write $-\sup|u(\fxx)-v(\fxx)|\leq u(\fxx)-v(\fxx)\leq \sup|u(\fxx)-v(\fxx)|.$
\newline
(iv) Notice that the above results still work if we only assume that $T$ is monotone and 
commutes with the addition of constants.
\end{Exercice}

\section{From constrast invariant operators to set operators : the threshold superposition principle.}

Assume that $\cal F$ contains the characteristic functions $\indic_X$ of elements of $X$.
We can associate with $T$
 a set operator $\setT$, defined on the set $\cal T$ of all level sets of all functions in $\cal
F$ by
\fb&  \index{set operator (deduced from a contrast invariant function operator)}
\setT(X)=\levelset_1(T(\indic_X)).
\label{identification}
\fe&
where $\indic_X(\fxx) = 1$ if $\fxx \in X$ and $\indic_X(\fxx)=0$ otherwise\notation. Note that if $T$ is monotone, then $\setT$ is a
set monotone operator. Indeed,
$$X\subset Y \Leftrightarrow \indic_X\leq \indic_Y.$$
The definition of $\setT$ makes sense by Proposition \ref{conservationofgreylevels} : according
to this proposition, $T(\indic_X)$ attains the values 0 and 1 like $u$ and is therefore 
a characteristic function. See Exercise \ref{imagedefonctioncaracteristique}
\begin{Exercice} \label{imagedefonctioncaracteristique}
In order to justify the definition of $\setT$ when $T$ is contrast invariant,  we shall show that $T(\indic_X)$ is a characteristic
function, i.e. only attains the values 0 and 1.   In order to do so, consider a contrast change $g$ 
such that $g(0)=0$, $g(1)=1$ and $g(s)\neq s$ for $s\neq 0$ or $1$.  Show that
$T(\indic_X)=T(g(\indic_X))=g(T(\indic_X)).$  Deduce  that $T(\indic_X)$ has the only values 0 and 1 and
 conclude that $ \indic_{\setT (X)} = T(\indic_X)$.  Notice that this result also follows from Proposition \ref{conservationofgreylevels}.
\end{Exercice}

In order to explore the relationships between $T$ and $\setT$, we shall first  show roughly that 
$T$ commutes with thresholds.

\begin{lem} \label{commutationofcontrastinvariantoperatorswiththresholds}
Let $T$ be a contrast invariant monotone operator.  Consider the threshold functions  $\gamma_\lambda(s)=1$ if 
$s\geq  \lambda$  and $\gamma_\lambda(s)=0$ otherwise. \index{threshold function}
Then $T$ commutes almost everywhere with almost every threshold, i.e.
$$\gamma_\lambda(Tu) =T(\gamma_\lambda(u)) \hbox{ a.e.  in } \lambda,\; \hbox{ a.e.  in  }\fxx.$$
\end{lem}
\paragraph{Proof}  Let
 $$\gamma_\lambda^\epsilon(s)=0 \hbox{   if   } s\leq \lambda - \epsilon,$$
 $$\gamma_\lambda^\epsilon(s)=\frac{s-(\lambda-\epsilon)}{\epsilon} \hbox{   if   } \lambda-\epsilon\leq
 s\leq \lambda,$$
 $$\gamma_\lambda^\epsilon(s)=1  \hbox{   otherwise   }.$$
Then $\gamma_\lambda^\epsilon(s)$ is a contrast change and $\gamma_\lambda^\epsilon \geq \gamma_\lambda.$
Thus
$$ T(\gamma_\lambda(u))\leq T(\gamma_\lambda^\epsilon(u))=\gamma_\lambda^\epsilon(Tu)\to \gamma_\lambda(Tu),  \; \hbox { as } \epsilon\to 0.$$

\PAPPROXTHRESHOLD

Using in the same way continuous nondecreasing functions $\tilde\gamma_\lambda^\epsilon\leq \gamma_\lambda,$ we also prove that $T(\gamma_\lambda(u))\geq\gamma^-_\lambda(Tu),$ where 
$\gamma^-_\lambda (s) = 1$ if $s>\lambda$ and $\gamma¯(s)=0$ otherwise.  We therefore 
obtain
$$\gamma^-_\lambda(Tu)\leq T(\gamma_\lambda(u))\leq \gamma_\lambda(Tu).$$
Let us consider the countable, and therefore negligible, subset $\Lambda\subset\real$ of all $\lambda$ such that 
$\meas(\{\fxx, Tu(\fxx)=\lambda\})>0.$  For $\lambda\in \real\setminus\Lambda$, we have
 $\gamma^-_\lambda(Tu)=\gamma_\lambda(Tu)$ almost everywhere.  Thus, for almost every $\lambda$, we obtain 
$$T(\gamma_\lambda(u))= \gamma_\lambda(Tu)\; \; \hbox{almost everywhere.}$$
\enddemo
In a converse way to Relation (\ref{identification}) defining a set operator from a function operator, we can define a function operator $T$ from a set operator $\setT$ thanks to the 
{\it threshold superposition principle}.

\begin{Defi}
We say that $T$ is obtained from $\setT$ by the threshold superposition principle almost everywhere if
\fb& 
\label{SPae}
Tu(\fxx)= \sup\{\lambda, \; \fxx \in \setT(\levelset_\lambda u)\},  \hbox{ a.e.  in  }\fxx.
\fe&
If the preceding relation holds for every $\lambda$ and $\fxx$, we say that the threshold 
superposition holds everywhere.
\end{Defi}

\begin{pro} \label{Propositionlienoperateurensembleoperateurfonction}  
 Let  $T$ be a monotone contrast invariant operator on a set of functions $\cal F$ containing the characteristic functions $\indic_X$ of the elements $X$ of $\cal T$.  
Define its associated set operator by
$\setT(X)=\levelset_1(T(\indic_X)).$ Then $T$ is monotone, we have
 for every $u\in \cal F$ 
\fb&
\label{lienoperateurensembleoperateurfonction}
\setT(\levelset_\lambda u) = \levelset_\lambda(T(u)),  \hbox{ a.e.  in } \lambda,\; \hbox{ a.e.  in  }\fxx
\fe&
and the threshold superposition principle holds almost everywhere :
\fb& 
\label{SPae2}
Tu(\fxx)= \sup\{\lambda, \; \fxx \in \setT(\levelset_\lambda u)\},  \hbox{ a.e.  in  }\fxx.
\fe&
In addition, 
$$\setT(\emptyset)=\emptyset \; a.e.,\; \setT(\real^N)=\real^N\; a.e..$$
\end{pro}

\paragraph{Proof}
Using the definition of $\setT$, the obvious relations $\indic_{\levelset_\lambda u} =
\threshold_\lambda(u)$,
$\levelset_1(\threshold_\lambda(v))=\levelset_\lambda v$, and the commutation almost everywhere of $T$ with
$\threshold_\lambda$, obtained in Lemma \ref{commutationofcontrastinvariantoperatorswiththresholds}, we get
$$\setT(\levelset_\lambda u) = \levelset_1(T(\indic_{\levelset_\lambda u}))=
\levelset_1(T(\threshold_\lambda(u)))=
\levelset_1(\threshold_\lambda(Tu))=\levelset_\lambda(Tu), \; \hbox{ a.e. in } \lambda, \;\hbox{ a.e. in } \fxx.
$$
Let us show  the superposition principle ( \ref{SPae}). It follows immediately
from (\ref{lienoperateurensembleoperateurfonction}) and Lemma  \ref{ensemblesdeniveaumodifiespresquepartout}, applied to $Y_\lambda=\setT(\levelset_\lambda u)$ and $v=Tu$.
We now prove the last statement.  We take for $u$ a constant function, say, equal to 0.  Then $\levelset_\lambda u=\emptyset$ for $\lambda>0$.  By the relation (\ref{lienoperateurensembleoperateurfonction}) just proved, we deduce 
that $\levelset_\lambda (Tu)=\setT (\levelset_\lambda u)=\setT(\emptyset)$ almost everywhere and
for almost every $\lambda>0$. Thus the equality holds for many $\lambda$'s. On the other hand, by contrast invariance, $T$ commutes with the constant function 0. Thus $Tu=0$ and therefore $\levelset_\lambda (Tu)=\emptyset$ for 
$\lambda>0$. We finally obtain $\setT(\emptyset)=\emptyset$ almost everywhere. The other announced relation follows in the same way.
\enddemo



Relation (\ref{SPae}) means that we can compute all level sets of $Tu$ separately, by applying $T$ to each characteristic function of the level set $\levelset_\lambda u$. We then have the following ``stack filter" algorithm:

$$ u \begin{array}{ccccc} & \levelset_\lambda u & \rightarrow & \setT (\levelset_\lambda u) & \\
\nearrow & ... & & & \searrow \\
\searrow & & & & \nearrow \\
& \levelset_\mu u & \rightarrow & \setT (\levelset_\mu u) & \\
\end{array} Tu(\fxx) = \sup\{\lambda, \fxx \in \setT(\levelset_\lambda u)\}.$$
As developped in Chapter \ref{chapter22}, the stack filter method will be used to maintain a very accurate contrast invariance in numerical schemes for several contrast invariant P.D.E.'s. 

 
\section{From set operators to contrast invariant function
operators. \label{setoptoimop}}

Can we extend a set monotone operator into a contrast invariant and monotone operator defined on
an adequate set of functions ? 
We start from a set operator $\setT $, defined on a subset $\cal T$ of ${\cal
P}(\real^N)$ and with values  in $\cal T$.  We assume that $\setT $ is a {\it monotone} operator,
that is,
$X
\subset Y \Rightarrow \setT (X)
\subset \setT (Y)$.   We define   
$\cal F$  as the set of all real functions defined on $\real^N$ whose level sets
$\levelset_\lambda u$ belong to $\cal T$. As a consequence, $\cal
F$ contains the characteristic functions of elements of $\cal T$. 

A natural definition for the function operator $T$ associated with $\setT$ is given  by 
the threshold superposition principle,
\fb& Tu(\fxx) = \sup\{ \lambda, \fxx \in \setT(\levelset_\lambda u)\} \label{TfromsetT} \fe&
We have now to check whether $T$ is contrast invariant.

\begin{pro} \label{setoperatortoimageoperatorfaible}
Let $\setT$, ${\cal T} \rightarrow {\cal T}$ be a monotone operator satisfying
$$ T(\emptyset) = \emptyset,  \setT(\real^N)= \real^N $$
Then the operator $T$ defined on $\cal F$ by superposition principle,
\fb&  \label{superpositionprinciple2}
 Tu(\fxx) = \sup \{\lambda, \fxx \in \setT(\levelset_\lambda u) \}
 \fe&
 satisfies,  for almost every $\lambda \in \real$,
\fb&
\levelset_\lambda (Tu) = \setT(\levelset_\lambda(u)) \hbox{ almost everywhere in }  \fxx
\fe&
and for any nondecreasing continuous contrast change  $g$,
\fb&
g(Tu) = T(g(u)).
\fe&
\end{pro}

\paragraph{Proof}

By Corollary \ref{II.1.bis}, we have for almost every $\lambda$
\fb& \levelset_\lambda (Tu) = \setT(\levelset_\lambda u) \hbox{ almost everywhere} \label{ae1} \fe&
that is for all $\lambda$ in a subset $\Lambda$ of $\real$ such that 
$\meas(\real \setminus \Lambda) = 0$.
We notice that $u \leq v$ if and only if
$\levelset_\lambda u \subset \levelset_\lambda v$ for all $\lambda$ in a dense
countable subset of $\real$.  We deduce immediately that $T$ is monotone, ie $u \geq v \; \Rightarrow Tu \geq Tv$.
\newline
\newline
Let us now  show that $T$ commutes with contrast changes.  Assume first that $g$ is 
strictly increasing and set $g(+\infty)=\lim_{s\to +\infty}g(s)$ and 
$g(-\infty)=\lim_{s\to -\infty}g(s).$  
\newline For $\lambda>g(+\infty),$ we have 
$\levelset_\lambda g(u)=\emptyset$ and therefore $\setT(\levelset_\lambda g(u))=\emptyset.$
\newline
For $\lambda < g(-\infty)$, we  have $\levelset_\lambda g(u)=\real^N$ and therefore
$\setT(\levelset_\lambda g(u))=\real^N.$
\newline As a consequence, using \ref{superpositionprinciple2} we can restrict the range of $\lambda$ in the definition
of $T(g(u(\fxx)))$ :
$$T(g(u(\fxx)))=\sup \{\lambda, \; g(-\infty)\leq \lambda\leq g(+\infty), \; \fxx\in\setT(\levelset_\lambda g(u))\}$$
$$=\sup\{g(\mu),\;  \fxx\in \setT(\levelset_{g(\mu)}g(u))\}$$
$$=\sup\{g(\mu),\; \fxx\in \setT(\levelset_\mu u)\}= g(Tu(\fxx)).$$
Let us now check that $T$ commutes with general  nondecreasing contrast changes $g$.
We can find strictly increasing continuous functions $g_n$ and $h_n$ such that $g_n(s)\to g(s)$,
$h_n(s)\to g(s)$ for all $s$ and $g_n\leq g\leq h_n$.  Thus, by using the just proven
commutation of $T$ with increasing contrast changes, we have
$$T(g(u))\geq T(g_n(u))=g_n(Tu)\to g(Tu)\; \hbox {  and  }$$
$$T(g(u))\leq T(h_n(u))=h_n(Tu)\to g(Tu), $$
which yields  $T(g(u))=g(Tu).$
\endproof

\begin{Exercice}
Let $g$ be a continuous nondecreasing function.  Construct  increasing continuous functions $g_n$ and $h_n$ such that $g_n(s)\to g(s)$,
$h_n(s)\to g(s)$ for all $s$ and $g_n\leq g\leq h_n$.
\end{Exercice}

\begin{Exercice}
We explain the necessity of the assumptions $\setT(\emptyset)=\emptyset$ in Proposition \ref{setoperatortoimageoperatorfaible}, $\setT(\real^N)=\real^N$ in order to get a contrast invariant operator $T$ from $\setT$.
\newline\newline
1) Set $\setT(X)=X_0$ for all $X\in \cal T$, where $X_0\neq  \emptyset$ is a fixed set. Check
that $Tu(\fxx)=+\infty$ if $\fxx\in X_0$, $Tu(\fxx)=-\infty$ otherwise. Let now $g$ be a continous nondecreasing bounded function. Show that $T(g(u))\neq g(Tu)$.
\newline\newline
2) Let $\emptyset\neq X_1\subset X_0\neq \real^N$ and set $\setT(\real^N)=X_0$, $\setT(X)=X_1$
if $X\neq \real^N$, $\setT(\emptyset)=\emptyset$.   Show that $Tu(\fxx)=-\infty$ on 
$X_0^c$ and deduce again that $T(g(u))\neq g(Tu)$ if $g$ is bounded.
\newline\newline
3) Let $\setT$ be a  monotone set operator, without further assumption.  Show that its function operator $T$,  associated by the threshold superposition principle, commutes with  any continuous nondecreasing function $g$
such that $g(+\infty)=+\infty$ and $g(-\infty)=-\infty$.

\end{Exercice}

We shall now examine stronger conditions on $\setT$, which ensure commutation of $T$ with 
all thresholds $\levelset_\lambda$ (and not only with almost all of them).

\begin{Defi}\label{definitionuppersemicontinuousoperator}
We say that a set operator $\setT$ is upper semicontinuous if for every nonincreasing sequence of sets $X_n \in \cal T$, we have
\fb& \label{vii.2} \setT(\bigcap_n X_n) = \bigcap_n \setT(X_n).
\fe&
\end{Defi}

\begin{Exercice} \label{equivalencecontinudiscret}
Show that a monotone operator $\setT$ is upper semicontinuous if and only if it satisfies for every nonincreasing family of sets $(X_\lambda)_{\lambda\in \real}$, $\setT(\bigcap_\lambda X_\lambda) = \bigcap_\lambda \setT(X_\lambda).$
\end{Exercice}

\begin{th1} \label{3.5bis}
Let $\setT $: $\cal T$ $\to \cal T$ be a monotone upper semicontinuous set operator satisfying
$ \setT(\emptyset) = \emptyset$ and  $\setT(\real^N)= \real^N.$ Then the function operator 
defined by

\fb& Tu(\fxx) = \sup \{\lambda, \fxx \in \setT (\levelset_\lambda u) \}. \fe&
is contrast invariant and satisfies, for every $\lambda,$
\fb& \label{FGencore2}
\levelset_\lambda (Tu) = \setT(\levelset_\lambda(u)).
\fe&
\end{th1}  


\paragraph{Proof of Theorem \ref{3.5bis}}
Let us check that (\ref{FGencore2}) holds.
 By Proposition  \ref{II.1}, this is true if and only if the family of sets
$\setT (\levelset_\lambda u)$ satisfies (\ref{II.1}.i) and (\ref{II.1}.ii).  Now,
(\ref{II.1}.i) is true by monotonicity of 
$\setT $  and the inclusion  relations between the $X_\lambda u$.
  Relation (\ref{II.1}.ii) follows
immediately from (\ref{vii.2}) and  $\levelset_\lambda u = \bigcap_{\mu<\lambda}\levelset_\mu u $, which is (\ref{II.1}.ii) applied to 
$u$.
The monotonicity of $T$ is obvious : one has $$u\leq v \Leftrightarrow
(\forall \lambda, \;\levelset_\lambda u\subset \levelset_\lambda v).$$
Since $\setT $ is set monotone, we deduce that $$\forall \lambda, \; \setT (\levelset_\lambda u)
\subset \setT (\levelset_\lambda v) $$ and therefore $\forall \lambda, \levelset_\lambda (Tu) \subset
\levelset_\lambda (Tv)$, that is $Tu\leq Tv.$  In order to show that $T$ is contrast invariant,
i.e. commutes with all continuous nondecreasing functions, we can now directly apply  Proposition \ref{setoperatortoimageoperatorfaible}.
\endproof

\begin{rem}
The upper semicontinuity is necessary to ensure that a monotone set operator defines a function operator such that the commutation with thresholds
$\levelset_\lambda (Tu) = \setT(\levelset_\lambda(u)) $ holds for every $\lambda$. Let us choose for example
the following set operator $\setT $,
$$ \setT (X) = X   \; \hbox{ if meas}(X)>a \hbox{ and } \setT (X) = \emptyset \hbox{
otherwise }.
$$ 
Let  $u$ be the function from $\real$ into $\real$ defined by $u(x) = -|x|$.  Then
$$T(u)(x) = \sup\{\lambda, x \in \setT (\levelset_\lambda u)\} = \min( -|x|, -a/2) $$
Therefore
$$\levelset_{-a/2} T(u) = [-a/2,a/2]. $$
Now, $\levelset_{-a/2} u = [-a/2,a/2]$ ; its measure is $a$. Thus 
$$T(\levelset_{-a/2} u) = \emptyset \neq \levelset_{-a/2} T(u),$$
which means that $T$ is not contrast invariant.

\end{rem}

\PEXTKILL
\PEXTBIRDKILL


\section{Application : The ``Extrema Killer''. \label{extremakillersection}}

We study in this section operators which remove peaks in an image. Such  peaks are often created by impulse noise.   The extrema killer operators show outstanding denoising properties for such kinds of noise. We shall use the method developped in Section \ref{setoptoimop} which permits to define these operators on sets and then extend them to images.

\begin{Defi}
Let $X \subset \real^N$ be a closed set. We say that $X$ is connected if it is not the union of two disjoint  nonempty open sets. We call connected component of $\fxx$ in $X$, $cc(\fxx,X)$, the maximal connected subset of $X$ containing $\fxx$. It is a closed set.
\end{Defi}


Fix a scale parameter $a>0$. We define a set denoising operator  on $\cal T$, the set of all compact sets of $\real^N$ in the following way:
Let $X \in \cal T$  be a compact set. Then  $X$ is the union of all of its connected components, $X = \bigcup_i X_i$ and this decomposition is uniquely defined.
We then remove from $X$ all connected components of measure strictly less than $a$ :  We therefore define a ``small component killer"
\fb& \label{smallcomponentkiller}
\setT_a(X) = \bigcup_{meas(X_i) \geq a} X_i.
\fe&


\begin{lem} \label{KillExtLemma2}
Let $Y_n$ be a nonincreasing sequence of subsets of $\real^N$ and set $Y = \bigcap_n Y_n$. Then, if $Y_n$ are compact, so is $Y$. If $Y_n$ are compact and connected, so is $Y$.
\end{lem}


\paragraph{Proof}
These are classical topological arguments and we just check the proof of the second statement. If $Y$ were not connected, then $Y = Z_1 \cup Z_2$ where $Z_1$ and $Z_2$ are compact and disjoint. Thus, $d(Z_1,Z_2) = \inf_{z_1  \in Z_1, z_2 \in Z_2} ||z_1 - z_2|| >0$. We then remark that if
$Y_n \searrow Y$ and $Y_n$ are compact, then the Hausdorff semi-distance of $Y_n$ to $Y$ tends to 0: $\delta(Y_n,Y) \rightarrow 0$. (We set $\delta(Y,Z)=\sup_{\fxy\in Y}\inf_{z\in \fxz}\vert\vert \fxy-\fxz\vert\vert.$)
We choose $n_0$ such that $\forall n>n_0$, $\epsilon = \delta(Y,Y_n^c) < \frac{1}{2} d(Z_1,Z_2)$. It is then easily checked that $Y_n$ is split into two disjoint  open nonempty sets:
$$Y_n =(Y_n \cap Z_1^\epsilon) \cup (Y_n \cap Z_2^\epsilon)$$
where we note $Z^\epsilon = \{\fxz, d(\fxz, Z) < \epsilon \}$. \endproof

\begin{lem} \label{KillExtupperC}  The small component killer
$\setT_a$ is monotone and upper semicontinuous in the sense of Definition 
\ref{definitionuppersemicontinuousoperator} on the set $\cal T$  of all  compact subsets of 
$\real^N$.
\end{lem}

\paragraph{Proof}
If $X \subset Y$, then for every $\fxx$,  $cc(\fxx,X) \subset cc(\fxx,Y)$. Thus, if we assume that
$meas(cc(\fxx,X))\geq a$, then we also have $meas(cc(\fxx,Y))\geq a$. We conclude that
$\setT_a(X) \subset \setT_a(Y)$, that is,  $\setT_a$ is monotone.
Let $(X_n)_{n \in \natural}$ be a nonincreasing sequence of compact sets and let $X = \bigcap_n X_n$. We wish to show that $\setT_a(X) = \bigcap_n \setT_a(X_n)$. By Lemma \ref{KillExtLemma2}, $\cap_n X_n$ is compact. Let now $Y=cc(\fxx,X)$ be a 
connected component of $X$ and denote by $Y_n = cc(\fxx,X_n)$. Since  $X \subset X_n$, we have $Y \subset Y_n$ for all $n$.
Let us show that $Y= \bigcap_n Y_n$. Obviously, $Y \subset \bigcap_n Y_n$ and
$\bigcap_n Y_n \subset \bigcap_n X_n = X$. We therefore just have to check that $\bigcap_n Y_n$ is connected, which follows from Lemma \ref{KillExtLemma2}. \endproof


\begin{thdef} \label{KillExtTh}
\index{extrema killer (definition)} One can associate with $\setT_a$  a ``maxima killer'', defined on all  continuous periodic functions $u \in L_C$. This operator $T_a$ is defined by the threshold decomposition principle,
$$ T_a u(\fxx) = \sup \{ \lambda, \fxx \in \setT_a(\levelset_\lambda u) \},$$
we also have
\fb& \label{KillExtDef} \levelset(T_a u) = \setT_a(\levelset u) \fe&
and, as a consequence, no connected maximum set of $T_au$ has area less than $a$.
In addition, $T_a u$ is continuous. 
\end{thdef}

\paragraph{Proof}
By Theorem \ref{3.5bis}  and Lemma \ref{KillExtupperC}, we deduce immediately the announced
commutation (\ref {KillExtDef}).   Let us check that $T_a u $ is continuous. 
Since $u$ is continuous and periodic, it is uniformly continuous. We can use the result of 
the (easy) exercise \ref{preserveuniformecontinuite}, whose proof mimics the proof of 
Lemma \ref{Lips1}.  Since $T_a$ is monotone and translation invariant, $T_au$ also is continuous.
(And, by Lemma \ref{Lips1}, if $u$ is Lipschitz, so is $T_au$, with the same Lipschitz constant.)
\endproof


%First of all, by (\ref{KillExtDef}) we know that all 
%upper level sets of $T_au$ are closed. Let us 
%show that so are the lower level sets,
%$\{ \fxx, T_a u(\fxx) \leq \lambda \}$.\newline
%We notice that by (\ref{KillExtDef}),
%$$\{\fxx, T_a u(\fxx) \leq \lambda \} =
% \{\fxx, u(\fxx) \leq \lambda \} \cup 
%(\bigcup_{meas(cc\{x, u(\fxx) \geq \lambda\})<a} cc\{x, u(\fxx) 
%\geq \lambda\}) =
%Y_0 \cup( \bigcup_{i \in I} Y_i) $$
%Consider a sequence $(\fxx_n)_{n\in\natural}$ in 
%$\{\fxx, T_au(\fxx)\leq\lambda\}$ which tends to 
%a limit $\fxx$.  We want to show that $\fxx$ stays in the same lower level set.
%We have the following alternative:
%Either there exists a finite $J$ subset of 
%$I \cup \{ 0 \}$ such that all $\fxx_n$ belong to 
%$\bigcup_{i \in J} Y_i$. Then obviously $\fxx$ belongs to this
%closed set and therefore to  $\{\fxx, T_au(\fxx)\leq\lambda\}$.
%Otherwise, we can assert, up to the extraction of 
%a subsequence, that $\fxx_n \in Y_{i_n}$, all $i_n$ 
%being distinct. The domain being bounded,   
%$\sum_n meas(Y_{i_n}) < \infty$ and we have 
%$meas(Y_{i_n}) \rightarrow 0$.  Thus we can find points 
%$\fxz_n$ in the  boundaries of $Y_{i_n}$ such 
%that $|\fxy_n - \fxz_n|  \rightarrow 0$. 
%Since $u(\fxz_n)= \lambda$ and since $u$ is continuous, we %finally have 
%$u(\fxx) = \lim_n u(\fxz_n) = \lambda$. Thus 
%$\fxx \in \{\fxy, u(\fxy) \leq \lambda \}$, which ends %the proof. 
%\endproof

We have defined a ``maxima killer'' and we could define in the same way a ``minima killer''. A faster way to define  it is to simply set 
$$T_a^- u = - T_a(-u)$$
A good denoiser can be obtained by  alternating $T_a$ and $T_a^-$. This alternance is licit since each one of both extrema killers  maintains the continuity of the image. Note, however,  that $T_a$ and $T_a^-$ do not necessarily commute as is shown by the next exercise.

\begin{Exercice}
Take $N=1$, $u(x) =\sin ( x).$  Let $a\in \real^+$.  Compute $T_au$ and $T_a^-u$ and show that they commute on $u$ if $a\leq \pi$ and do not commute if $a>\pi$.  Following the same kind of idea, construct an example in dimension 2
of function $u(x,y)$ such that $T_aT_a^-u\neq T_a^-T_au.$
\end{Exercice}
\begin{remark}
The operators $T_a$ do not constitute a scale-space in the sense which we will consider 
in Chapter \ref{Scalespace}. In particular, they do not satisfy a local comparison principle. 
See Exercise \ref{extremakilleretscalespace}.
\end{remark}

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

\zbibnote

Image operators commuting with thresholds have been very popular 
because of their simplicity of implementation on VLSI, which led to very 
simple patents in image or signal processing as late as 1987 \cite{Coyle:1987:DFT}.
  These operators have received four
different but equivalent names : "stack filters" \cite{Wendt:1985:SFT,Wendt:1986:SF,Hardie:1994:RCR,Butz:1986:CRO}, "threshold decomposition" \cite{Hereford:1988:NOI}, 
"rank filters" \cite{Wilburn:1998:DGR, Chen:1996:ODR, Kim:1986:RAP}  and 
"order filters" \cite{Tagare:1985:OF}.  The most famous such operators are the sup, inf and  
median operators.  The implementation of the last one has received a lot of attention because of his remarkable
denoising properties \cite{Fitch:1984:MFT, Yli-Harja:1991:APM, Ochoa:1987:OMF}.
  
The papers by Maragos and Shafer \cite{Maragos:1987:MFPa, Maragos:1987:MFPb}
 and Maragos and Ziff \cite{Maragos:1990:TSM}introduce the functional notation
in the debate  and establish the link  between stack filters and the Matheron formalism
in "flat" mathematical morphology.  Actually, Maragos and his collaborators prove the equivalence
between stack filters and operators commuting with thresholds.  
The full equivalence between contrast invariant operators and stack filters, proved 
in this chapter, does not seem
instead to be classical and we cannot give any other reference than the present book.
A related classification of rank filters with beautiful and useful generalizations to 
the so-called  "neighborhood filters"
can be found in \cite{Kim:1986:RAP}.

The extrema killer is probably the most efficient  denoising filter for images degraded
by impulse noise (small spots).  In spite of its simplicity, it is a recent filter, probably
because it involved nontrivial computations : the search of connected components of 
upper and lower level sets. A first attempt seems to be \cite{Cheng:1992:AMF}.  The filter
in its generality was defined in Vicent \cite{Vincent:1993:GAO}. Its definition fits 
in the general theory of connected filters developped by Salembier and Serra
\cite{Salembier:1995:FZF}. Simon Masnou \cite{Masnou:1998:IRI} defined a variant which is invariant
by contrast as well as by reverse contrast changes (the so-called "grain filter").
Monasse and Guichard developped  a fast
 implementation of this filter based on the so called  "fast level set transform"
 \cite{MnsseGchrd3}. 




\chapter{Monotone contrast invariant operators as sup-inf operators.\label{chapter6}}


In this chapter, we mainly state  two theorems which give an analytic form to
set monotone operators and to contrast invariant and monotone operators. Before
starting with the statements, let us introduce a further useful invariance property. In
practice, image analysis operators are translation invariant.
 
 \begin{Defi} \label{deftranslation} \index{translation (of a set, of a function)}
 We denote by $\tau_{\fxx} X
=\fxx + X$ the result of an 
$\fxx$-translation.  We also consider translations of a function $u$, which we define by
$(\tau_{\fxx}) u(\fxy) = u(\fxy-\fxx)$. 
\end{Defi}

\begin{Exercice}
Show that the  definitions of translations of sets and functions 
 made in Definition \ref{deftranslation}  are made in such a way that 
$$ \tau_{\fxx} (\levelset_\lambda u)= \levelset_\lambda (\tau_{\fxx} u). $$
\end{Exercice}

\begin{Defi}
\index{operator!translation invariance} \index{translation invariance}
\label{invariancepartranslation}
We say that a set operator $\setT $ is translation
invariant if 
$$\tau_{\fxx} (\setT (X)) = \setT (\tau_{\fxx} X).$$
We say that a function operator $T$ is translation invariant if
$$\tau_{\fxx} (T(u))= T(\tau_{\fxx} u).$$
\end{Defi}


\section{\label{Matherontheorem} Monotone set operators.}

\begin{th1}{\bf (Matheron)}
\label{Matheronensembles} \index{$\setB$} \index{Matheron operators}
Let $\setT $ be a translation invariant monotone operator acting on a set of subsets of 
$\real^N$.  Then, there exists a family of sets $\setB \subset {\cal P}(\real^N)$,
 which can be
defined as $\setB = \{ X, 0 \in \setT (X) \}$, such that
\fb&
 \setT (X) = \bigcup_{ B \in \setB}\bigcap_{\fxy \in B}(X-\fxy)  = \{\fxx,\; \exists B\in
\setB,\; \fxx+B \subset X\}.
\label{xi.3}
%§\quad label xi.3 
\fe&
 Conversely, (\ref{xi.3}) defines a monotone, translation invariant operator on ${\cal
P}(\real^N)$.
\end{th1}

\paragraph{Proof}
Let us first explain Formula (\ref{xi.3}).
In fact,
\fb&
 \setT (X) = \bigcup_{ B \in \setB}\bigcap_{\fxy \in B}(X-\fxy)  = 
\{\fxx,\; \exists B\in
\setB,\; \forall \fxy \in B, \fxx\in X-\fxy\}\fe&
This last set is obviously equal to
$\{\fxx,\; \exists B\in
\setB,\; \fxx+B \subset X\}.$

  Using the monotonicity and the translation invariance, we have
the following chain of equivalent properties :
$$\fxx\in \setT (X)\equi& 0\in \setT (X)-\fxx\equi& 0\in \setT (X-\fxx)\equi& X-\fxx \in \setB\equi&
\exists B \in \setB, \; X=\fxx + B\equi&
$$
$$ \exists B\in \setB, \; \fxx + B\subset X
\equi& \exists B \in \setB, \; \forall \fxy \in B, \fxx \in X-\fxy .$$
The fifth equivalence comes from the obvious remark that  if $B \subset X$ and
$B \in \setB$ then
$X \in \setB$.
Thus $\setT (X)=\bigcup_{B\in \setB}\bigcap_{\fxy \in B}(X-\fxy)$ and Relation 
(\ref{xi.3}) holds.
 Conversely, if an operator is 
defined by (\ref{xi.3}), it is obviously monotone and translation invariant.
\enddemo
\begin{Exercice} 
Show that the set $\setB$ is not uniquely associated with $\setT$. Among those $\setB$ 
which are associated with $\setT$, prove that there exists  at least one with the following
properties  : 
\newline  (i) if $B, B' \in \setB$, then $B$ does not contain $B'$ and $B'$ does not contain $B$.
 \newline (ii)  $\setB$ is minimal for inclusion, i.e. 
  does not contain another smaller $\setB'$ also associated with $\setT$.
\end{Exercice}

\section{Sup-inf operators \label{sup-infoperators}}

\begin{th1} \index{operator!``supinf''} \index{supinf operator} \index{Matheron theorem}
\label{xi.1}
Let $\cal F$ a set of functions, $\cal T$ the set of all level sets of functions
of $\cal F$.  Assume  that $\cal F$ is stable under contrast changes and contains
the characteristic functions $\indic_X$ of elements of $\cal T$.
Let  $\setT$ be the set operator associated with $T$, $\setT(X)=\levelset_1(T(\indic_X))$.
Define for any
$\fxx\in
\real^N$ the family of sets $\setB_{\fxx} = \{ X, \fxx \in \setT(X) \}$. Then for every
$u$ in $\cal F$,
 \fb& 
\label{formesupinfenx} 
Tu(\fxx) = \sup_{B\in \setB_{\fxx}}\inf_{\fxy\in B} u(\fxy), \; \hbox{a.e. in } \fxx
\fe& 
If, in addition, $T$ is translation invariant, then setting $\setB=\setB_0=\{X, 0\in
\setT(X)\}$  we have
 \fb& 
Tu(\fxx) = \sup_{B\in \fxx+\setB}\inf_{\fxy\in B} u(\fxy), \hbox{ a.e. in } \fxx
\label{formesupinf}
\fe& 
Conversely, if an operator is defined by (\ref{formesupinf}) or (\ref{formesupinfenx}), then it is monotone and  contrast invariant, and is translation invariant in the first case. 
\end{th1}

\begin{Remark} \index{set of structuring elements $\setB$}
The set $\setB$ is called in Mathematical Morphology {\rm set of structuring
elements}.  It corresponds to an ``impulse response'' of the nonlinear operator
$T$.
\end{Remark}



\paragraph{Proof of Theorem \ref{xi.1}.}
 Set $\tilde Tu(\fxx) = \sup_{B\in \setB_{\fxx}}\inf_{\fxy\in B} u(\fxy)$, where
 $\setB_{\fxx} = \{ X, \fxx
\in \setT(X)\}$.  Let us show that 
 $\tilde Tu(\fxx) = Tu(\fxx)$ almost everywhere.
We argue as in Lemma \ref{ensemblesdeniveaumodifiespresquepartout} :
We choose a countable dense  set $\Lambda\subset \real$ such that for every
$\lambda\in\Lambda$, $\levelset_\lambda Tu(\fxx)=\setT(\levelset_\lambda u)(\fxx)$ for
$\fxx\in\real^N\setminus N_\lambda$, where $\meas(N_\lambda)=0$. We set 
$N=\bigcup_\lambda N_\lambda$ and we  still have $\meas(N)=0$.  In order to prove 
that $Tu=\tilde Tu$ almost everywhere,  we show that for all $\lambda\in \Lambda$ and 
all $\fxx\in \real^N\setminus N$, we have 
$$\tilde Tu(\fxx)\geq\lambda \Leftrightarrow Tu(\fxx)\geq \lambda.$$
and we apply Lemma \ref{ensemblesdeniveaumodifiespresquepartout}. 
In what follows, $\lambda$ and $\mu$ denote elements of $\Lambda.$
We have
$$
Tu(\fxx) \geq \lambda 
\equi& 
\forall \mu<\lambda,\; Tu(\fxx)\geq \mu
\equi&
\forall \mu<\lambda,\; \fxx \in \levelset_{\mu}(Tu) 
\equi&
\forall \mu<\lambda,\;\fxx 
\in \setT(\levelset_{\mu}u)
$$
$$ 
\equi& 
\forall \mu<\lambda,\;\levelset_{\mu} u \in \setB_{\fxx}\equi& 
\forall \mu<\lambda,\;\exists B (=\levelset_{\mu} u)
\in \setB_{\fxx}, \inf_{\fxy \in B} u(\fxy) \geq \mu
$$
$$
\equi& \sup_{B \in \setB_{\fxx}} \inf_{\fxy\in B}u(\fxy) \geq \lambda
 \equi& \tilde T u (\fxx) \geq \lambda.
$$
The fifth equivalence is true because if $B \subset X$ and $B \in \setB_{\fxx}$, then
$X \in \setB_{\fxx}$. Thus, if for some $B\in \setB_{\fxx},\; \inf_{\fxy \in B} u(\fxy)
\geq
\mu $,  then the  set $\levelset_{\mu}u$ contains $B$ and
therefore also belongs to 
$\setB_{\fxx}$.
We conclude that $\tilde Tu(\fxx)= Tu(\fxx)$ almost everywhere. 
If, 
in addition, $T$ is translation invariant, we obviously have 
$\setB_{\fxx}=\fxx+\setB_0$.  By the preceding result, we obtain
$ 
Tu(\fxx) = \sup_{B\in \fxx+\setB}\inf_{\fxy\in B} u(\fxy)
$ almost everywhere,
which is (\ref{formesupinf}).

Let us now show the converse statement of the theorem.  If $T$ is a ``sup-inf'' operator, the monotonicity of $T$ is obvious and
the commutation of $T$ with
continuous nondecreasing functions follows from the fact that if $g$
is continuous nondecreasing and $I$ a subset of $\real$, then $g(\inf I) = \inf
g(I)$ and $\sup g(I) = g(\sup I)$. The translation invariance is easily checked.
\endproof

 
\begin{cor} \label{exerciceutile}
Let $T$ and $\setT$ be translation invariant  function and  set operators such that
\fb& \levelset_\lambda T(u) = \setT(\levelset_\lambda u) \label{exercicepp}, \fe&
the relation being true for every  $\lambda$ and $\fxx$.
A  simplified version of the proof of Theorem \ref{xi.1} shows  that for all
$u \in \cal F$ and $\fxx$,
$ 
Tu(\fxx) = \sup_{B\in \fxx+\setB}\inf_{\fxy\in B} u(\fxy),
$
the relation being true everywhere.
\end{cor}

It will be useful to state a converse statement to Theorem \ref{xi.1}. It states that given a $sup-inf$ operator, we can keep the same set of structuring elements for its associated set operator $\setT$.
\begin{pro}\label{samesetofstructuringelements}
Let $\cal F$ be a set of functions containing
the characteristic functions of sets belonging to $\cal T$ and $T$ a function operator having a sup-inf form 
(\ref{formesupinfenx}), namely
$$
Tu(\fxx) = \sup_{B\in \fxx+\setB}\inf_{\fxy\in B} u(\fxy).
$$
Then its associated set operator $\setT$ can be defined by (\ref{xi.3}), that is
$$
 \setT (X) = \bigcup_{ B \in \setB}\bigcap_{\fxy \in B}(X-\fxy)  = \{\fxx,\; \exists B\in
\setB,\; \fxx+B \subset X\}.
$$
\end{pro}

\paragraph{Proof}
Notice that $T$, satisfying (\ref{formesupinf}), is extended to all level sets of
functions of 
$\cal F$.  It is easy to deduce
(\ref{xi.3}) from (\ref{formesupinf})~: We apply this relation  to the
characteristic function of $X$,
$\indic_X$. Then,
$$
 \begin{array}{rl} \inf_{\fxy \in \fxx+ B} \indic_X & = 0 \hbox{ if
} \fxx + B \not\subset X \\ & = 1 \hbox{ if } \fxx+ B \subset X.
\end{array}
$$
Thus $\supinf& \indic_X (\fxy) =1$ if and only if there is $B$ in $\setB$
such that $\fxx+B \subset X$ and (\ref{xi.3}) follows.
\enddemo

\begin{Exercice}
Apply Corollary  \ref{exerciceutile} to the extrema killer $T_a$ and deduce its canonically associated structuring set
$\setB$. Show  that another  set of structuring elements for $T_a$ can be 
$$\setB_1=\{B\subset \real^N, \hbox{ compact, connected,  } \meas(B)>a\}.$$
Indication : show that if $\setB$ is a set of structuring elements defining an operator $T$ and
if $\setB_1$ is another structuring set satisfying 
\newline
$\bullet$  $\setB_1\subset \setB$ and
\newline
$\bullet$  for every $B\in \setB$, there is $B_1\in \setB_1$ such that 
$B_1\subset B$,
then $\setB_1$ defines the same operator $T$.
\end{Exercice}


\begin{Exercice} \label{xiii.1}
It is not true that the sup-inf forms (\ref{formesupinfenx}) or (\ref{formesupinf}) define in
general an operator commuting with all thresholds $\levelset_\lambda$. This
needs some restriction, either on $\setB$, or on the domain of
definition of $T$. As an easy counterexample, let us set 
$\setB = \{ \{\fxx\}, \fxx \in D(0,1)\}$ where $D(0,1)$ is the ball
with center 0 and radius 1 and therefore $Tu(\fxx) = \sup_{\fyx \in
\fxx+D} u(\fxy)$.
We consider a dense sequence of $\real^N$, $(q_n)_{n \in \entier}$
and we set $u(\fxx) = 1 - 1/n$ if $\fxx = q_n$ for some $n$, $u(\fxx) = 0$
otherwise.  Show that
$T(\levelset_1u)=0\!\!\!/ \neq \levelset_1Tu = \real^N$.
We shall see  in Exercise \ref{x.1} that $T$,  which we define later on
as a ``dilation", yields an operator commuting with all thresholds when it is restricted to
u.s.c. functions.
\end{Exercice}

\begin{Exercice} . \label{x.1}
%§\quad label x.1
 
A first classical example for $\cal F$ is
the set of all upper semi-continuous (u.s.c.) functions, that is, functions which
satisfy at every $\fxx$, 
$$u(\fxx) \geq \lim\sup_{\fxy\to\fxx} u(\fxy).$$
\index{upper semi-continuous function (u.s.c.)}
 Check that
$\cal T$ is the set of all closed subsets of $\real^N$. A classical
 operator on this set is the so-called dilation, 
$T_r u(\fxx) = \sup_{D(\fxx,r)} u(\fxy)$. Show that it corresponds to the set operator 
$\setT X = \{ \fxx, d(\fxx, X) \leq r \} = X^r$.
\end{Exercice}


The  Matheron-Maragos theorem \ref{xi.1} and its ``everywhere'' version (Corollary  \ref{exerciceutile}) yield a $\sup\inf$ formulation to contrast
invariant operators.  It is easy to deduce that those operators also have 
  an  $\inf\sup$ form. (See also Exercise \ref{supinfversinfsup})

\begin{pro}\label{matheroninfsup}
Let $T$ be a $\sup\inf$ operator 
$Tu(\fxx) = \sup_{B\in\setB}\inf_{\fxy\in \fxx+ B} u(\fxy)$. 
Then it also has an $\inf\sup$ form for a new structuring set $\setB'$ 
\fb& 
Tu(\fxx) = \inf_{B\in \setB'}\sup_{\fxy\in \fxx+B} u(\fxy).
\label{formeinfsup}
\fe&
\end{pro}

\paragraph{Proof} 
This follows from elementary Boolean algebra.
Let us call `` selection function'' any map  $\phi: \setB \rightarrow \bigcup_{B \in \setB} B$ 
such that $\forall B,\; \phi(B) \in B$. Let us call ${\cal S}_{\setB}$ the set of all selection functions. We
then have
$$\sup_{B \in \SetB} \inf_{\fxy \in B} u(\fxy) = 
\inf_{\phi \in {\cal S}_{\setB}} \sup_{B \in \setB} u(\phi(B))$$
$$= \inf_{\phi \in {\cal S}_{\setB}} \sup_{\fxy \in \phi(\setB)} u(\fxy)$$
Let us note {\bf D}$=\{ \phi(\setB), \phi \in {\cal S}_{\setB} \}$.  We obtain
$$\sup_{B \in \SetB} \inf_{\fxy \in B} u(\fxy) = \inf_{\phi(\setB) \in \hbox{\bf D}} \sup_{\fxy \in \phi(\setB)} u(\fxy)$$
which indeed is an inf-sup operator. Of course the 
structuring set 
{\bf D} thus obtained for the $\inf \sup$ form is not  the same as in the 
$\sup \inf $ form !
\endproof
\begin{Exercice} \label{supinfversinfsup} \index{inf-sup form of sup-inf operators}
The result of Proposition \ref{matheroninfsup} can be deduced in a slightly weaker form
from Theorem \ref{xi.1}.  By applying this theorem to $-T(-u)$, show that if 
\end{Exercice}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{From contrast invariant function operators to set operators~: the Evans-Spruck
extension  \label{TheEvansSpruckSection} } 

In this section, we consider monotone contrast invariant function operators $T$ which are only defined on a set of 
continuous functions.  Thus, we cannot associate with them a set operator by the 
formerly used formula, $\setT(X)=T( \levelset_1(\indic_X))$.  Indeed, $T$ is no longer defined
on characteristic functions of sets !  We shall see, however, that we can associate 
with $T$ a set operator $\setT$ in such a way that $\levelset_\lambda (Tu)=\setT(\levelset_\lambda u)$ for all $\lambda.$
The method, introduced by 
Osher and Sethian, has shown to be very powerful  in the  numerical analysis of front propagation.
 We shall need a slightly restrictive assumption, that all level sets of the processed functions
$u$ are compact.  In image analysis, images
are anyway defined in a compact set $C$ (in general a square, a rectangle, a cube, etc.) so that
 this compactness assumption is no real restriction.
 Thus, in the following, we consider a space of bounded
continuous functions $\cal F$ defined on a compact set C.  The level
sets of functions in
$\cal F$ are compact and we can always assume that functions in $\cal F$ are defined in
all of $\real^N$~: we just make a continuous extension of  $u$ preserving
compactness of level sets. 
A standard way to do that is the periodization proposed in Section \ref{Heat}, in which
case the level sets become periodic sets and remain compact provided we endow them with
the natural periodic topology.

 Let us now explain the Osher-Sethian method.  Let
$X$ be a compact subset of $\real^N$ and let us associate with $X$  a continuous bounded
function
$u(\fxx)$  such that $X$ be its zero level set~:
\fb&
\label {passagefonctionensemble}
%§ label passagefonctionensemble\;
X = \{\fxx, \; u(\fxx)
\geq 0\} = \levelset_0u
\fe&
 Using a distance function to $X$, that is 
$d(\fxx, X)=\inf\{|\fxx-\fxy|,
\fxy\in X\}$, we can easily build many such functions, as for example $u(\fxx) = - \min(1,
d(\fxx, X))$.  We can define
$\setT (X)$, by using (\ref{passagefonctionensemble}), in the following way.


\begin{lem} {\bf and definition (Evans-Spruck).} \index{Evans Spruck extension} 
\label{ES1} 
Let ${\cal F}\subset C^0(\real^N)$ be a set of real continuous functions.  Assume that
all level sets
 of all functions of $\cal F$  are compact. Let
$T$ be a
monotone and  contrast invariant operator defined on ${\cal F}$.   Let $X$ be any compact
set of $\real^N$  and $u\in \cal F$ any  continuous function having $X$ as zero level set~:
$X=\{\fxx, u(\fxx) \geq 0\}=\levelset_0u$.  Define
\fb&
\label{passagefonctionensemblepourT}
%§ label passagefonctionensemblepourT\quad
\setT (X) = \{\fxx, Tu(\fxx)\geq 0\}= \levelset_0(Tu).
\fe& 
Then the set $\setT (X)$  does not depend upon the particular choice of $u$.
\end{lem}

\begin{cor}\label{contrasteinvarianceparEvans-Spruck}
Let ${\cal F}\subset C^0(\real^N)$ be a set of real continuous functions.  Assume that the
level sets
 of functions of $\cal F$  are compact. Let
$T$ be a
monotone and contrast invariant operator defined on ${\cal F}$, then the set operator  $\setT$ defined by (\ref{passagefonctionensemblepourT}) satisfies
$$\setT(\levelset_\lambda u) = \levelset_\lambda(Tu)$$
\end{cor}


\paragraph{Proof}
We can rewrite Relation (\ref{passagefonctionensemblepourT}) as 
$$\setT(\levelset_0u)=\levelset_0(Tu)$$
and, replacing $u$ by $u-\lambda$ and using  that $T(u-\lambda)=Tu-\lambda$, we in fact
have 
\fb& \label{toutmarchebien}
\setT(\levelset_\lambda u) = \levelset_\lambda(Tu)
\fe&
for every continuous  bounded function with compact level sets.
\enddemo

\begin{rem} If $u \geq 0$, then $Tu \geq 0$. Indeed, by commutation with the function $g(x) =0, \forall x$, we have $T(0)=0$ and by monotonicity, we obtain $Tu \geq 0$.
\end{rem}


\begin{rem}
Without the compactness assumption on $X$, the result of Lemma \ref {ES1} can be false.
Take for instance $X=\emptyset$. 
Define $\cal F$ $=C^0(\real^N)$ and $Tu(\fxx) = \sup_{\real^N}u(\fxx).$ Take e.g. 
$v(\fxx) = -1$.  Then $ \levelset_0 v= \emptyset$ and $\levelset_0(Tv) = \emptyset$.
On the other side,  choosing $u(\fxx) = -\frac 1{1+|\fxx|}$ we have $Tu(\fxx) = 0$, so
that 
$\levelset_0u = \emptyset$ and $\levelset_0(Tu) = \real^N $.  Thus Lemma \ref{ES1} does
not work.
\end{rem}
Lemma \ref{ES1} is easily deduced from the following comparison result.

\begin{lem}\label{lemmedecomparaison}
%&label lemmedecomparaison\quad
Let $X$ be a compact set and $u$ and $\tilde u$ two non-positive bounded continuous functions
satisfying
$X=\{\fxx, u(\fxx)\geq 0\} =\{\fxx, \tilde u(\fxx)\geq 0\}.$
Assume that the level sets of $u$ and $\tilde u$ are compact.
Then there exists a continuous nondecreasing function
$\psi~: \real^- \rightarrow \real^-$ such that $\psi(0)=0$  and $u\geq \psi(\tilde u)$.  
\end{lem}
\noindent
{\bf Proof of Lemma \ref{ES1}}
\newline
Our aim is to prove, for all  continuous functions with compact level sets $u$ and $\tilde u$,
\fb& 
\label{tantva}\levelset_0 u=\levelset_0 \tilde u\Rightarrow
\levelset_0(Tu)=\levelset_0(T\tilde u).
\fe&
Consider the  contrast change $g(s)=\max(-1, min(0, u)).$ 
Obviously, for every function $u$,
 $\levelset_0u=\levelset_0 g(u)$ and therefore 
 $\levelset_0 Tu=\levelset_0(g(Tu))=\levelset_0 T(g(u)).$  Thus, we may as well
 prove the implication (\ref{tantva}) for $g(u)$ and $g(\tilde u)$. In other terms,
 we can assume without loss of generality that $u$ and $\tilde u$ are nonnegative and bounded.
 By Lemma \ref{lemmedecomparaison},
 there exists a continuous nondecreasing function $\psi$
such that
$\psi(0)=0$ and $\psi(\tilde u) \leq u$.  Since $T$ is monotone and
contrast invariant,  we deduce that $Tu\geq T(\psi(\tilde u))=\psi(T\tilde u)$. 
Using $\psi(0)=0$, we get $T\tilde u(\fxx)=0\Rightarrow  Tu(\fxx)=0$.
The converse implication is also true by exchanging the roles of $u$ and $\tilde u$ and
we conclude that $\{\fxx, Tu(\fxx) =0 \} = \{\fxx, T\tilde u(\fxx)=0\}$.
\enddemo



%]%?? RAJOUTER UNE FIGURE ICI. ELLE EST DESSINEE DANS MON MANUSCRIT PAGE 96.??



\paragraph {Proof of Lemma \ref{lemmedecomparaison}}
Since the level sets  $\{\fxx, \tilde u(\fxx)\geq r\}, r \leq 0$ are compact, it is tempting to 
simply set
$$\tilde \psi(r)=\min_{\tilde u(\fxx) \geq r } u(\fxx).$$
 By the definition of $\tilde\psi$,
$$u(\fxx) \geq \min_{\tilde u(\fxy)\geq \tilde u(\fxx)}u(\fxy)= \tilde\psi (\tilde u(\fxx)).$$ 
Notice that $\tilde\psi(0)=0$.
Let us show that $\tilde \psi $ is continuous at 0.  Let $r_k\to 0$ be an increasing
sequence  and
$\fxx_k$ such that
$\tilde u(\fxx_k) \geq r_k$ and $\tilde \psi(r_k) = u(\fxx_k)$. Then $\fxx_k$ belongs 
to $\{\fxx, \tilde u(\fxx)\geq r_l\}$ for every $k\geq l$.  By compactness of these
level sets, a subsequence of $\fxx_k$ converges to some $\fxx$ such that $\tilde u(\fxx) \geq
r_l$ for every
$l$. Thus $\tilde u(\fxx) = 0$, $\fxx \in X$ and therefore $u(\fxx)=0$.  We conclude
that
$\tilde\psi(r_k) = u(\fxx_k)\to u(\fxx)=0$, so that $\psi$ is continuous at 0. 
 Thus $\tilde \psi$ matches all requirements of Lemma \ref{lemmedecomparaison} except one~:
it is not always continuous at all points !  This is easily fixed by choosing a continuous
nondecreasing function
$\psi$ such  that $\tilde \psi \geq \psi$ and $\psi(0)=0$.  As an example,
$\psi(r) = \frac{1}{|r|} \int_{2r}^{r}\tilde \psi(s)ds$, for $r<0$ answers the question, so that we finally
have $u(\fxx) \geq \tilde \psi(\tilde u(\fxx) ) \geq \psi (\tilde u(\fxx)).$
 \enddemo
\begin{Exercice}
Show that the function $\psi$ defined in the proof of Lemma \ref{lemmedecomparaison} indeed
is continuous. Find examples of functions $u$ and $\tilde u$ such that $\tilde \psi$ is not
continuous (such examples can be found in dimension $N=1$.)
\end{Exercice}

\begin{cor} (Evans-Spruck extension from periodic functions to periodic sets).
 \index{Evans-Spruck extension for periodic functions and sets} 
\label{ES1periodique} 
Let ${\cal F}\subset L_C\cap C^0(\real^N)$ be a set of real continuous $(2,...,2)$-periodic functions,
i.e. functions satisfying $u(\fxx+\fxz)=u(\fxx)$ whenever $\fxz\in 2\relative^N$.  Let
$T$ be a
monotone and contrast invariant operator defined on ${\cal F}$.
Then there exists a unique set operator $\setT$ defined on (2,...,2) periodic sets
by
\fb& \label{toutmarchebienbis}
\setT(\levelset_\lambda u) = \levelset_\lambda(Tu)
\fe&
\end{cor}

\paragraph{Proof} We proceed exactly as the proof of Lemma \ref{ES1}. Indeed, the level sets
of the considered functions being periodic, we can define their points modulo $\relative^N$,
which ensures compactness of sequences of points in a level set.
Thus, Corollary \ref{contrasteinvarianceparEvans-Spruck} also holds and $T$ and $\setT$ are
associated
 by Relation (\ref{toutmarchebienbis}).
\enddemo

\section{The extension to u.s.c. functions}
Digital images  should in principle be  continuous, by Shannon's digitization theory. 
Now, Shannon's theory does not take into account the quantization of grey levels, which 
gives us only a finite set of level sets of the image (about 255 in all day technology).
If we process each level separately, as is askable if we do contrast invariant processing, 
then we consider {\it de facto} the image as discontinuous along its quantized level lines.
Assume that  we have defined a contrast invariant monotone operator on continuous functions.  We have just proved that such an operator has an extension to compact sets.  It is therefore natural to extend,
by the threshold superposition principle, this operator to upper semicontinuous functions.
This extension will be in practice necessary for digital image processing and we shall 
use it to extend (e.g.) the curvature motion to u.s.c. functions.



\begin{Defi}\label{definitionsemicontinuite}
\index{function!semi-continuous} \index{semicontinuous functions} \index{u.s.c} \index{l.s.c}
We say that a function $u:  \real^N \to \real$ is upper semicontinuous (u.s.c.) if one
of the following equivalent items is true.
\newline (i) the upper level sets $\levelset_\lambda^+ u = \{\fxx, u(\fxx)\geq \lambda\}$ are
all closed.
\newline (ii) at every $\fxx\in \real^N$, $u(\fxx) \geq \lim\sup_{\fxy\to \fxx}u(\fxy)$.
\newline  We say that $u$ is lower semicontinuous (l.s.c.) if $-u$ is u.s.c.
A real function $u$ is continuous if and only if it is both lower and
upper semicontinuous.
\end{Defi}
\begin{Exercice}  \label{u.s.c.atteintsesmax}

Show that the equivalence of (i) and (ii) in Definition \ref{definitionsemicontinuite} is indeed true.  Deduce that every u.s.c.
function attains its maxima and every l.s.c. function attains its minima.

\end{Exercice}

\begin{th1}
\label{extensionapleinementmorpho}
 Let ${\cal F} \subset C^0(\real^N)$ be a set of  continuous functions whose level sets  are
compact (or $(2,...,2)$-periodic) and
$T$ a contrast invariant monotone operator on $\cal F$. Let $\setT$ be 
the set operator associated with $T$ by the Evans-Spruck
method. Then $T$ can be extended into
a monotone contrast invariant operator, defined for all upper semi-continuous functions 
whose level
sets are compact (periodic) and commuting with almost all thresholds :
$$\levelset_\lambda(Tu)=\setT(\levelset_\lambda u), \hbox{ a.e. in }\lambda,
\hbox{  a.e. in  }\fxx.$$
 \newline In the same way, $T$ can be extended into a contrast invariant operator $T^-$,
defined for all lower semi-continuous functions whose lower
level sets are compact (or periodic) and commuting
with almost all lower thresholds $\levelset_\lambda^-$ :
$$\levelset_\lambda^-(T^-u)=\setT(\levelset_\lambda^- u) \hbox{ a.e. in }\lambda,
\hbox{  a.e. in  }\fxx.$$
\end{th1}
\begin{Remark}
 The  extensions $T$ and $T^-$ can be quite different, as shown by the checkerboard
experiment (Figure \ref{damieretextensions}).
\end{Remark}
\PDAMIERAMSS


\paragraph {Proof of Theorem \ref{extensionapleinementmorpho}}
By Corollary  \ref{contrasteinvarianceparEvans-Spruck}, we can define $\setT $ on compact
sets
$X$ in such a way that for any $u \in \cal F$ and $\lambda\in \real$,
\fb& \label{extensionapleine1} \setT (\levelset_\lambda u) = \levelset_\lambda (T(u)) 
\fe&
For any u.s.c function (with compact level sets) $u$ we define $T'$ by
the threshold superposition principle,
\fb& \label{defextensionusc}
T'(u)(\fxx) = \sup\{\lambda, \fxx \in \setT (\levelset_\lambda u) \}. 
\fe&
Let us now prove that $T'(u) = T(u)$ for any continuous function with compact level sets.
This immediately follows from (\ref{extensionapleine1}) and the definition of $T'$:
$$T'(u)(\fxx) = \sup\{\lambda, \fxx \in \setT (\levelset_\lambda u) \}  = \sup\{\lambda,
\fxx \in \levelset_\lambda T(u) \} = T(u).
$$
In addition, it follows immediately from (\ref{defextensionusc}) and 
 Proposition \ref{setoperatortoimageoperatorfaible} that $T'$ is monotone and contrast invariant on the u.s.c
 functions and commutes with almost all 
thresholds,
$\levelset_\lambda(Tu)=\setT(\levelset_\lambda u).$
\newline
%]%DECIDER SI GARDER L'AFFAIRE LSC. EN FAIT, L EXPERIENCE DU CHECKERBOARD PEUT ETRE INTERPRETEE AUTREMENT.
%]%ON A UN OPERATEUR T,  LA MCM, QUI VERIFIE T(u)=-T(-u).  MAIS ON N'A PAS POUR AUTANT $\setT(X^c)
%]%=\setT(X)^c$. IL Y A DONC RUPTURE DE SYMETRIE PAR LA DEFINITION DE EVANS SPRUCK 
%]%NOUVEAU TEXTE POUR LA FIGURE 8.1 :
%]%"The chessboard dilemna. A chessboard can be viewed as a connected union of black squares on a white background, or as a connected union of white squares on black background. The Evans-Spruck extension chooses the second one, in that it selects the white set which corresponds to an upper level set. The figure displays in Image 2 the effect on the chessboard (Image 1) of the Curvature Motion, an operator $T$ satisfying $T(u)=-T(-u)$. Image 3 shows (in white) the image $\setT(\levelset_{128}u)$ of the white set.  (Black is 0, 255 is white, so that $\levelset_{128}u$ is the white set). Image 4 shows the effect of applying instead $\setT$ to the black set, $\levelset^-_{128}u=\{\fxx, u(\fxx)\leq 128\}$. In one case, the white set is treated as connected, in the second case, as diconnected. The effect on the chessboard image is dramatically different and results from a symmetry breaking in the definition of $\setT$."

\enddemo

\begin{Exercice}
By Theorem \ref{3.5bis}, $T'$ is contrast invariant on the u.s.c. 
functions if and only if $\setT$ is upper semicontinuous.  It is easily seen (see Exercise 
\ref{continuitediscretecontinue}) that this
is true if and only if $\setT$  satisfies, for every nonincreasing family of compact
sets $X_\lambda$, the implication
 $$
(X_\lambda = \bigcap_{\mu < \lambda} X_\mu) \Rightarrow (\setT(X_\lambda) = \bigcap_{\mu <
\lambda} \setT(X_\mu)).
$$ 
Let us set $u(\fxx) = \sup \{\lambda, \fxx \in X_\lambda \}$ and assume that
$u$ is continuous.  Then we obtain
$$ \setT (X_\lambda) = \setT (\levelset_\lambda u) = \levelset_\lambda T(u) = 
\bigcap_{\mu<\lambda} \levelset_\mu T(u)= \bigcap_{\mu<\lambda}  \setT (\levelset_\mu u) =
\bigcap_{\mu<\lambda} \setT (X_\mu).$$
Now, $u$ may well be discontinuous. In order to extend the preceding argument, we set,
for some fixed $\lambda$ and $\mu\leq \lambda$,
$$Y_\mu = \{\fxx, \; dist(\fxx, X_\mu)\leq \lambda-\mu\}.$$
Consider the
function $v$ defined by
$ v(\fxx) = \sup \{\mu, \fxx \in Y_\mu \}.$ Let us show that
$v$ is a Lipschitz function and therefore continuous. For any $\fxx_0$ and $\fxy_0$ such
that $v(\fxy_0) > v(\fxx_0)$, we have
$ \fxy_0 \in Y_{u(\fxy_0)}$ and $\fxx_0 \nin Y_{(v(\fxy_0)+v(\fxx_0))/2} $.
Thus, by the definition of $Y_\mu$ again, $$\fxx_0 \nin \{ \fxx, \exists \fxy \in
B(\fxx,   (v(\fxy_0)-v(\fxx_0))/2),
\; u(\fxy) \geq (v(\fxy_0)+v(\fxx_0))/2 \}
$$ 
This implies that 
$$dist(\fxx_0,
Y_{u(\fxy_0)}) \geq  (v(\fxy_0)-v(\fxx_0))/2
$$ and therefore
$$
|\fxx_0 - \fxy_0 | \geq \frac{1}{2} |v(\fxy_0)-v(\fxx_0) |.
 $$
Thus $v$ is continuous and we obtain $$ \setT (Y_\lambda) = \bigcap_{\mu<\lambda} \setT
(Y_\mu).$$ Now, $\forall \mu \leq \lambda$, $X_\mu \subset Y_\mu$, and by the
monotonicity of
$\setT $ on  compact sets, $\setT (X_\mu) \subset \setT (Y_\mu)$. We then have
$$
\bigcap_{\mu<\lambda} \setT (X_\mu) \subset \bigcap_{\mu<\lambda} \setT (Y_\mu) = \setT
(Y_\lambda) = \setT (X_\lambda).
$$
Conversely, $\setT (X_\lambda) \subset
\bigcap_{\mu<\lambda} \setT (X_\mu) $ by monotonicity of $\setT $.
We conclude that $T'$ is contrast invariant on the
u.s.c function with compact level sets. $T'$ also is monotone by the monotonicity of
$\setT
$.
 \end{Exercice}

\begin{Remark} {\bf $\setB$ may change with the extension !}
 Let us start with a set of structuring elements $\setB$ and its associated
operator $$Tu(\fxx) =\inf_{B\in\setB}\sup_{\fxy\in B}  u(\fxx+\fxy).$$ 
Then $T$ is   contrast invariant and can receive the contrast invariant extension of
Theorem \ref{extensionapleinementmorpho}.  Now, contrast invariant operators have an
$\inf\sup$ form, so that we can assert the existence of a set $\setB'$ such that
 $$Tu(\fxx) =\inf_{B\in\setB'}\sup_{\fxy\in B}  u(\fxx+\fxy).$$ 
It is easily seen that $\setB'$ must be in some cases different from $\setB$. As an example, 
if $Tu(\fxx) = \sup_{\fxy \in B(0,1)}u(\fxx+\fxy)$ is a dilation by an open ball $B(0,1)$,
then the extension $T'$ to u.s.c. functions is associated with (e.g.)
$\setB'= \{\overline{B}(0,1)\}$, the closure of the ball. The original $\setB$ cannot work,
since $T'$ must transform a closed level set into a closed level set, while the dilation by an
open ball transforms any set into an open set.
\end{Remark}



\section{The who's who of monotone and contrast invariant operators.}

Let us summarize what we have proved in the preceding section.

\noindent{\bf First case : $\cal F$ is a set of functions whose level sets are $\cal T$ and
$\cal F$ contains all characteristic functions of elements of $\cal T$.}
\newline\newline
 Consider monotone
set operators $\setT$ (with $T(\emptyset)=\emptyset$, $T(\real^N)=\real^N$) and monotone contrast invariant function operators $T$.  Then, we can either define $T$ from $\setT$, by the threshold superposition principle,
\fb&
 \label{11} Tu(\fxx)=\sup\{\lambda, \; \fxx\in \setT(\levelset_\lambda u)\}
\fe&
 or define $\setT$ from $T$, provided the domain $\cal F$ of $T$ contains the characteristic functions,
by thresholding :
\fb& \label{22} \setT(X)=\levelset_1(T(\indic_X)).\fe&
  The relation between $T$ and $\setT$ is also characterized  by the commutation with thresholds,
\fb& \label{33} \setT(\levelset_\lambda u)=\levelset_\lambda(Tu).
\fe&
This  relation being true almost everywhere in $\lambda$ and $\fxx$.
Every contrast invariant operator $T$ has  a $\sup \inf$ formulation,
\fb& \label{44} Tu(\fxx)=\sup_{B\in {\setB}_\fxx}\inf_{\fxy \in B}u(\fxy).
\fe&
 where 
$\setB$ is defined from $\setT$ by the ``impulse response'' formula,
\fb& \label{55}
\setB=\{ B, \; 0 \in T(B)\}.
\fe&
For the same $\setB$, we also have, by Proposition \ref{samesetofstructuringelements}, the analytic form
 (\ref{xi.3}), that is
$$
 \setT (X) = \bigcup_{ B \in \setB}\bigcap_{\fxy \in B}(X-\fxy).
$$
We can summarize the full equivalences proved in one sentence.
\newline\newline
{\it It is equivalent to define : a set monotone operator $\setT$ with $\setT(\emptyset)=\emptyset$,
a contrast invariant operator $T$ or an $\inf\sup$ operator.  Each one of the forms of  the operator
is deduced from each other one with the help of Formulas  (\ref{11}-\ref{55}) above.}
This equivalence between the three modes of definition is summarized in the first column of Figure \ref{graphedesoperateursmonotones}.  It is sometimes easier and more intuitive to define an image operator as a set operator: we have seen or shall see several examples : the ``extrema killer'', the median 
filter and the classical mathematical morphology operators (erosions, dilations, etc.). 
\newline\newline
{\bf The case of contrast invariant operators defined on a set of continous functions. }

 Now, 
we shall also have cases, namely the case of solutions of partial differential equations, 
where the operator is much easier to define as an operator on a set of continuous functions.  This
will be the case for the solutions of the curvature motion and the affine morphological 
scale space.  In such cases, the Evans-Spruck method applies and we directly define
an extension of the operator $T$ as a compact set operator by
Relation (\ref{33}), the relation being then true everywhere (for all $\lambda$ and all $\fxx$).
Then, the operator $T$ receives an extension $\tilde T$ to upper semicontinuous functions, which
still satisfies (\ref{33}).  In one sentence,
\newline\newline
{\it Given a contrast invariant operator $T$ defined on continuous functions,  we can define
an extension $\tilde T$ which satisfies all of equivalence properties of the first column of
Figure \ref{graphedesoperateursmonotones}. }
This situation is again summarized in the second and third column of the mentionned figure : 
from the contrast invariance on continuous functions, we go up to define a set operator 
on compact sets by thresholding and then a function operator on u.s.c. functions.

\begin{figure}
{\small
\begin{center}
\begin{tabular}{ccccc}
{\tt (1)} {\bf $\setT$ monotone, $\setT (X) = \bigcup_{ B \in \setB}\bigcap_{\fxy \in B}(X-\fxy).$
 } & & & & \\
$\Uparrow$ & & & & \\
$\setT (\levelset_\lambda u) = \levelset_\lambda( Tu)$ a.e. in $\lambda$ and $\fxx$ & & & &\\
$\Downarrow$ & & & &\\
 & & $\levelset_\lambda \tilde T u = \setT(\levelset_\lambda u)$ & & \\
{\tt (2)} {\bf $T$ monotone contrast invariant} & $\Longleftarrow$ & for $u$ u.c.s  & = &{\tt (5)} {\bf $\setT$ defined on compact sets} \\
& & $\tilde T = T$ for all $u \in C^0$ & & \\
$\Uparrow$ & & & &  $\Uparrow$ \\
$\setB = \{ B, 0 \in \setT(B) \}$ & & & & $\setT (\levelset_\lambda u) = \levelset_\lambda( Tu)$ \\ 
$\Downarrow$ & & & &  $\|$ \\
{\tt (3)} {\bf $ Tu = \hbox{\bf sup}_{\setB} \hbox{\bf inf}_B (u)$} & & $\Longrightarrow$ & & {\tt (4)} {\bf $T$  contrast invariant on $C^0$} \\
& &\\
\end{tabular}
\end{center}
}
\caption[Relations between set and function operators]{\Pstyle 
\label{graphedesoperateursmonotones}
 Relations between set and function operators. (All operators are monotone and translation invariant - See text for exact assumptions).
 \newline
\newline
${\tt (1)} \Leftrightarrow {\tt (2)}$: Propositions \ref{Propositionlienoperateurensembleoperateurfonction} and \ref{setoperatortoimageoperatorfaible}, ${\tt (2)} \Rightarrow {\tt (3)}$: Theorems \ref{Matheronensembles} and \ref{xi.1}, ${\tt (3)} \Rightarrow {\tt (4)}$: Theorem \ref{xi.1}, ${\tt (4)} \Rightarrow {\tt (5)}$: Lemma \ref{ES1}, Corollary \ref{contrasteinvarianceparEvans-Spruck}, ${\tt (5)} \Rightarrow {\tt (2)}$: Theorem \ref{extensionapleinementmorpho}.
}
\end{figure}

\begin{Exercice}
Let $T$ and $\setT$ be respectively a contrast invariant monotone operator and a set 
operator such that  for all $\lambda,$
$$\levelset_\lambda(Tu)=\setT(\levelset_\lambda(u)).$$
Show that $\setT$ is upper semicontinuous. Show that $T$ commutes with all u.s.c. nondecreasing
functions $g$, i.e.  $T(g(u))=g(Tu)$.  
\end{Exercice}
\begin{Exercice}
\label{continuitediscretecontinue}
Let $\setT$ be  set operator such that $\setT(\emptyset)=\emptyset$,
$\setT(\real^N)=\real^N$.  Show that $\setT$ is upper semicontinuous if and only if, for 
any family  of sets $(X_\lambda)_{\lambda\in\real}$ such that $X_\lambda=\bigcap_{\mu<\lambda}X_\mu$, one has $\setT(X_\lambda)=\bigcap_{\mu<\lambda}\setT(X_\mu).$               
\end{Exercice}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newpage
\zbibnote


The formalism presented in this chapter is due to Matheron \cite{Matheron:1975:RSI}
in the case of the set operators and to Serra \cite{Serra:1982:IAM} and Maragos \cite{Maragos:1989:RTM} in 
the case of function operators. Actually, the Serra formalism is more general than the one
presented here and 
will be developped in Chapter \ref{chapter14} on "non-flat" morphology.
Maragos proved the sup-inf formula given here for operators commuting with 
thresholds.  Our presentation is original in relating directly the sup-inf form 
to contrast invariance and establishing the full equivalence between sup-inf operators
and contrast invariant monotone operators.  The mysterious "set of structuring elements"
has retained a lot of attention in the literature, where the ways to find the 
right sets of structuring elements \cite{Salembier:1992:SEA, Svalbe:1992:DMF}, or to simplify them,
\cite{Schonfeld:1994:OSE},  or to decompose them into
simpler ones
as one does with linear filters \cite{Park:1995:DAS, Zhuang:1994:DMS, Zhuang:1986:MSE}, or to reduce their 
number \cite{Richardson:1991:LBS}



\chapter{Erosions and dilations \label{chapitreerosion} \label{chapter7}} 
\thispagestyle{empty}

\section{\label{EroDil}Erosions and dilations as multiscale contrast invariant operators}
In this chapter, we study with some detail the simplest operators of mathematical
morphology.  We have seen in the previous chapter that we can associate with every
 contrast invariant and monotone operator an ``inf-sup" or a ``sup-inf" form.    
It is natural to study first the operators whose set of structuring elements, $\setB$, is
a singleton.  In that case, the operators, if they are translation invariant, are simply written as
$$Tu(\fxx) = \sup_{\fxy \in B+\fxx}u(\fxy)\quad \hbox{ or  }\; 
Tu(\fxx) = \inf_{\fxy \in B+\fxx} u(\fxy).$$
In the first case, we call the operator a ``dilation" and in the second one, 
an ``erosion".  These operators can be defined on subsets of $\real^N$ as well.
  Since we do not
wish to be dependent upon a particular choice as for the size of $B$, we shall
introduce a scale parameter $t$ and consider the family of erosions or
dilations by $tB$.

\begin{Defi}
\index{set operators ! dilation ($D_t$)}
\index{set operators ! erosion  ($E_t$)}
\index{set operators ! closing}
\index{set operators ! opening}
\index{structuring element}
Let $B$ be a  subset of $\real^N$.  Let $t \geq 0$ be a scale parameter. 
  We call dilation with structuring element $B$ and  scale $t$ of a
subset $X $ of $\real^N$ the set
\fb&
\label{defdilation}
D_tX = X +tB = \{\fxx+\fxy, \fxx \in X, \; \fxy 
\in  tB\} = \bigcup_{\fxy\in tB}(X+\fxy)
\fe& 
We call erosion with structuring element $B$ and scale $t$ of a set
$X$  the set 
\fb&
\label{deferosion}
E_tX=\{\fxx, \fxx+tB \subset X\}=\bigcap_{\fxy\in -tB} (X+\fxy).
\fe&
\end{Defi}
This definition is made in such a way that $E_t$ and $D_t$ be somehow inverse of each other. This is the case if, e.g., $B=\{\fxx_0\}$ is reduced to a point.  Then $D_t$ is the translation by $t\fxx_0$ and $E_t$ by $-t\fxx_0$.
When $B$ is an open ball centered at 0, we notice that the dilation of $X$
at scale $t$ is nothing but its $t-$neighborhood, the set of points which lie
at a distance less  than $t$ from $X$.  When $B$ is a symmetric set with respect  to 0,  one also defines an operator called
``opening at scale
$t$", by composing
$D_t$ and $E_t$ and a ``closing at scale $t$" operator by $E_tD_t$.  These names have the following origin. If $B$ is (e.g.)  an open ball centered at 0 with radius 1, then
the opening at scale $t$ of a set $X$ is the union of all balls with radius $t$
contained in
$X$. Now, the classical, topological, opening of $X$ is the union of all open balls
contained in $X$.  Thus, the opening at scale $t$ appears as a quantified
opening.  Besides, the classical statement that ``the closing of the complementary
is equal to the complementary of the opening" remains true, as shows the next exercise.

\begin{Exercice} 1) Let $B=B(0, 1)$ the unit open ball. Show that $D_tE_t$ is the union of all  open balls with radius $t$ contained in $X$.
\newline
2) We note $X^c= \real^N\setminus X$. \notation  Show that for any
structuring element $B$, symmetric with respect to 0,  $D_t(X^c) = (E_tX)^c.$

%Solution : $$D_t(X^c) = \{\fxx, \exists \fxy \in X^c, \fxx-\fxy\in B\}.$$
%$$=\{\fxx, \exists \fxy \in X^c, \fxx\in \fxy +B\} = \{\fxx, \exists \fxy \in %X^c,
%\fxx-\fxy\in B\}.$$
%On the other hand, $$E_tX=\{\fxx, \fxx-B\subset X\} = \{\fxx, (\fxx-B)\cap X^c=
%\emptyset\}.$$ Thus $$(E_tX)^c = \{\fxx, \exists \fxy \in X^c, \fxy \in \fxx-%B\}
%=\{\fxx, \exists \fxy \in X^c, \fxx-\fxy \in B\}.$$
\end{Exercice}


\PPLERO
\PPLDIL
\begin{Defi}\index{function operators ! dilation}\index{function operators ! erosion}
 The dilation at scale $t$ with structuring 
element $B$ of a function $u_0$  is defined by

$$
D_tu_0(\xbol ) = \sup_{\ybol \in tB}  u_0(\xbol-\ybol),
$$
Similarly, the erosion at scale $t$ with structuring element $B$ of a function $f$ 
 is defined by

$$
	E_tu_0(\xbol ) = \inf_{\ybol \in -tB}  u_0(\xbol-\ybol)
$$  
\end{Defi}
\begin{Exercice}
Show that if $B$ is symmetric with respect to 0, then $E_t(-u)=D_t(u).$
\end{Exercice}
\PPLDIST

We have defined independently set or function erosions and dilations.  Let us now see
under which conditions the definitions coincide.
We can use the equivalence scheme described in Figure \ref{graphedesoperateursmonotones} : for the dilation, we obviously take 
$\setB=\{-tb, \; b\in B\}.$ We get
$$D_tu(\fxx)=\sup_{\fxy\in -tB}u(\fxx +\fxy) \leftrightarrow
D_tX=\bigcup_{\fxy\in -tB} (X-\fxy)=\bigcup_{\fxy\in tB}X+\fxy,$$
where the double arrow $\leftrightarrow$ means that the set operator on the right and the function operator on the left are in a $T$-$\setT$ relation, i.e. the threshold superposition principle applies and we have 
\fb&
 D_t(\levelset_\lambda u)= \levelset_\lambda(D_tu)
\fe&
 for every real function $u$, this relation being true $\fxx$-almost everywhere, for almost every $\lambda\in \real.$ 
In the same way, we take for the erosion $\setB=\{-tB\}$, a single structuring element,  and we obtain 
$$E_tu(\fxx)=\inf_{\fxy\in tB}u(\fxx+\fxy)\leftrightarrow E_tX=\bigcap_{\fxy\in tB}(X-\fxy)$$
by applying the equivalence scheme.
Thus, we have proved the following theorem.
\begin{th1}
The pair : set dilation, function dilation and the pair set erosion, function erosion, denoted respectively by $D_t$ and $E_t$, satisfy the  threshold superposition principle and we have 
\fb&
 \label{commutationavecseuilsdilation} D_t(\levelset_\lambda u)= \levelset_\lambda(D_tu) \hbox{  and  }
E_t(\levelset_\lambda u)= \levelset_\lambda(E_tu), \hbox{ a.e. in }\fxx, \hbox{ a.e. in }\lambda.
\fe&

\end{th1}

\begin {Exercice}  Let $u$ be a real continuous function on $\real^N$ and consider the dilation $D_t$ associated with open unit ball. From Formula \ref{commutationavecseuilsdilation}, we have
$D_t(\levelset_\lambda u)= \levelset_\lambda(D_tu)$ for almost every $\lambda$ and almost everywhere in $\fxx$. Prove that the set on the left is open and that the set on the right is closed. Deduce that the relation will be true for every $\fxx$ only if both sets are empty, or equal to $\real^N$. 
\end{Exercice}
The preceding exercise shows that we cannot expect perfect commutation of dilations with thresholds. The next proposition gives, however, a framework where that property is true.

\begin{pro}
\label{dilationserosionsmorpho}  Let $B$ be a compact (bounded and closed) subset of
$\real^N$. Let
$\cal T$ be the set of closed parts of $\real^N$ and $\cal F^+$ be the set of
upper semi-continuous functions, that is the set of functions whose upper level sets
$\levelset_\lambda u = \{\fxx, u(\fxx)\geq \lambda\}$ are in $\cal T$.  Let $\cal F$ be the
set of lower semi-continuous functions, that is, functions whose lower level sets
$\levelset_\lambda^-u=\{\fxx, u(\fxx) \leq \lambda\}$ are in 
$\cal T$. Then for any function $u$ in $\cal F^+$ one has
$D_t(\levelset_\lambda u) = \levelset_\lambda (D_tu)$ and for any function in $\cal F^-$, 
$E_t(\levelset_\lambda^-u)=\levelset^-_\lambda ( E_tu)$.  In other
terms, it is equivalent to directly dilate (resp. erode) $u$ or to dilate (resp. erode) 
first each level set of
$u$ and  then define as dilation (resp. erosion) of $u$ the function which has these level
sets.
\end{pro}


\paragraph{Proof of Proposition \ref{dilationserosionsmorpho}.}
We have $\fxx\in \levelset_\lambda (D_t(u))$ if and only if $\sup_{\fxy\in
tB}u(\fxx-\fxy)\geq \lambda$.  Since $u$ is u.s.c and therefore attains its
maxima on compact sets, this is equivalent to $\exists \fxy \in  tB, u(\fxx-\fxy)\geq
\lambda$
 and, setting $\fxz=\fxx-\fxy$, to 
$\exists \fxz\in \levelset_\lambda(u) \hbox{ and } \fxy \in tB,\; \fxx = \fxz+\fxy$, which
means
$ \fxx \in \levelset_\lambda(u)  +tB$ and is therefore equivalent to 
$\fxx \in D_t(\levelset_\lambda(u))$.
\enddemo


We now look for a property which is desirable for a family of scaled
operators, the recursivity.
 We say  that the erosions (or the dilations) associated
with a structuring element
$B$ are a recursive family of operators if
$E_{t+s}=E_t\circ E_s$ (resp.
$D_{t+s}=D_t\circ D_s$.) This property is also called ``semigroup" property. It implies that $D_t=(D_{\frac tn})^n,$ a very useful computational property.

\begin{pro} \label{proDu} \index{recursivity!example}
The erosions and dilations are recursive if and only if their structuring element
$B$ is convex. 
\end{pro}

\begin{lem} \label{lemt+sb=tb+sb}
{\it   One has $(t+s)B = tB + sB$ for any $s\geq 0$ and $t \geq 0$ if and only 
if $B$ is convex. }

\end{lem}

\vfp

\paragraph{Proof of Lemma \ref{lemt+sb=tb+sb}~:}  If $B$ is convex,  then by
definition of the convexity, for any $s$ and  $t, sB + tB$ is included in $(s+t)B$,
and the reverse inclusion is obvious.
  Conversely, assume that $sB + tB$ is contained in $(s+t)B$.  
Then, for any $\xbol $ and $\ybol $ in $B$ one can find $\zbol$ in $B$ such that 
$(s+t)\zbol = s\xbol  + t\ybol $.  This means that the barycenter of $\xbol $ and
$\ybol $ with
 weights $\frac{s}{s+t}$ and $\frac{t}{s+t}$ also is in $B$.  
Since this is true for any positive $s$ and $t$, we deduce that $ B$ is convex.
\endproof

\paragraph{Proof of Proposition \ref{proDu}~:}
We do the proof for the dilation. We have
$$D_t D_s X = (X +sB)+tB = X + sB+tB $$
and
$$ D_{s+t} X = X + (s+t)B $$
Since we can take $X=\{0\}$, we deduce that the dilation is recursive  if
and only if
$(t+s)B = tB + sB$.   By Lemma
\ref{lemt+sb=tb+sb}, this is true if and only if $B$ is convex. 
\endproof

\PPLCLOSING
\PPLOPENING

\section{P.D.E.'s associated with erosions and dilations}
Multiscale dilations and
erosions are canonically associated with a partial differential
equation. Let us denote by $||\fxx||_B$ \index{norm!set semi-norm}the gauge associated with a
bounded convex set
$B$ containing 0, that is
\index{$||\ybol ||_B$ B scalar product}
$$
||\ybol ||_B = \sup_{\zbol \in B}   \ybol .\zbol  ,
$$ where $
\ybol .\zbol $ denotes the Euclidean scalar product of $\ybol$ and
$\zbol$.  When $B$ is a ball centered at 0 and with radius 1,  $|| . ||_B$ is the
usual
 Euclidean norm.

\begin{pro} (Hopf-Lax formula \cite{Lax:1965:NSP}\cite{Evans:1998:PDE}
\index{PDE! Hopf-Lax formula} \index{Hopf-Lax formula}
\label{laxformula}) 
Assume that $B$ is a bounded convex set containing 0.
 Set $u(t, \xbol ) = D_t u_0(\xbol )$  (resp. $E_t u_0 (\xbol )$).  Then
$u(t,\xbol )$ satisfies
	$$	\partial u/\partial t = ||Du||_{-B}. $$   (resp.  $\partial u/\partial t = -
||Du||_{-B})$ at each point $(t,\fxx)$ where $u$ is $C^1$ with respect to $t$ and  $\fxx$.
\end{pro}

\PCMPED

\PCMPOC
{ \bf Proof.}  
 Let us first show the property at $t=0$.  Assume that $u_0$ is $C^1$ at $\fxx$.
We have
$u(t,
\xbol ) = D_tu_0(\xbol )
$ 
and 
 $u(0, \xbol ) = u_0(\xbol )$. Thus 
$$
u(h, \xbol ) - u(0, \xbol ) =  \sup_{\ybol \in hB} ( u_0(\xbol-\ybol)
 - u_0(\xbol ) )
$$  
Since $u_0(\xbol)$ is $C^1$ at $\xbol$ and $B$ is bounded, we get
$$
u(h, \xbol ) - u(0, \xbol ) = \sup_{\fxy\in hB} (-Du_0(\xbol ).\fxy)   +o(h)
$$ 
$$
 \qquad =  	  h \sup_{\fxz\in -B}( Du_0(\xbol).\fxz ) + o(h).  
$$
By dividing by $h$ and passing to the limit as $h$ tends to zero, we get
\fb& 
\label{En0}
%§label En0\quad
\frac{ \partial u}{\partial t}(0, \fxx) = ||Du_0(\fxx) ||_{-B},
\fe& 
which is the announced equation in the particular case where $t=0$.
Let us prove the same relation at an arbitrary scale $t$.
Since $D_{t+h}=D_tD_h=D_hD_t$, we can write
$$u(t+h, \fxx)-u(t, \fxx) = D_h(u(t))(\fxx) - u(t)(\fxx).$$
We divide  by $h$, let  $h$ tend to zero and apply the preceding result with  
$u(t)$ instead of $u_0$.  This yields the general equation.
 \enddemo 

\POPERATORUN
\POPERATORDEUX


\newpage
\zbibnote
Matheron introduced dilations and erosions as a useful toof for set and shape analysis in his seminal book \cite{Matheron:1975:RSI}.  A full account of the set and function properties of dilations, erosions, openings and closings can be found in the 
classical books of Serra \cite{Serra:1982:IAM, Serra:1988:IAM}.
See also the introductive paper by Haralick and al. \cite{Haralick:1987:IAU} and the early Nakagawa and Rosenfeld
\cite{Nakagawa:1978:NUL}.
An algebraic axiomatics for erosions, dilations, openings and closings has been developped by Ronse and Heijmans \cite{Heijmans:1990:ABM, Ronse:1991:ABM}. We did not expose here this algebraic  point of view.
The obvious relationships between dilations, erosions of a set and the distance function have been numerically exploited in \cite{Huang:1994:EDT}, \cite{Shih:1992:MMA} 
and \cite{Kimmel:1993:SOL}. The skeleton of a shape can be defined as the set of points where the distance function to the shape is singular. A numerical procedure computing the skeleton in this way is proposed in \cite{Kimmel:1995:SDM}.
The relationship between multiscale dilations or erosions and the 
Partial Differential Equations $\frac {\partial u}{\partial t}=\pm|Du|$
is known by the work of Lax \cite{Lax:1965:NSP} where it is used 
to give efficient stable numerical schemes for the P.D.E..
Rouy and Tourin have shown that the distance function to a shape is a viscosity solution
of $1-|Du|=0$, with null boundary condition (Dirichlet condition) on the boundary of the shape. In order to define efficient numerical schemes for computing the distance function, they actually implement the evolution equation
 $\frac {\partial u}{\partial t}=1-|Du|$, starting from 0 and with null 
boundary condition on the boundary of the shape.
The fact that the multiscale dilations and erosions can be computed by the 
partial differential equation $\frac {\partial u}{\partial t}=\pm|Du|$ has been  rediscovered or revived , thirty years after Lax, in several papers,
namely Alvarez et al. \cite{Alvarez:1993:AFE}, 
Boomgard and Smeulders \cite{Boomgaard:1994:MSI}, Maragos
\cite {Maragos:1996:DMI, Maragos:1998:PDE}. As a curve evolution algorithm,
see \cite{Sapiro:1993:ICS}. As a strange matter of fact,
the link between erosions, dilations and their P.D.E.'s seems to have 
remained unknown or unexploited until 1992. 
 The erosion and dilation P.D.E.'s can used for shape thinning, a popular way to compute the skeleton.  Pasquignon \cite{Pasquignon:1995:CSP} developped 
an erosion P.D.E. with adaptive stopping time, permitting to computed directly a skeleton which does not look like barbed wire.






\chapter{Median filters and mathematical morphology \label{chapitremedian} \label{chapter8}}
\thispagestyle{empty}

In the whole chapter, we consider real functions denoted by $u(\fxx)$ and defined for
$\fxx\in\real^N$.  We make no assumption at all about their regularity, except for one
thing~:  we shall use the Lebesgue measure of the level sets of $u$.  Thus, we need to
assume that the level sets of $u$ are measurable, which is equivalent  to say that $u$
is Lebesgue measurable.  For the mathematical treatment of measurability, we refer to
classic books like (e.g.) (\cite {rudin}).  The Lebesgue measure is the simplest
mathematically correct definition of the intuitive concept of length in dimension 1, area
in dimension 2 or volume in dimension 3. Thus all that will be said will remain
thoroughly understandable.  We refer to  Appendix \ref{AppendixMATH} for the statement of the
Lebesgue dominated convergence theorem.
 \newline 
In the whole chapter, we consider a \index{weight function} \index{function!weight}``weight function" $k(\fxy)$ defined on $\real^N$ with
values in $[0, +\infty[$ and satisfying 
$$\int_{\real^N} k(\fxy) d\fxy = 1.$$
We call \index{k-measure}
$k$-measure of a subset $B$ of $\real^N$ and denote by $|B|_k$ the integral
$$ |B|_k= \int_B k(\fxy)d\fxy.$$\notation
Of course, $0\leq |B|_k\leq 1$.  We shall also write,  when there is no risk of
ambiguity, $|B|$ instead of $|B|_k$.
As a main example for $k$, let us mention $k(\fxx) = c_N^{-1}\levelset_{B(0,r)}$, where 
$c_N$ is the Lebesgue measure of the ball $B(0,r)$
and $\levelset_{B(0,r)}$ the characteristic function of the ball $B(0,r)$.
 The median value \index{median value} (weighted by $k$) of a function $u$ is the result of an attempt to define
a smoothed version of $u$ which does not depend upon contrast changes. This is done by
``averaging" the level sets of $u$, so that our final definition will be better
understood if we start by  defining a median operator on sets.  

\begin{Defi}
\index{median!set operator}
\label{mediand'unensemble}
Let $X$ be a measurable subset of $\real^N$ and $k$ a weight function.  We call median set
of $X$ (weighted by $k$ ) and denote by $\med_k X$ (or $\med X$, since there is no risk
of ambiguity) the set
\fb& \label{definitiondumediand'unensemble}
\med X = \{\fxx, |X-\fxx|_k\geq \frac 1 2\}\notation
\fe&
\end{Defi}

\begin{Exa}
As a first example, let $k(\fxx) = \frac 1 {\pi r^2}\levelset_{B(0,r)}(\fxx)$ in $\real^2$.  Then
$\fxx$ belongs to $\med_k X$ if and only if the Lebesgue measure of $X\cap B(0,r)$ is larger
or equal to the half measure of $B(0,r)$.  In intuitive terms, $\fxx $ belongs to $\med_k X$
if points of $X$ are in majority around $\fxx$.
\end{Exa}

\begin{Exa}
The Koenderink-Van Dorn `` dynamic shape''  (Section \ref{se:KVD}).  Take $k(\fxx) = G_t(\fxx) = \frac{1}{4\pi t}e^\frac{-|\fxx|^2}{4t}$. Then, since $\int_{\real^2}G_t(\fxx)d\fxx=1$, we immediately see that the dynamic shape is nothing but a gaussian weighted median filter.

\end{Exa}


Let us now extend the set  median operator     $\med$ into a contrast invariant operator acting on measurable
functions.
\begin{lem} \label{mediancontinusurensemblesdecroissants}
\index{median ! function operator}
The operator $\med_k~: {\cal T}
\rightarrow {\cal T}$ is a monotone operator satisfying the set continuity property
(\ref{vii.2}), that is~:
If  $(X_\lambda)_{\lambda \in \real}$
is a non-increasing family of measurable sets such that $\forall \lambda \in
\real$, $X_\lambda = \inter_{\mu <\lambda} X_\mu$, then
\fb&
 \med_k(X_\lambda) = \cap_{\mu < \lambda}\med_k (X_\mu).
\fe&
\end{lem}

\paragraph{Proof}
Since $\med_k$ is monotone, we already have
$\med_k(X_\lambda)\subset\inter_{\mu<\lambda}\med_k(X_\mu).$  Conversely, let
$\fxx \in \inter_{\mu<\lambda}\med_k X_\mu.$   Then, by
(\ref{definitiondumediand'unensemble}), we have for every $\mu$, $|X_\mu-\fxx|_k\geq \frac 1 
2$. Since $X_\mu$ is a nondecreasing sequence of sets, all with finite measure, we have by
Lebesgue theorem (Appendix \ref{AppendixMATH})
$|X_\mu-\fxx|_k\to |X_\lambda-\fxx|_k$.
Thus $|X_\lambda-\fxx|_k\geq \frac 1 2 $ and, by
(\ref{definitiondumediand'unensemble}) again, $\fxx \in \med_k(X_\lambda)$.
\enddemo

\begin{Defi} {\bf and Proposition} \index{median!function operator}
\label{mediantresmorpho}
The median set operator defined on measurable sets has a unique contrast invariant
extension to measurable functions, obtained by the threshold superposition principle.  This extension has the $\sup\inf$ form
\fb& \label{formesupinfdumedian}
\med_k(u)(\fxx) = \sup_{|B|_k\geq \frac 12}\inf_{\fxy \in B+\fxx}u(\fxy)
\fe&
and satisfies $$\levelset_\lambda(\med_k(u))=\med_k(\levelset_\lambda(u)).$$
\end{Defi}
\paragraph{Proof}
 By  Lemma \ref{mediancontinusurensemblesdecroissants} and Theorem   \ref{3.5bis}, the
median operator $\med_k$, defined on measurable sets, has a unique contrast invariant extension 
to measurable  functions such that $$\med_k(\levelset_\lambda u) = \levelset_\lambda(\med_ku)$$
for every measurable function $u$.  In addition, by Corollary \ref{exerciceutile}, the median operator
thus defined on functions has the ``$\sup\inf$" form
$$(\med_k u)(\fxx) = \sup_{B\in\setB}\inf_{\fxy\in \fxx+B}u(\fxy),$$
where $\setB=\{B, 0\in \med_k(B).\}$ This immediately yields (\ref{formesupinfdumedian}).

\enddemo

\begin{Exa}
In order to understand the consequences of the definition of the median
operator in case of functions which have ``flat" parts and jumps, it is useful to
consider the following examples of  functions defined on $\real$ with 
$k=\frac 12\indic_{[-1,1]}$~:
\newline $\bullet$  $u(x)=x$ if $x\leq 0$, $u(x)=0$ if $x>0 $~: $\med_ku(0) = 0$.  In
that case, the median value coincides with the supremum.
\newline $\bullet$  $u(x)= -1$ if $x\leq 0$, $u(x)=1$ if $x>0 $~: $\med_ku(0)=1$.
Notice the symmetry breaking : +1 and -1 are equally good candidates to define a median
value, but our definition of the median operator gives a privilege to the larger value.
\newline $\bullet$  $u(x)=0$ if $x\leq -\frac 1 4$, $u(x)=1$ if $-\frac 14 < x < \frac
13$,
$u(x) = 2 $ if $x\geq \frac 13$~:  $\med_ku(0)=1$. \newline 
Notice that the median value is, in  all
of the three cases, different from the mean value on the same neighborhood.
\end{Exa}

\begin{Remark} {\bf Upper and lower median operators}  \index{median!upper \& lower} \index{upper median operator} \index{lower median operator} The median operator, as we have defined
it, is not invariant by  reverse contrast~: we do not have $\med (-u) = -\med (u)$ as is
clear from the second example above.  Thus, we can consider an alternative definition  for the
median operator, as 
\fb& \label{formeinfsupdumedian}
\med_k^-(u) = \inf_{|B|_k\geq \frac 12}\sup_{B+\fxx}u(\fxy)
\fe&
Obviously, $$\med_k^-u = -\med_k(-u),$$
so that both definitions yield the same formalism and properties.
In particular, we have
\fb&
 \label{definitiondumedianmoinsd'unensemble}
\med_k^- X = \{\fxx, |X-\fxx|_k> \frac 1 2\},
\fe&
which is easily deduced from the remark that 
$$\med_k^-X = (\med_k X^c)^c,$$
where $X^c$ is the complementary set of $X$, $\real^N\setminus X$.
 The choice of $\med_k$
is more adapted to closed sets and u.s.c. functions, since, as we shall now see, $\med_kX$ is
closed if
$X$ is closed and $\med_k u$ is u.s.c. if $u$ is. In the same way, $\med_k^-$ is adapted
to open sets and l.s.c. functions.  

\end{Remark}


\begin{th1}
\label{medianrendsemicontinu}  
Let $u$ be a measurable function. Then $\med_ku$ is an upper semi-continuous function (and
$\med_k^-u $ a lower semi-continuous function).
\end{th1}
 

\begin{lem}
\label{mediandonnefermesououverts}
For every subset $X$ of $\real^N$, $\med_k X$ is a closed set (and $\med^-_k X$ is an
open set.)
\end{lem}
\paragraph{Proof}
If $\fxx_n \in \med_k X$, then $|X-\fxx_n|_k \geq \frac 1 2$, that is
$\int_X k(\fxy-\fxx_n)d\fxy\geq \frac 1 2$.  If $\fxx_n\to \fxx$, the last integral
converges to $\int_X k(\fxy-\fxx)d\fxy$ by Proposition \ref{continuiteL1}.  We obtain 
$|X-\fxx|_k \geq \frac 1 2, $ that is, $\fxx \in \med_k(X)$. 
\enddemo


\paragraph{Proof of Theorem \ref{medianrendsemicontinu}}
Let $u$ be a measurable function on $\real^N$. By Definition-Proposition \ref{mediantresmorpho},
the level sets of $\med u$ are obtained by applying $\med$ to the level sets of $u$.  
By Lemma \ref{mediandonnefermesououverts}, the level sets of $\med(u)$ are
therefore closed, so that $\med(u)$ is upper semi-continuous. One also deduces that  $\med^-(u)$
is a lower semi-continuous function from  the relation
$\med^-(u)=-\med(-u).$
\enddemo

\POPERATORTROIS


\noindent We shall now give a very general sufficient condition ensuring first that
$\med_ku$ is continuous if $u$ is and second that both possible definitions of the
median operator,
$\med$ and $\med^-$, coincide on continuous functions.  

\begin{pro} \label{med=med-}
(i) For every measurable function $u$, 
\fb& \med_k(u) \geq \med^-_k(u)\fe&


(ii) Assume that $k$ satisfies the following property :
$$\forall B,B' \hbox{ such that }meas_k(B) \geq \frac{1}{2}\hbox{ and }meas_k(B') \geq
\frac{1}{2}, \hbox{ then }\overline{B} \cap \overline{B'} \neq \emptyset,$$
 where $\overline{B}$\notation denotes the
topological closing of $B$.
Then, for every continuous function $u$,  $med_k(u)$ is continuous and
\fb& \med_k(u) = \med^-_k(u) \fe&
\end{pro}



\paragraph{Proof} Without loss of generality, take $\fxx=0$.
(i) Set $\lambda= \med_k(u)(0) = \sup_{|B|_k\geq \frac 12}\inf_{\fxy\in B}u(\fxy)$.
For every $ \epsilon > 0$, we then have $\meas_k(\levelset_{\lambda+\epsilon}u) <
\frac{1}{2}$. Thus $meas_k((\levelset_{\lambda+\epsilon}u)^c) \geq \frac{1}{2}$ and
of course $ \sup_{(\levelset_{\lambda+\epsilon}u)^c} u \leq \lambda + \epsilon $.
Hence
$$ \forall \epsilon>0, \inf_{|B|_k\geq \frac 12}\sup_{B}u(\fxy) \leq \lambda + \epsilon$$
Letting $\epsilon$ tend to zero yields (i).

(ii) Take again $\fxx=0$, without loss of generality. 
The assumption on  $k$ implies that for all $B$ and $B'$ with $k$-measure
larger or equal than $1/2$ we have
$$ \inf_{\overline{B}}(u) \leq \sup_{\overline{B'}}(u) $$
and since $u$ is continuous,
$$ \inf_{B}(u) \leq \sup_{B'}(u). $$
Taking the inf over all $B'$ and the sup over all $B$ yields
$$  \sup_{|B|_k\geq \frac 12}\inf_{B}u(\fxy) \leq \inf_{|B'|_k\geq \frac 12}\sup_{B'}u(\fxy)$$
>From this last relation and (i), we deduce the equality of the $\med$ and $\med^-$
operators on  continuous functions. Now, by Theorem \ref{medianrendsemicontinu}, the
operator 
$med$ transforms any measurable function into an upper semi-continuous one, and
$med^-$ into a lower semi-continuous one.  Thus $med(u)$ is continuous
if
$u$ is.
\enddemo

\begin{Exercice}
Condition (ii) in Proposition \ref{med=med-} is very weak and grossly corresponds to the 
assumption that the support of $k$ cannot be split into two disjoint closed connected components with
measure $\frac 12$. Check that if (e.g.) $k$ is continuous and its support connected,
then Condition (ii) holds.
\end{Exercice}
\begin{Exercice}
Show that 
$$
\sup_{|B|_k\geq \frac 12}\inf_{B+\fxx}u(\fxy) \geq \sup_{|B|_k> \frac
12}\inf_{B+\fxx}u(\fxy) \geq \inf_{|B|_k\geq \frac 12}\sup_{B+\fxx}u(\fxy), $$
$$
\sup_{|B|_k\geq \frac 12}\inf_{B+\fxx}u(\fxy) \geq \inf_{|B|_k> \frac
12}\sup_{B+\fxx}u(\fxy) \geq \inf_{|B|_k\geq \frac 12}\sup_{B+\fxx}u(\fxy).
$$
\end{Exercice}


\begin{Remark} {\bf Discrete median filters and the ``usual'' median value.}
\index{median!value}

We define a discrete median filter by considering a measure made of
a finite number of Dirac masses $\delta_i$, $i\in \{1,..N\}$, centered at points
$\fxx_i$. The locations of the Dirac masses represent  the discrete neighborhood on which
the median value will be computed  around each point.
(Notice that  such a measure is not associated with an integrable function $k$, so that
Theorem \ref{medianrendsemicontinu} does not hold anymore.)
\newline
The formula of the median filter can be simplified in that case.  We have
$$med \; u (\fxx)= \inf_{P\in  I\!\!P(N),\; card(P)\geq N/2} \sup_{i\in P} \; u(\fxx-\fxx_i),$$
$$med^- u(\fxx)= \sup_{P\in  I\!\!P(N),\; card(P)\geq N/2} \inf_{i\in P} \; u(\fxx-\fxx_i)$$
where $I\!\!P(N)$ denotes the set of all  parts of \{1, ..., N\}.
Let us now denote by $M=E(N/2)+1$, the smallest integer larger or equal than $N/2$. For
any set $P$ containing strictly more than $M$ elements, we can construct a smaller set
$P'$, with still a number of elements larger than $M$, by simply removing an element
from $P$. The $\sup$ on $P'$ is therefore smaller than the $\sup$ on $P$, and since the
$\med$ operator chooses the smallest value over $I\!\!P(N)$, we can remove such $P$'s
from
$I\!\!P(N)$ without changing the value of $\med$. We therefore have, with $M=E(N/2)+1$,
$$\med \; u (\fxx)= \inf_{P\in I\!\!P(N), \;card(P)= M} \; \sup_{i\in P} \;
u(\fxx-\fxx_i)$$
$$\med^- u(\fxx)= \sup_{P\in I\!\!P(N), \;card(P)= M} \; \inf_{i\in P} \;
u(\fxx-\fxx_i)$$ Is it now easy to see that $med\;u(\fxx)$ (resp. $med^- u(\fxx)$)
corresponds to the {\bf $M$ smallest} (resp. $M$ largest) value out of the real numbers
$u(\fxx-\fxx_1), ... u(\fxx-\fxx_N)$ which are the values of $u$ in the discrete
neighborhood of
$\fxx$.

The operators $\med$ and $\med^-$ are identical if and only if $N$ is odd. Indeed, in
that case,
$M=(N+1)/2$ and the $M$ smallest value out of $N$ real numbers is also the $M$ largest
value. This is compatible with Proposition \ref{med=med-}~: indeed, if $N$ is odd, then
any two sets of cardinality $M=(N+1)/2$ made out of $N$ points must intersect. (Take e.g.
N=7, therefore M=4. Two sets of 4 pixels out of a set of 7 pixels have necessarily at
least one pixel in common.) This is not true anymore if $N$ is even, and therefore in
that case $\med$ and $\med^-$ can differ. This is why in general a median value on an
odd number of pixels is prefered.

Now, the discrete median filter can be also defined by putting a weight on each Dirac
mass, which is equivalent to say that neighboring pixels will weigh differently in the
computation of the median value. A simple example is given in Figure \ref{Wmedianfig},
where the weight is set according to the area of the intersection between each pixel and
a
$2\times 2$ mask.

\end{Remark}

\WMEDIANFIG

\begin{Exercice}  By $\arginf_m f(m)$, we denote a value of $m$ (if any) at which $f$
attains its infimum. Consider N real numbers $x_i$. 
\newline (i) Show that their mean value satisfies
$$
\frac{1}{N} \sum_{i=1}^N x_i = \arginf_m \sum_{i=1}^N (x_i -m)^2. $$
Show that
$$ \med^-(x_i) \leq \arginf_m \sum_{i=1}^N |x_i -m|  \leq \med(x_i). $$

\noindent (ii) Set $k= \indic_B$, where $B$ is a set with Lebesgue measure equal to 1.
Denote by $\med_B u$ the ``median value of $u$ in $B$" \index{median value of a
function $u$ in a set $B$}\notation defined by $\med_Bu= \med_k u(0).$
Consider a bounded and measurable function $u$ on $B$.
Show that
$$ 
\int_B u = \arginf_m \int_{\fxx \in B} (m-u(\fxx))^2 d\fxx$$
and
$$ \med_B^-(u) \leq  \arginf_m \int_{\fxx \in B} |m-u(\fxx)|
d\fxx=\frac{\med^-_Bu+\med_Bu}2
\leq \med_B(u). $$
\noindent (iii)
Conclude that the mean (resp. median) value is the ``best'' constant approximation with respect to the $L^2$ (resp. $L^1$) norm.

\end{Exercice}


\PMEDIANDEBRUITE
\PMEDBIRD

\begin{Remark} The Discrete Median Filter $M$ is a cyclic operator on discrete images.
Consider an image $u$ having $N$ pixels. The number of differents gray levels can be obviously bounded by the
number of pixels that is again $N$. Since the Median Filter is contrast invariant, it preserves the discrete
set of gray levels. That is to say that $M^k(u)$ is an image with $N$ pixels and with level among the different levels of $u$ ($N$ at max). Since the maximal number of different realizations is $N^N$ then after $N^N$ iteration of the median $M$, there will be two identical images among the images $M^k(u)$, $k \in \{1, ..., N^N\}$. As consequence the Median is cyclic.

Simple example to illustrate the cyclicity is as follow. Consider a pixel set made of one pixel and its four neighbor and the associated median filter taking the median value among the five pixels. Consider also the ``chessboard'' image, that is $u(i,j) = 255$ if $i+j$ is even, and $u(i,j)=0$ otherwise.
When we apply the median filter the chessboard is ``reversed''. Indeed, any white pixel (value=255) is surrounded by 4 black pixels, so that the median filter transforms it into a black pixel. Conversely, a black pixel is transformed into a white one.


\end{Remark}



\zbibnote

The remarkable denoising properties and numerical efficiency of median filters are well-known and acclaimed 
for the removal of all kinds of impulse noise in digital images, movies
and video signals  \cite{Narendra:1978:NRM, Ip:1983:INC, Perlman:1987:AMF, Davies:1988:NSI, Rawtani:1995:ISM}. The last mentionned paper proposes an efficient, low complexity implementation, as well as \cite{Danielsson:1981:GMF, Huang:1979:FTD, Astola:1987:RSM}.
An introduction to the weighted median filter can be found in 
\cite{Brownrigg:1984:WMF, Yli-Harja:1991:APM} and some generalizations (conditional 
median filters, etc.) in \cite{Lee:1985:GMF, Sun:1994:DPM, Arce:1987:TAM}
 and Unser-Yaroslavski
\cite{??}. Max, Min and median filters are just particular instances of 
rank order filters. See \cite{Coyle:1988:ROO} for a general presentation of these filters.  There are few studies on iterated median filters. 
The use of iterated median fiters as a scale space is, however, proposed 
in \cite {Bangham:1996:MRM}. The extension of median filtering to 
multichannel (colour) images is problematic.  Let some interesting 
attempts be mentionned \cite{ Regazzoni:1997:NAV}, \cite{Caselles:2000:VMF}.




\part{LOCAL ASYMPTOTIC ANALYSIS OF OPERATORS \label{PART3}}
\chapter{\label{Asymptotic} Asymptotic behavior of contrast invariant isotropic
operators (Dimension 2). \label{chapter9}}
\thispagestyle{empty}




In this chapter, we consider the ``inf-sup"  operators introduced
in Section
\ref{sup-infoperators}, 
\fb&
 Tu = \infsup& u(\fxy). \label{xvi.2} 
%§\quad label xvi.2
\fe&
Since $T'(u)=-T(-u)$, every  statement about $T$ will be easily adapted to ``sup-inf"
  operators 
\fb&
 T'u(\fxx) = \supinf& u(\fxy) \label{xvi.1}
%§\quad label xvi.1 
\fe&
By Theorems \ref{xi.1} and Theorem \ref{extensionapleinementmorpho}, we know that the monotone contrast invariant and
translation invariant operators simply are  
 operators in the ``$\inf\sup$" (or $\sup\inf$) form.  
  Thus, our asymptotic analysis of contrast
invariant operators will be fully general if we adopt the ``$\inf\sup$'' formalism.
  In order to simplify the analysis, we shall, in addition,
assume that the considered operators are
\underbar{isotropic}\index{operator!isotropic}\index{isotropic}, that is,
$\setB$ is invariant under all linear isometries $R$ of $\real^2~: R \setB = \setB$. In this
chapter, we also assume that $\SetB$ is bounded, that is, $B\subset D(0, M)$ for every
$B$ in
$\SetB$ and some disk $D(0, M)$.
 The action of  such operators seems {\it a priori} to open a wide range of
possibilities, as many as possible sets of structuring elements. We shall see that
this freedom of choice is rather an illusion.  Let us introduce a scale parameter
$h>0$. We associate with $\SetB$ and $T$ the scaled family $\SetB_h  = h
\setB$ and the scaled operator $T_h$ defined by
$$T_h u(\fxx) = \supinfh& u(\fxy).$$
 In fact, we shall prove that when $h$
tends to zero, the action of $T_h$ on smooth functions $u$ is
described by a fairly small set of possibilities.

We shall prove a theorem which plays the same role for isotropic contrast invariant filters as Theorem \ref{asymptotiquelineaire} played for linear filters.  As a main example, we shall prove that if $T_h$ is a shrinked median operator, then
$$T_hu-u=Ch^2 curv(u)\vert Du\vert +o(h^2).$$
Thus, the operator  $\vert Du\vert curv (u)=D^2u(\frac{Du^\perp}{\vert Du\vert}, \frac{Du^\perp}{\vert Du\vert})$ plays the same role for contrast invariant operators as the laplacian $\Delta u$ for linear ones.

\section{\label{Asymptotictheorem}Asymptotic behavior theorem.}

In the following, we set
\fb&
 H(\alpha) = T[x+\alpha y^2](0), \label{xviii.0} 
%§\quad label xviii.0
\fe&
where $T[x+\alpha y^2]$ stands for ``$T(u)$ with $u(x,y)=x+\alpha y^2$".
Since $T$ is monotone, $H$ is a nondecreasing function, which is, in addition,
Lipschitz. Indeed, by the monotonicity of $T$ and the boundedness of $\SetB$,
$$T[x+\alpha_1 y^2](0) - |\alpha_2 - \alpha_1|M^2 \leq H(\alpha_2) \leq T[x+\alpha_1y^2](0) + |\alpha_2-
\alpha_1|M^2$$
and therefore
\fb& 
\label{xviii.2}
%§\quad label xviii.2
 |H(\alpha_2) - H(\alpha_1)| \leq M^2 |\alpha_2 - \alpha_1| , 
\fe&
where we have used the fact that all elements of $\setB$ are contained
in a disk $D(0,M)$.

Let us also note  the following relations~:
\fb& T_h[x] = h T[x] = h H(0)  \label{6.13}\fe&
\fb& T_h[x+\alpha y^2](0) = h T[x + h \alpha y^2](0) = h H(\alpha h) \fe&


\begin{th1}
\label{xviii.1(i)} \index{asymptotic behavior}
Let $\setB$ be a family of structuring elements in $\real^2$ which
is bounded ( $\forall B \in \SetB$, $B \subset D(0,M)$) and isotropic
(if $B \in \setB$, then R$B \in \setB$ for every linear isometry R of
$\real^2$).
Let $Tu(\fxx) =\infsup& u(\fxy)$ (or $ Tu(\fxx) = \supinf& u(\fxy)$)  
and define the rescaled operator \index{rescaled operator}
$$
T_hu(\fxx) = \infsuph& u(\fxy)\quad \hbox{( resp.}\; T_hu(\fxx) = \supinfh& u(\fxy)
\hbox{ )}.
$$
Then for every $C^2$ function $u$  on $\real^2$,
$$(T_h u)(\fxx) = u(\fxx)+ hT[x](0)|Du|(\fxx) + O(h^2). $$

\end{th1}
\paragraph{Proof.}

Since $T(u-u(\fxx)) = Tu -u(\fxx)$, we can impose without loss of generality $u(\fxx)=0$.  
$T$ being translation and isometry invariant, we can choose the origin 0 at
$\fxx$, and  orthogonal axes $(\vec i, \vec j)$ satisfying $\vec i = \frac{Du}{|Du|}(0)$
and $\vec j
= (Du^\perp/ |Du|)(0)$ when $Du \neq 0$.  Since $u$ is $C^2$, we can by Taylor formula
write for $\fxy=(x,y) $ in a neighborhood of 0,
\fb&
\label{xix.37}
u(\fxy) = px + O(|\fxy|^2),
\fe&
where $p=|Du|(0)\geq 0$.
>From (\ref {xix.37}) we deduce that for 
every $\fxy=(x,y)$ in $hD(0,M)$, we have 
$$
px-O(h^2) \leq u(\fxy) \leq px + O(h^2).
$$
Let us apply $T_h$ to both members of this relation.
 By the monotonicity of $T_h$, and since every
$hB$ is contained in $D(0,Mh)$, we deduce that
\fb&
 \label{xix.2}
T_hu(0)= T_h[px](0)+ O(h^2).
\fe&
Using (\ref{6.13}), we have
$T_hu(0) = hT[px](0) + O(h^2) = ph(T[x](0)) + O(h^2)$, which proves the theorem, since
$p=|Du(0)|$.
\enddemo
Let us state an informal but meaningful conclusion yielded by the preceding theorem.  Let 
$T$ be a contrast invariant, isotropic and monotone operator.  The first ``test" to which $T$ must be submitted
is simply to compute its action on $u(\fxx) = u(x,y)=x$.  If $T[x](0)\neq 0$, then when the
scale
$h$ of a scaled  operator $T_h$ tends to zero, $T_h$ behaves like a dilation if
$T[x](0)>0$ and like an erosion otherwise (See Proposition \ref{laxformula}).  Thus, if $T[x](0)\neq 0$,  there is no use
 to define it with complicated sets of structuring elements~: they all yield asymptotically an
erosion or a dilation which can be performed with a single and simple structuring element~: the
disk.  


\begin{Exercice} An analogous statement when $T$ is no more isotropic : show that 
under the same assumptions as in Theorem \ref{xviii.1(i)}, except the isotropy of $T$, one
has
$$(T_hu)(0)-u(0) = hT[Du(0).\fxx](0) + O(h^2).$$
\end{Exercice} 
We now consider the case where
$T[x](0)=0$.  In such a case, the operator $T$ has a  desirable symmetry : If we understand
$Tu(\fxx)$ as a kind of average value of $u$ in a neighborhood of $\fxx$, the assumption
$T[x](0)=0$ is very  sound.  It means that all isotropic averages of $u(x,y)=x$ around
$ (0,0)$ should be 0.

\begin{th1}   \index{asymptotic behavior}
\label{xviii.1}

%§\quad label xviii.1

Let $\setB$ be a family of structuring elements in $\real^2$ which
is bounded ( $\forall B \in \SetB$, $B \subset D(0,M)$) and isotropic
(if $B \in \setB$, then R$B \in \setB$ for every linear isometry R of
$\real^2$).

Let $Tu(\fxx) =\infsup& u(\fxy)$ (or $ Tu(\fxx) = \supinf& u(\fxy)$)  
and define the rescaled operator
$$T_hu(\fxx) = \infsuph& u(\fxy)\quad \hbox{( resp.}\; T_hu(\fxx) = \supinfh& u(\fxy)
\hbox{ )}.$$ Set $H(h) = T(x+hy^2)(0)$ and assume that $H(0)=T[x](0)=0$. Then for every
$C^3$ function $u$ on $\real^2$~:

(i) On every compact set $K$ contained in  $\{\fxx, Du(\fxx) \neq 0\}$,  
$$T_h u(\fxx) = u(\fxx) + h |Du(\fxx)| H( \frac{1}{2} h\; \curv(u)) +
O_{\fxx}(h^3),$$
where   $|O_{\fxx}(h^3)|\leq C_Kh^3$ for some constant $C_K$ depending only on $u$ and $K$.

(ii) On every compact set $K$ of $\real^2$, 
$$|T_h u(\fxx) -u(\fxx)| \leq  M^2h^2||D^2u(\fxx)||+O_{\fxx}(h^3),$$
where   $|O_{\fxx}(h^3)|\leq C_Kh^3$ for some constant $C_K$ depending only on $u$ and $K$.
\end{th1} 
In (ii), we notice that $D^2u(\fxx)$ is a $2\times 2$ matrix and we take
 $||A||= |a|+|b|+|c|+|d|$\notation as a norm for 
such a matrix $A=\left(
\begin{array}{ccc}
a & b  \\
c & d  \\ \end{array} \right)$.
 As a canonical application of the preceding theorem which we will  develop later in this
chapter, the reader may think of the median filter. 
Indeed, the median filter does not alter linear functions and we therefore have $H(h)=\med
(px)(0)=0$.
\paragraph{Proof.} 
We adopt the same notation  as in the proof of Theorem \ref{xviii.1(i)}, take again and
without loss of generality $\fxx=0$, $u(0)=0$   and set again, for $(x,y)$ in a neighborhood
of 0,
\fb& \label{numero1}
 u(x,y) = px+ ax^2 + by^2+cxy + O(|x^2+y^2|^\frac 32). 
\fe&
We refer to Section \ref{thecurvatureofthelevellines} for a detailed account of the notation and the differential 
interpretation of $p$, $a,$ $b$, $c.$
Note that by Taylor formula, 
\fb& \label{restedetaylor}
O(|x^2+y^2|^\frac 32)\leq ||D^3u(0)||\;|x^2+y^2|^\frac 32.
\fe&
The same reasoning as in Theorem \ref{xviii.1(i)} and an obvious rescaling yield
\fb& \label{numerodeplus}
T_h u(0) =
hT[px+ahx^2+bhy^2 + chxy](0)+O(h^3)= hT[u_h(x,y)](0)+O(h^3),
\fe&
where we set $u_h(x,y) = px+ ahx^2+bhy^2+chxy$.
In order to prove the theorem, we have to show that $c$ and $a$ play no
role in the asymptotic behavior of $Tu_h(0)=\inf_{B\in\setB}\sup_B u_h$.
\newline\newline
{\bf Step 1~: An estimate.} 
If $(x,y)\in B\in \setB$, then
$$px-h(|a|+|b|+|c|)M^2 \leq u_h(x,y) \leq px + h(|a|+|b|+|c|)M^2.$$
By assumption,  $T(px)=0$, and we obtain, by applying $T_h$ to the inequalities,
\fb&
\label{estim1}
|Tu_h(0)|\leq h(|a|+|b|+|c|)M^2.
\fe&	
Returning to the definitions of $a, b, c$, using Relations
(\ref{numero1}) to (\ref{numerodeplus}) and remarking that 
$D^3u(\fxx)$ is continuous and therefore bounded on each compact set $K$, we deduce
 the assertion (ii) from (\ref{estim1}).
\newline
>From now on, we focus on (i) and assume that
$p\neq 0$.  We set
$$C= (|a|+|b|+|c|)M^2.$$
\newline
\newline
{\bf Step 2~: First reduction.}
By Step 1, for every $B\in \setB$, we have $$\sup_Bu_h\geq
\inf_{B\in\setB}\sup_Bu_h=Tu_h(0)\geq -Ch.$$
 Now, if $(x,y)\in B$ and $x< -2Ch/p$, then
$$u_h(x,y)=px+ahx^2+bhy^2+chxy <   -2Ch+h(|a|+|b|+|c|)M^2 = -Ch.$$
Let us set $C'=\frac{2C}p.$ We obtain
$$\forall B\in \setB,\;\;  \sup_B u_h = \sup_{B\cap\{(x,y), x\geq -C'h\}} u_h.$$


{\bf Step 3~: Second reduction.}  
Since $Tu_h(0)\leq Ch$ (Step 1), one does not need to consider the sets $B$ for which 
$\sup_Bu_h\geq Ch$.  If 
$\sup_Bu_h\leq Ch$, then 
$$\forall (x,y)\in B,\;\; px+ ahx^2+bhy^2+chxy\leq Ch$$ and therefore
$$x\leq \frac 1 p (Ch + (|a|+|b|+|c|)M^2h)\leq \frac {2Ch}p=C'h.$$
Hence,
\fb&
\label{premierereduction}
Tu_h(0) =  \inf_{B\in \setB, B\subset\{(x,y),\;x\leq
C'h\}}\sup_Bu_h
\fe&
and by Step 2, 
\fb&
\label{deuxiemereduction}
Tu_h(0) =  \inf_{B\in \setB, B\subset\{(x,y),\;x\leq
C'h\}}\sup_{B\cap\{(x,y),\; x\geq -C'h\}}u_h(x,y).
\fe&
Now, for those $(x,y)$, belonging to   $B\subset\{(x,y),x\leq C'h\}$ and satisfying $x\geq
-C'h$, we have $|ahx^2+chxy |\leq C'' h^2$ and therefore $u_h(x,y)=px+bhy^2+O(h^2)$.  Thus
(\ref{deuxiemereduction}) implies
\fb& \label{numero2}
T(u_h)(0)=\inf_{B\in \setB, B\subset\{(x,y),\;x\leq
C'h\}}\sup_{B\cap\{(x,y),\; x\geq -C'h\}}u_h(x,y)(px+bhy^2) +O(h^2),
\fe&
and applying Relation (\ref{deuxiemereduction}) with $u_h(x,y)$ replaced by $px+bhy^2$, we 
finally get
$$
T(u_h)(0)=T[px+bhy^2](0)+O(h^2).
$$

\newline\newline
{\bf Conclusion.}
Using the definition of $H$,  $H(h)=T[x+hy^2](0)$, we obtain
\fb& \label{equationen0}
T_h u(0) =hT(u_h)(0)= ph H(\frac{bh}{p}) + O(h^{3}).
\fe&
Since, by Formula (\ref{F3}),
$$
 b = \frac{1}{2} \curv(u) |Du|(0) 
$$
and $p = |Du|(0)$, we obtain the relation announced in (i), at $\fxx=0$.  Now, all computations
have been done with the origin fixed at $\fxx=0$.  If we let vary $\fxx$ in a compact set $K$ on
which
$p=|Du(\fxx)|\neq 0$ (so that $p=|Du(\fxx)|$, $a$, $b$, $c$ now depend on $\fxx$), then we have
for some positive constants
$c_K$ and
$C_K$ only depending on
$K$ and $u$,
$$p\geq c_K, \;\;|a|,\; |b|,\; |c|\leq C_K.$$
 Indeed, $\fxx\to D^2u(\fxx)$ is continuous and therefore
$a, b, c$ are bounded on each compact set $K$.  By compactness again, the lower bound $c_K$
of $p$ on $K$ is attained and therefore positive. It then easy to check that the constants
$C(\fxx)$ and
$C'(\fxx)$ involved in the preceding proof also are bounded independently of $\fxx$ on $K$.  Thus the $O(h^3)$ involved
in (\ref{equationen0}) is uniform on $K$.  The same argument applies to the statement (ii),
which we have proven above at $\fxx=0$.
\endproof


\section{Median filters and curvature motion. \label{Median}}

We recall that the median filter, $\med$, defined in Chapter \ref{chapitremedian}, can be
written, as in Formula 
(\ref{formesupinfdumedian})~:
\fb&
\med_k u (\fxx) = \sup_{|B|_k\geq \frac 1 2}\inf_{\fxy\in B+\fxx} u(\fxy).
\fe&
In the following, we take as a first example for $k$ the uniform measure on a disk  $D(0,1)$,
so that
$$|D(0,1)|_k=1, \; \;k_h=\frac{\indic_{D(0,h)}}{\pi h^2}$$
 and we shall examine only continuous
functions.  This entails  by Proposition
\ref{med=med-} that
$\med$ and $\med^-$ are simply equal. So we shall simply write ``$\med$" and
talk about ``the" median filter. The ``infsup'' form of the median filter on  continuous
function is  given by
$$ \med_{D(0,h)} u (\fxx) =  \inf_{meas B\geq \frac 1 2,  B \subset D(0,h)} \sup_{\fxy\in \fxx+
B} u(\fxy).$$
The main result of this section gives an infinitesimal interpretation of the 
median filter.  This theorem will be generalized in the next chapter to much more
general weighted median filters (Theorem \ref{xviii.1-bis}).

\begin{th1} \index{asymptotic behavior!median filter}
\label{B1}
%§ label B1\newline
Let $u$ be a $C^3$ function in $\real^2$. Then
$$
\hbox {(i) }\;\med_{D(0, h)} u (\fxx)= u(\fxx) + \frac{1}{6} \curv(u)|Du|(\fxx) h^2 +
O_{\fxx}(h^{3}),
$$
where $O_{\fxx}(h^{3})\leq c_Kh^3$ on every compact subset of $\{\fxx, Du (\fxx) \neq 0\}$ and,
if $Du(\fxx)=0$,
$$
\hbox{(ii) }\;
|\med_{D(0, h)} u(\fxx) - u(\fxx)| \leq ||D^2u(\fxx) ||h^2 + O_{\fxx}(h^3)
$$
where $O_{\fxx}(h^{3})\leq c_Kh^3$ on every compact subset of $\real^2$.
\end{th1}

\PER_EROSION
\PMEDCURV


\begin{lem}
\label{C1}
%§label C1\newline
$$ \med_{D(0,1)} [x+ hy^2](0) = \frac{h}{3} + O(h^3)$$
\end{lem}

\paragraph{Proof.}
When $h$ is small, the parabola $P(h)$ with equation $x+ hy^2 = m$
divides $D(0,1)$ into two connected components. By Definition \ref{mediand'unensemble}, the
median value $m(h)$ of $x+ hy^2$ on $D(0,1)$ is defined as the value $m$ for which these
two connected components have equal area. The whole geometric
situation is shown in Figure \ref{figuremedianfilter}.
\MEDIANFILTER
The algebraic area between the Oy axis and the parabola is (for $|y|\leq 1$)
$$\int_{-1}^1 (m(h)-hy^2)dy = 2m(h)-\frac{2h}{3}$$
Thus $m(h)$ is the median value if and only if 
\fb&
%§\newline label D1 \newline
 \label{D1} 2m(h) -
2h/3 = 2 area(ABE) 
\fe&
where $ABE$ denotes the curved triangle bounded by the
parabola, the circle and the line $y=1$.  This area could be explicitly
computed, but we prefer to give it the simple bound~: $\frac{\hbox{
area}(ABCD)}2$. Now, the length of $(AB)$ is $ |m(h)-h|$ and the length of $(BC)$ is
less than $ (m(h)-h)^2$, so that (\ref{D1}) implies
$$|2m(h) - \frac{2h}{3}| \leq |m(h)-h|^3.$$
We conclude that
$m(h) = h/3 + O(h^3)$, as announced.
\endproof

%%%%%%%%%%%%% PAGE E %%%%%%%%%%%%

\PMEDIANFIX

\paragraph{Proof of Theorem \ref{B1}.}
The operator
$$Tu(\fxx)=\med_{D(0,1)}u(\fxx)$$
satisfies the conditions of Theorem \ref{xviii.1}.  By Lemma \ref{C1}, the
function $H$ associated with $T$ satisfies $H(0)=0$, so that the conclusions
(i) and (ii) of Theorem \ref{xviii.1} are satisfied.  From Theorem \ref{xviii.1}
and Lemma \ref{C1} we obtain
$$H(h)=\frac h 3 + O(h^3)$$
Thus Relation (i) in Theorem \ref{xviii.1}  yields
$$\med_{D(0, h)}u(\fxx) = u(\fxx)+h|Du(\fxx)|(\frac 1 6 h \curv(u))+O(h^{3})$$ 
on compact subsets of $\{\fxx, |Du(\fxx)|\neq 0\}$.
Relation (ii) follows immediately from Theorem \ref{xviii.1}(ii).
\endproof


%%%\PMEDIANITTOONE
\PMEDIANITTOTWO

\subsubsection {Second application~: the Catt\'e-Dibos scheme \label{Catte}}
\begin{th1} \index{asymptotic behavior!Catte-Dibos scheme}
Let $\SetB$ be the set of all segments of the plane with length 2
and  centered at zero. 
Set
$$SI_hu(\fxx) = \sup_{B\setB}\inf_{\fxy \in \fxx+hB}u(\fxy)$$
and, similarly,
$$IS_hu(\fxx) = \inf_{B\setB}\sup_{\fxy \in \fxx+hB}u(\fxy).$$
Let $u$ be a $C^3$ function in $\real^2$. Then
$$
  \frac 1 2 (IS_h+SI_h) u(\fxx_0) = u(\fxx_0) + h^2 \frac{1}{4} \curv(u)
|Du|(\fxx_0)  + O(h^{3})
$$
if $Du (\fxx_0) \neq 0$.
\end{th1}

\PCMPMS  
\paragraph{Proof.} 
 Let us compute the
function $H_1(h) = IS_h[x+hy^2](0)$ associated with $IS_h$.
 Writing $(x,y)=(r\cos\theta, r\sin\theta)$ in polar coordinates,  we have
$$H_1(h)=\inf_{-\frac \pi 2\leq \theta\leq \frac \pi 2}\sup_{-1\leq r\leq
1}(rcos\theta+hr^2sin^2\theta).$$
Since, for $h\geq 0$, the function $r\rightarrow rcos\theta+hr^2sin^2\theta$ is increasing when
$r\geq 0$, we obtain
$$H_1(h)=\inf_{-\frac \pi 2\leq \theta\leq \frac \pi 2}(cos\theta + h
sin^2\theta)=h$$ if $h\geq 0$ is small enough (e.g. $h<\frac 12$).  If $h\leq 0$, we have
$H_1(h)=0$ because  $rcos\theta + hr^2sin ^2\theta \leq  cos\theta.$  
 By doing exactly the same computations for $SI_h$, we
get in that second case for the associated function $H_2(h)=h^-$.  We notice that in
both cases, $H_i(0)=0$, so that the conclusions (i) and (ii) of
Theorem \ref{xviii.1} apply.  Adding the relations (i) thus obtained for $IS_h$ and
$SI_h$ yields the announced result.
\endproof

\begin{Exercice}  Let $\SetB$ be the set of all rectangles  of the plane with length 2, width 
$\delta<1$ and  centered at zero. 
\newline (i)
Set
$$SI_hu(\fxx) = \sup_{B\setB}\inf_{\fxy \in \fxx+hB}u(\fxy)$$
and, similarly,
$$IS_hu(\fxx) = \inf_{B\setB}\sup_{\fxy \in \fxx+hB}u(\fxy).$$
Let $u$ be a $C^3$ function in $\real^2$. Compute an asymptotic expansion of
$IS_h u(\fxx)$, $SI_hu(\fxx)$ and  $ \frac 1 2 (IS_h+SI_h) u(\fxx) $
  as $h\to 0$. 
 \newline (ii) Take $\delta = h$ and compute  the asymptotic expansions of the same operators.
 \newline (iii) Take $\delta =h^\alpha$ and interpret the results of the asymptotic expansions
 when $\alpha<1$ (resp. $\alpha>1$).
\end{Exercice}

\zbibnote


Bence, Merriman and Osher \cite{Merriman:1992:DGM} discovered and gave some heuristic arguments proving
that a convolution of a shape with a gaussian followed by a $\frac 12$ thresholding
simulated the motion by mean curvature 
$\frac{\partial u}{\partial t}=|Du|curv(u)$. The consistency of their arguments
was checked by Mascarenhas \cite{Mascarenhas:1992:DGM}.  Barles-Georgelin
\cite{Barles:1995:SPC} and Evans \cite{Evans:1993:CAM} also give a consistency proof
and in addition prove that the iterated weighted gaussian median filtering converges
to the mean curvature motion.  An extension of this result to any iterated
weighted median filter is given in \cite{Ishii:1994:GBM}.
An interesting attempt to generalize this result to vector median filters
is made in Caselles et al. \cite{Caselles:2000:VMF}.
Catt\'e, Dibos and Koepfler \cite{Catte:1995:MSM} linked the mean curvature motion with classical
morphological filters whose structuring elements are oriented one-dimensional
sets in all directions \cite{Nagao:1979:EPS,Soille:1996:RIE}
 A question arises from the main asymptotic convergence theorem : are 
there sets of structuring elements permitting to obtain any function $H$ ?
As is shown in this chapter, $H(s)=s$ is attained by the median filter. Pasquignon
\cite{Pas3} has extensively studied this question and gives a positive answer 
for all power functions $H(s)=s^\alpha$ with simple families of structuring elements.  
The presentation of the main results of this chapter is mainly original and 
was announced in the tutorials \cite{Guichard:1996:PDE, Guichard:1995:PDE} with an
early version in \cite{Guichard:1994:AAM}.




%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Asymptotic behavior of contrast invariant operators (Dimension $N$) \label{chapter10}}

We now consider a generalization of the asymptotic results of the preceding chapter  to arbitrary
dimensions. Our aim is to show that all inf-sup filters, when rescaled, are equivalent to a motion of the volumic image by its principal curvatures.  We refer to Section \ref{theprincipalcurvaturesofalevelsurface} for the definition of principal curvatures of a level surface.
We shall then, as in the preceding chapter, analyse several multidimensional filters. We shall in particular relate the median filter to the mean curvature of the level surface.
\section {\label{AsymptotictheoremND} Asymptotic behavior theorem in arbitrary
dimension.}

 Our main asymptotic theorem will be a simple 
adaptation to arbitrary dimensions  of Theorems  \ref{xviii.1(i)} and \ref{xviii.1}  ; the proof will be  basically the same.  We just need to fix some notations. 
We consider the Euclidean space $\real^N$, and if $\fxx \in \real^N$ we set
$\fxx=(x, y_2,..., y_N)=(x,y)$, so that $y\in \real^{N-1}.$ We also set $b=(b_2,
..., b_N)$ and for any $h>0$,
 \fb&
\label{xviii.0-bis} 
%§labelxviii.0-bis \newline
H(b)=T(x_1+b_2y_2^2+...+b_Ny_N^2)(0)
\fe&
where
$$
Tu(\fxx)= \sup_{B \in \SetB} \inf_{\fxy\in \fxx + B}u(\fxy).
$$
In this chapter, $\SetB$ is assumed to be a set of parts of
$\real^N$ which is invariant by linear  isometries of  $\real^N$ and such that all
elements of
$\setB$ are contained in a ball $B(0,M)$. As in the preceding section,
 $$T[x_1+h(b_2y_2^2+...+b_Ny_N^2)]$$
 is a short notation for 
\newline ``$T(u)$ with
$u(\fxx)=u(x,y)=x_1+h(b_2y_2^2+...+b_Ny_N^2)$".
\newline
 Since $T$ is monotone, $H$ is a
nondecreasing function with respect to  each $b_i$. It  is, in addition,
Lipschitz, by the same argument yielding (\ref{xviii.2})~:
\fb& 
 |H(b) - H(b')| \leq M^2 |b-b'|. 
\fe&
If $u(\fxx)$ is a $C^3$ function, we denote, as in Definition
\ref{definitionprincipalcurvatures},  by
$\kappa(u)=(\kappa_2, ..., \kappa_N)$ the $N-1$ eigenvalues of the restriction of
$D^2u(\fxx)$ to the hyperplane $(Du)^\perp$ orthogonal to $Du$ (provided $Du\neq
0$.)  The $\kappa_i$ are  the principal curvatures of the level surface of $u$,
$\{\fxy,\; u(\fxy)=u(\fxx)\}$ passing by $\fxx$.



\begin{th1} \index{asymptotic behavior!arbitrary dimension}
\label{xviii.1-bis}
%§label xviii.1-bis\newline

Let $\setB$ be a family of structuring elements in $\real^N$ which
is bounded ( $\forall B \in \SetB$, $B \subset B(0,M)$) and isotropic
(if $B \in \setB$, then R$B \in \setB$ for every isometry R of
$\real^N$).

Let $Tu(\fxx) =\infsup& u(\fxy)$ or $ Tu(\fxx) = \supinf& u(\fxy)$  
and define the rescaled operator
$$T_hu(\fxx) = \infsuph& u(\fxy)\quad \hbox{( resp. } T_hu(\fxx) = \supinfh&
u(\fxy)  \hbox{ )}$$ Then, setting 
$H(b)=T[x_1+b_2y_2^2+...+b_Ny_N^2](0)
$ and assuming that
$u$ is a $C^3$  function on $\real^N$,

(i) if $H(0) \neq 0$, then
$$(T_h u)(\fxx) = u(\fxx)+ hH(0)|Du|(\fxx) + O(h^2); $$

(ii) if $H(0)=0$, then on every compact set $K$ contained in  $\{\fxx, Du(\fxx) \neq 0\}$,  
$$T_h u(\fxx) = u(\fxx) + h |Du(\fxx)| H(h\frac{1}{2}\kappa(u)) +
O_{\fxx}(h^3);$$
where   $|O_{\fxx}(h^3)|\leq C_Kh^3$ for some constant $C_K$ depending only on $u$ and $K$;

(iii) if $H(0)=0$, then on every compact $K$ of $\real^N$,
$$|T_h u(\fxx) -u(\fxx)| \leq h^2M^2 ||D^2u(\fxx)||+ O_{\fxx}(h^3),$$
where   $|O_{\fxx}(h^3)|\leq C_Kh^3$ for some constant $C_K$ depending only on $u$ and $K$.
\end{th1}

\paragraph{Proof.}
This proof follows exactly the proofs of Theorems \ref{xviii.1(i)} and \ref{xviii.1} ; we
simply have to adjust the preliminaries of the proof of Theorem \ref{xviii.1(i)}.
 We notice that $T(u-u(\fxx)) = Tu -u(\fxx)$ and that, $T$ being
translation and isometry invariant, we can choose the origin 0 at
$\fxx$, and the orthogonal axes $(\vec i_1,..., \vec i_N)$ so that $\vec i_1 =
\frac{Du}{|Du|}(0)$ if $Du \neq 0$ and $\vec i_2, ..., \vec i_N$ are the
eigenvectors of the restriction of $D^2u(\fxx)$ to the hyperplane $Du(\fxx)^\perp$.

  Since $u$ is $C^3$, we can therefore write 
\fb&
\label{xix.1-bis}
%§\newline label xix.1-bis\newline
 u(\fxx) = px+ ax^2 + b_2y_1^2+...+ b_N y_N^2+
(c.y)x + O(|\fxx|^3),  \fe&
where $p=|Du|(0)\geq 0$, $c=(c_2, ..., c_N)$, $c.y$ denotes the scalar product in
$\real^{N-1}$  and for $l=2,...,N$,
  \fb&
 \begin{array}{l} b_l=\frac{1}{2} \frac{\partial^2
u}{\partial y_l^2} (0) = \frac{1}{2} D^2u(\vec i_l, \vec i_l) \\ \\
a=\frac{1}{2} \frac{\partial^2 u}{\partial x^2} (0) = \frac{1}{2} 
D^2u(\vec i_1, \vec i_1) \\ \\
c_l=\frac{\partial^2 u}{\partial x \partial y_l} (0) = D^2u(\vec i_1, \vec
i_l). \\
\end{array}
\fe&
In addition, if $p \neq 0$, we have
\fb& 
 b_l=\frac{1}{2} |Du| \kappa_i(u)(0). 
\fe&
>From this point, the proof of Theorem \ref{xviii.1-bis} is identical to the proof of
Theorem \ref{xviii.1}.  We simply have to replace in formulas
(\ref{numero1}) to (\ref{numero2}) the expressions ``$cxy$" by   ``$x(c.y)$", ``$by^2$"
by ``$b_2y_1^2+...+b_Ny_N^2$" and
``$\curv(u)$" by ``$\kappa(u)$".  Of course, ``$|c|$"  denotes the Euclidean
norm of $c$ in $\real^{N-1}$.
\endproof


\PSKELTROIS

\section{Asymptotic behavior of weighted median filters in arbitrary dimension.
\label{Weighted}}

In this section, we  consider  $C^3$ real
functions $u$ defined  in $\real^N$ and a radial, nonnegative,
 continuous function  $k(\fxx) = k(|\fxx|)$ satisfying $\int_{\real ^N}k(\fxx)d\fxx=1$.  We
have defined  the measure  with density $k$ by 
$$|E|_k=\int_Ek(\fxx) d\fxx$$
and the median operator, weighted by $k$ by Formula (\ref{formesupinfdumedian}), that is

\fb&
\med_k(u)(\fxx) = \sup_{|B|_k\geq \frac 12}\inf_{\fxy \in B+\fxx}u(\fxy)
\fe&
We assume also that $k$ satisfies the assumption of  Proposition  \ref{med=med-}, so that 
for continuous functions $u$,
$\med_k^-u$ and
$\med_k  u$ coincide. This is true, e.g., if $k$ is continuous and if the set $\{\fxx,
k(\fxx)>0\}$ is connected.   
We now
give an infinitesimal interpretation of the median filters.  In order to do so,
we ``shrink"
$k(\fxx)$ into
$k_h(\fxx)=h^{-N}k(\frac{\fxx}h)$, which corresponds to the scaling of the structuring
elements by a factor $h$.  Without risk of confusion, we write $\med_h$ for 
$\med_{k_h}$.
We have analysed in the preceding chapter the asymptotic behaviour of the median filter in two dimensions when $k$ is the characteristic function of a disk.  The aim of the next theorem is to adress, 
in arbitrary dimension, more general forms of $k$.  We shall not make the analysis in full 
generality, because this would be uselessly heavy. We shall just treat the case where $k$ is 
smooth and compactly supported.  We shall also adress the case where $k$ is no more compactly supported, but in that case we won't be in a position to apply Theorem \ref{xviii.1-bis} because
the set of structuring elements is then no more bounded. We shall adress and solve later  this difficulty,  in 
Chapter \ref{Localization }.
 As a canonical example of application of the next theorem we can 
think of the case where $k$  is the  Gauss function.
\begin{th1}
\label{B1-bis}
%§label B1-bis\newline
  Let $k$ be a radial nonnegative  function with integral 1 in the Schwartz class $\cal S$.  We assume that the support of $k$ is compact, connected, and contains 0.  Then, there
 exists a constant $c(k)$ such that if $u$ is a
$C^3$ Lipschitz function in $\real^N$, then 

(i) On every compact set $K$ contained in  $\{\fxx, Du(\fxx) \neq 0\}$,  
$$
(\med_hu)(\fxx) = u(\fxx)+\frac 12 h^2|Du(\fxx)|c(k) \Sigma_{i=2}^N
\kappa_i(u))+O_{\fxx}(h^{3});
$$
where   $|O_{\fxx}(h^3)|\leq C_Kh^3$ for some constant $C_K$ depending only on $u$ and $K$.

(ii) On every compact $K$ of $\real^N$,
$$|\med_h u(\fxx) -u(\fxx)| \leq h^2M^2 ||D^2u(\fxx)||+ O_{\fxx}(h^3),$$
where   $|O_{\fxx}(h^3)|\leq C_Kh^3$ for some constant $C_K$ depending only on $u$ and $K$.
\end{th1}


\begin{lem}
\label{C1-bis}
%§ label C1-bis\newline
  Let $k$ be a radial nonnegative  function with integral 1 in the Schwartz class $\cal S$.  We assume that the support of $k$ is  connected, and contains 0. (We do not assume that the support of $k$
is compact, so that the Gauss function is a valid example).
Then
  the function $H(hb)= \med_{k}[x+ h(b_2y_2^2+... +b_Ny_N^2)](0)$ associated
with the weighted median filter by Relation (\ref{xviii.0-bis}) satisfies
$$H(hb) =c(k)(\Sigma_{i=2}^N b_i)h + o(h),$$
where 
$$c(k)=\frac 
{\int_{\real^{N-1}}y_2^2k(y)dy}
{\int_{\real^{N-1}}k(y)dy}.
$$
and  $y=(y_2, ..., y_N)\in\real^{N-1}$, $b=(b_2, ..., b_N)\in \real^{N-1}.$

\end{lem}

\paragraph{Proof.}
Repeating the analysis of Lemma \ref {C1}, we notice that the median value
$m(h)=\med_{k}[x+h(b_2y_2^2+...+b_Ny_N^2)](0)$  is defined by
\fb&
 \label{m(h)def} 
%§label m(h)def \newline
  \int _{\real^{N-1}}dy 
\int_0^{m(h)-h(b_2y_2^2+...+b_Ny_N^2)}k((x^2+ y^2)^\frac 1 2)dx=0.
\fe&
This formula uniquely defines $m(h)$ because its first member is a
strictly increasing, continuous function of $m(h)$ in a neighborhood of 0.
  Formally differentiating
(\ref{m(h)def}) with respect to $h$ yields
$$
m'(h)\int_{\real^{N-1}}k((y^2+(m(h)-h(b_2y_2^2+...+b_Ny_N^2))^2)^\frac 1 2)dy
=$$
$$\quad\quad\int_{\real^{N-1}}(b_2y_2^2+...+b_Ny_N^2)
k((y^2+(m(h)-h(b_2y_2^2+...+b_Ny_N^2))^2)^\frac
1 2)dy.
$$
In
order to reduce the size of formulas, we set
\fb&
\label {phipsidef}
%§\newline label phipsidef\newline
\varphi(a,h)=\int_{\real^{N-1}}
(b_2y_2^2+...+b_Ny_N^2)k((y^2+(a-h(b_2y_2^2+...+b_Ny_N^2))^2)^\frac
1 2)dy, 
\fe&

\fb&
\psi(a,h)= \int_{\real^{N-1}}k((y^2+(a-h(b_2y_2^2+...+b_Ny_N^2))^2)^\frac 1 2)dy.
\fe&
These functions  are well defined, $C^\infty$  and positive for small $a$ and $h$ because of the
assumptions on $k$.
 So we obtain
$$
m'(h)\psi(m(h),h)-\varphi(m(h),h)=0,
$$
and formally again,
\fb&
\label {m'(0)=}
%§label m'(0)=\newline
m'(0)=\frac {\varphi (0,0)}{\psi (0,0)}=(\Sigma_{i=2}^{N}b_i)
\frac 
{\int_{\real^{N-1}}y_2^2k(y)dy}
{\int_{\real^{N-1}}k(y)dy}= c(k)(\Sigma_{i=2}^{N}b_i).	
\fe&
 This formal computation is easy to justify.  We simply introduce the ordinary
differential equation
\fb&
\label {ODEm(h)}
%§label ODEm(h)\newline
\tilde m'(h)=\frac {\psi(\tilde m(h),h)}{\varphi(\tilde m(h),h)},\quad \tilde
m(0)=0, 
\fe&
which has, by Peano Theorem (\cite{??}), a solution on some interval
$\hbox{[}0,h_0\hbox{[}$. Indeed, the second member of (\ref {ODEm(h)})  is $C^\infty$
with respect to $h$ and
$\tilde m(h)$.  Multiplying both members of (\ref {ODEm(h)}) by $\varphi(\tilde
m(h),h)$ and integrating between 0 and $h$ yields
 \fb&
 \int _{\real^{N-1}}dy\int_0^{\tilde
m(h)-h(b_2y_2^2+...+b_Ny_N^2)}k((x^2+y^2)^\frac 1 2)dx=0.
\fe&
Thus $\tilde m(h)$ satisfies (\ref{m(h)def}) and therefore $m(h)=\tilde m(h)$ on 
$\hbox{[}0,h_0\hbox{]}$.  As a consequence, (\ref{m'(0)=}) is true.  We can also differentiate
(\ref{ODEm(h)}) as many times as we wish with respect to $h$ and we therefore obtain by Taylor formula
$$H(hb) = m(h) =c(k)(\Sigma_{i=2}^N b_i)h + O(h^2).$$
In addition, since $\phi$ and $\psi$ and their derivatives with respect to $a$ and $h$ are continuous functions of $b$ at any order of derivation,  the obtained $O(h^2)$ is obviously uniform if  $b=(b_2, ... , b_N)$ stays
in an arbitrary compact set of $\real^{N-1}$.  
 \endproof

\paragraph{Proof of Theorem \ref{B1-bis}.}
The operator $Tu(\fxx)=\med_ku$ has a ``supinf" form and his set of structuring elements
$$\setB= \{B, \; |B|_k \geq \frac 12, \; B\subset \hbox{\rm Support}(k)\}$$
is isotropic and bounded.  Thus, $T$ satisfies the
conditions of Theorem
\ref{xviii.1-bis}.  By Lemma
\ref{C1-bis}, the function $H$ associated with $T$ satisfies $H(0)=0$,  and we
obtain the conclusions (ii) and (iii) of Theorem \ref{xviii.1-bis}.  Using  Lemma
\ref{C1-bis} yields
$$
H(hb)= c(k)(\Sigma_{i=2}^N b_i)h +O(h^2)
$$
and therefore, by Theorem \ref{xviii.1-bis}(ii),
$$
(\med_hu)(\fxx) = u(\fxx)+h^2|Du(\fxx)|c(k)(\frac 1 2 \Sigma_{i=2}^N
\kappa_i(u)))+O_{\fxx}(h^3)
$$ 
with $\vert O_{\fxx}(h^3)\vert \leq O_K(h^3)$
on compact sets $K$ where $|Du(\fxx)|\neq 0$.  The assertion (ii) follows immediately from Theorem
\ref{xviii.1-bis}(ii).
\endproof
\begin {Exercice}
Adapt the proof of Theorem \ref{B1-bis} and of Lemma \ref{C1-bis} to the case where $k$ only is $C^0$ and
 compactly supported, with connected support containing 0 in its interior. (As an example, we can
take $k$ proportional to the characteristic function of the unit ball).

\end{Exercice}


\subsection{\label{3Dinfsup} The three-dimensional case}
The third dimension opens many degrees of freedom in the synthesis of
contrast invariant operators with respect to dimension 2 ; indeed, we can now play with two
variables instead of one, the principal curvatures of the level surface, which
we order so that
$\kappa_1\leq \kappa_2$.  We list a series of examples as exercises. They  are easy
applications of Theorem \ref{xviii.1-bis}. 
We shall in the following exercises consider a two-dimensional set $B$ and we set 
$\setB=\{RB, \quad R\in SO(3)\}$. The set of structuring elements $\setB$ is  obtained by rotating in $\real^3$ a
single subset of $\real^2$ in all possible ways.  We set, as usual, 
$$
SI_hu(\fxx)= \sup_{B \in h\SetB}\inf_{\fxy\in \fxx + B}u(\fxy)
$$
and
$$
IS_hu(\fxx)= \inf_{B \in h\SetB}\sup_{\fxy\in \fxx + B}u(\fxy).
$$
\begin{Exercice}
Let $B$ be a segment with length 2 centered at 0. Our aim is to show that
$$IS_hu=u+\frac 1 2 h^2\kappa_1^+|Du|+O(h^{ 3}),$$
$$IS_h(SI_h)u=u+\frac 1 2 h^2(sign(\kappa_1(u))+sign(\kappa_2(u))min(|\kappa_1|,
|\kappa_2|) + O(h^{3}).$$
\newline 
(i)Compute for $T=IS_h$ the function
$$H(b)= T[x_1 + b_2y_2^2+b_3y_3^2](0),$$
where $\fxx = (x_1, y_2, y_3).$ 
\newline (ii) Since  $H(0)=0$ deduce from
Theorem \ref{xviii.1-bis} that
\fb&
\label{whynot}
T_hu(\fxx)=u(\fxx)+h|Du(\fxx)|H(h\frac 1 2 \kappa_1, h\frac 1 2\kappa_2) + O(h^3).
\newline
(ii) Computation of $H(b)$.
 By a symmetry argument, show that
the ``inf-sup" is attained for a segment contained in the
plane $x_1=0$, so that 
$$H(b)=\inf_{\SetB}\sup_{B\in\SetB} b_2y_2^2+b_2y_3^2
=\inf_{\theta}\sup_{0\leq r\leq 1}r^2(b_2\cos^2\theta + b_3\sin^2\theta).$$
Deduce that
if $b_2\leq 0$ or $b_3\leq 0$, this yields $H(b)=0$.
If $0\leq b_2\leq b_3$, deduce that $H(b)=b_2$.  Conclude by using (\ref{whynot}) that
$$T_hu(\fxx)=u(\fxx)+h^2|Du(\fxx)|\frac 1 2 \kappa_1^+ +O(h^{3})$$
as announced.  
\fe&
\end{Exercice}
\begin{Exercice} By using the same method as in the preceding exercise, show that
 if $B$ is made of two symmetric points, (1,0,0) and (-1, 0, 0), then
$$IS_hu=u+\frac 1 2 h^2|Du|min(\kappa_1(u), \kappa_2(u)) + O(h^{3}),$$
$$SI_hu=u+\frac 1 2 h^2|Du|max(\kappa_1(u), \kappa_2(u)) + O(h^{3}),$$
$$IS_h(SI_h)u=u+\frac 1 2 h^2|Du|(\kappa_1(u)+ \kappa_2(u)) + O(h^{3}).$$ 
The last formula yields the mean curvature of the level surface of $u$ at
$\fxx$. \index{mean curvature}
\end{Exercice}
\begin{Exercice}
 (i) If $B$ is made of two orthogonal segments with length 2 each and
centered at 0, show that
$$IS_hu=u+h^2|Du|\frac 1 2 (\kappa_1(u)+ \kappa_2(u))^+ + O(h^{3}),$$
$$SI_hu=u+h^2|Du|\frac 1 2 (\kappa_1(u)+ \kappa_2(u))^- + O(h^{3}).$$
(ii) Prove that one can get directly the mean curvature by simply taking for $B$ the
endpoints of both orthogonal segments. Check that another possibility to obtain the mean
curvature is to alternate the preceding schemes, or to add them.
\end{Exercice}




\P3DVERT

\newpage

\zbibnote

The references for this chapter are essentially the same as in the preceding one, devoted to the dimension 2.  The main theorem on the asymptotic behaviour of morphological filters was first stated and proved in \cite{Guichard:1996:PDE, Guichard:1995:PDE}. The examples, given in the last section, of possible morphological filtering with their subjacent surface motion equations are not published elsewhere.  The consistency of gaussian smoothing followed by thresholding with the Mean Curvature Motion was proved in increasing mathematical sophistication and generality by Bence, Merriman and Osher \cite{Merriman:1992:DGM}, Mascarenhas \cite{Mascarenhas:1992:DGM},  Barles-Georgelin
\cite{Barles:1995:SPC} and Evans \cite{Evans:1993:CAM}. Our presentation here is slightly more general than the one in these authors (we allow any weight function in the Schwartz class). The best general result is given by Ishii \cite{Ishii:1994:GBM}.  


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

\chapter{Affine invariant mathematical morphology
\label{chapter11} \label{affinemorphology}}

In this chapter, we consider ways to erode or dilate a shape in an affine invariant
way. The affine invariance requirement is a further extension of the obvious translation invariance and the isotropy (rotation invariance) which we already considered for 
convolutions, erosions  and dilations. 
Let us mention that a translation is characterized as a transform which  preserves distances between points
and the angle of each vector with a fixed direction.  Isometries (rotations-translations) preserve distances between points and angles between vectors.  Similarities (i.e. isometries followed by a zoom) preserve angles between points.
Then, affine transforms are characterized as transforms of an image which preserve parallelism
and projective transforms as transforms which preserve alignments.  This is the classical hierarchy of ``anamorphoses'', or image deformations, we can face in image processing.
 
 When we take a photograph of a plane image, like a painting,
we perform  a transform which preserves 
alignments, that is, a projective transform.  When we take a photograph of a plane image
from  a long enough distance, however, the transform tends to preserve parallelism. We then perform
an affine transform and a rectangle looks like a parallelogram.  This rule is used  in the paintings of the traditional chinese painting, which tends to always display scenes seen from some 
distance.  (See Exercise \ref{parallelismeimpliqueaffine} at the end of this chapter.)
  To take a more up to date  example, most photocopy machines perform an affine transform and so do fax machines and even scanners.  Thus, the analysis of scanned or copied plane documents
must be affine invariant in order to get rid of this artefactual deformation.
We shall here explore with much detail set operators which are affine invariant. 
We shall prove further in this book (Chapter \ref{allcontrastinvariantandaffinescalespaces} that it is impossible to perform a shape smoothing with 
more invariance than the affine one.

\begin{Defi}\label{specialaffineinvariant}\index{special affine invariance}
 Let 
$A= \left(
\begin{array} {cc}
a & b \\ 
c & d 
\end{array}
\right)$ 
be an arbitrary matrix
such that $\mathrm{det} \, A =ad - cb=1$.
The set of such matrices is the so called ``special linear group", $SL(\real^2)$.
We say that an operator $T$ is special affine invariant if $T$ commutes with $A$
for every $A$ in $SL(\real^2)$ : $AT=TA$.
\end{Defi}

We first define an ``affine invariant distance" of a point $\fxx$ to a set 
$X$ which will be a substitute to the 
classical euclidean one. We consider shapes $X$, that is, in whole generality,
subsets of $\real^2$. Let $\fxx \in \real^2$ and $\Delta$ an arbitrary straight
line passing by $\fxx$. We consider all connected components of $\real^2 \setminus (\bar(X) \cup \Delta)$. If $\fxx \notin \bar{X}$,
two and only two of them contain $\fxx$ in their boundary. We denote them by 
$\mathrm{CA}_1 (\fxx, \Delta, X)$, $\mathrm{CA}_2 (\fxx, \Delta, X)$, we call them the ``chord-arc sets" defined by $\fxx$, $\Delta$ and $X$, and we order them so that 
$\mathrm{area}(\mathrm{CA}_1 (\fxx, \Delta, X)) \leq \mathrm{area}(\mathrm{CA}_2 (\fxx, \Delta, X))$.


\begin{Defi}
\label{affine_distance}\index{affine distance to a plane set}
Let $X$ be a subset of $\real^2$ and $\fxx \in \real^2, \fxx \notin \bar{X}$. We call affine distance of $\fxx$ 
to $X$ the real number 
$\delta(\fxx, X)=\inf_{\Delta} \mathrm{area}(\mathrm{CA}_1 (\fxx, \Delta, X))^{1/2}$ if $\fxx\notin \bar(X),$ 
$\delta(\fxx, X)=0$ if $\fxx\in \bar(X)$.
\end{Defi}

\vskip 0.1cm
\begin{Remark} Obviously, we take the power $1/2$ in order that the affine distance
be homogeneous to a length. The affine distance can be infinite : 

Take e.g. a closed convex set $X$ and $\fxx$ outside $X$. Then it is easily seen that 
$\delta(\fxx, X)=+\infty$ because all chord-arc sets defined by all straight lines 
$\Delta$ are infinite.
\end{Remark}

\begin{figure}[htbp]
\begin{center}
\mbox{\gfigbox{100mm}{\FDIR/fig1}}
\caption[Affine distance to a set]{Affine distance to a set.}
\label{figure_chord_arc_min}
\end{center}
\end{figure} 

\begin{Defi}
\label{affine_dilation/erosion}
Let $X$ be a shape, i.e. a subset of $\real^2$. We call affine $a$-dilate of
a set $X$ the set $ \tilde{D}_a X = \{ \fxx, \delta(\fxx, X) \leq a^{1/2} \}$.
We call affine $a$-eroded of set $X$ the set 
$ \tilde{E}_a X = \{ \fxx, \delta(\fxx, X^c) > a^{1/2} \}=(\tilde{D}_a X^c)^c$.
\end{Defi}

\begin{Exercice}
Show that 
$\tilde E_aX=(\tilde D_a(X^c))^c.$ This relation shows that it is equivalent to erode a set or to dilate its complementary set : a useful symmetry, since the same shape may appear as an upper level set or as the complementary set of an upper level set, depending on whether it is darker or brighter than the background.
\end{Exercice}

\begin{remark} The denominations ``erosion" and ``dilation" for the preceding operators do not correspond to the standard terminology in Mathematical Morphology.  Indeed, a dilation must commute with the set union and an erosion with the set intersection. It is easily checked that the affine erosions and dilations as defined above do not satisfy this requirement. \footnote{We thank Michel Schmitt for pointing us out this fact}.  All the same, we shall maintain these names, because affine erosions and dilations as we have just defined are clearly 
sound generalizations of the euclidean ones.
\end{remark}

\begin{pro}
\label{prop_affine_inv_erosion/dilation}
The affine invariant erosions and dilations $\tilde{E}_a$ and $\tilde{D}_a$ are
special affine invariant monotone operators.
\end{pro}

\paragraph{Proof}
\label{proof_prop_affine_inv_erosion/dilation}
It is easily seen that if $X \subset Y$, then for every $\fxx$, 
$\delta(\fxx, X) \geq \delta(\fxx, Y)$. From this, we deduce that 
$X \subset Y  \Rightarrow \tilde{D}_a X \subset \tilde{D}_a Y$. 
The monotonicity of $\tilde{E}_a$
follows by the duality relation $\tilde{E}_a X = (\tilde{D}_a X^c)^c$.
The special affine invariance of $\tilde{D}_a$ and $\tilde{E}_a$ follows from the
fact that if $\mathrm{det} A = 1$, then $\mathrm{area} (X) = \mathrm{area} (AX)$.
%\square
\enddemo

\begin{Exercice}
\label{remark_affine_inv_erosion/dilation}
Show that $\tilde{E}_a$ and $\tilde{D}_a$ are affine invariant in a sense similar to
Definition \ref{defaffineinvarianced'unscalespace}, namely that for every linear map $A = \left(
\begin{array} {cc}
a & b \\ 
c & d 
\end{array}
\right)$ 
with ${\rm det} A > 0$, $A \tilde{E}_{({\rm det} A)^{-1/2} a} = \tilde{E}_a A$.
\end{Exercice}

We shall now use  Matheron Theorem  \ref{Matheronensembles} in order to give a standard form to $\tilde{E}_a$ and $\tilde{D}_a$.
According to this theorem, we can associate withh any  translation invariant monotone operator acting on a set of subsets of $\real^N$ a family of sets $\setB\subset{\cal P}(\real^N)$, defined by
$\setB= \{X, 0\in T(X)\}$ and  such that 
$$T(X)= \bigcup_{B\in \setB}\bigcap_{\fxy\in B} X-\fxy =\{\fxx, \exists B \in \setB, \fxx+B\subset X\}.$$
We can apply this theorem to $\tilde E_a$, provided we identify its associated structuring elements.

\begin{Defi}
\label{affine_structuring_element}\index{affine structuring element}
We say that $B$ is an affine structuring element if $B$ is a set whose interior contains
$0$, and if there is some $b > 1$ such that for every line $\Delta$ passing by
$0$, both  connected components of $B \setminus \Delta$ containing $0$ in their boundary have
an area larger or equal to $b$. We denote the set of affine structuring elements by 
$\setB_{\mathrm{aff}}$.
\end{Defi}

\begin{figure}[htbp]
\begin{center}
\mbox{\gfigbox{100mm}{\FDIR/fig2}}
\caption[An affine structuring element]{An affine structuring element : all lines passing by $0$ divide $B$ into
several connected components. The two of them which contain $0$ in their boundary
have area larger or equal to $B$.}
\label{figure_structuring_element}
\end{center}
\end{figure}

\begin{pro}
\label{structuringelementsaffine}
For every set $X$, 
$$\tilde{E}_a X = \bigcup_{B \in \setB_{\mathrm{aff}}} \bigcap_{\fxy \in a^{1/2} B} X-\fxy = 
\{ \fxx, \exists B \in \setB_{\mathrm{aff}}, \fxx + a^{1/2} B \subset X \} $$
\end{pro}

\paragraph{Proof}
\label{proof_inf_sup_erosion}
We simply apply Matheron Theorem \ref{Matheronensembles}. The set of structuring elements associated
with $\tilde{E}_a$ is $\setB= \{X, \tilde{E}_a X \ni 0 \}$.
Now, $$\tilde{E}_a X \ni 0 \Leftrightarrow \delta(0, X^c) > a^{1/2} 
\Leftrightarrow {\rm inf}_{\Delta} {\rm area}({\rm CA}_1 (0, \Delta, X))^{1/2} 
> a^{1/2}.$$
\noindent
Let us call $b$ the value of the preceding infimum.  
This las relation means that for every $\Delta$, both connected components of $X \setminus \Delta$
containing $0$ have area larger than  $b > a$. Thus,
$X$ belongs to $a^{1/2} \setB_{\rm aff}$ by definition of $\setB_{\mathrm{aff}}$.
%\square
\enddemo

By Proposition \ref{structuringelementsaffine}, $\fxx$ belongs to $\tilde{E}_a X$ if 
and only if for every straight line $\Delta$, chord-arc sets containing $\fxx$ have an
area strictly larger than $a$.
Let us now characterize the points which belong to $X$ but not to 
$\tilde E_aX$.

\begin{Defi} \label{definitiondechordarcset}  We call chord-arc set of 
$X$ any connected component of $X\setminus \Delta$, where $\Delta$ is an arbitrary straight line.
\end{Defi}

\begin{cor}
\label{erosionaffinefacile}
$\tilde{E}_a X$ can be obtained from $X$ by removing, for every straight line
$\Delta$, all chord-arc sets contained in $X$ which have an area smaller or
equal than $a$.
\end{cor}

\paragraph{Proof} 	ATTENTION  DEMONSTRATION A CONTROLER 
Let $C$ be a chord-arc set of $X$, with area less or equal to $a$, and bounded by a straightline $\Delta$.  Then, we claim that for every $\fxx\in C$, 
$\delta(\fxx, X^c)\leq a^{\frac 12}.$  

\PCHORDARCSET 

Indeed, consider $\Delta'$, the straight line parallel to $\Delta$ and passing by $\fxx$.  One of $CA_1(\fxx, \Delta', X^c)$ or $CA_2(\fxx, \Delta', X^c)$ is contained in $C$ and therefore has area less or equal to $a$. Thus $\delta(\fxx, X^c)\leq a^\frac 12$ and $\fxx$ does not belong to $\tilde E_aX.$ Conversely, if 
$\fxx \in X\setminus\tilde E_aX $, then by definition there is some $\Delta$ passing by $\fxx$ such that $area(CA_1(\fxx, \Delta, X^c))\leq a.$ Thus
$C=CA_1(\fxx, \Delta, X^c)$ is a chord-arc set with area less or equal to $a$ and $\fxx$ belongs to $C$.

\enddemo
Corollary \ref{erosionaffinefacile} has a huge numerical relevance : it gives an easy
way to perform affine dilations and affine erosions. In the next section, we shall make a firt hint on how those operators are related to the (AMSS) model.




\section{Application to affine alternate curve filters}
One of the main difficulties of mathematical morphology is the non commutation of
erosions and dilations, which entails the non commutation of opening and closing.
Why is it a problem ? By performing an opening (with a ball) of a shape, we simply 
remove its external peaks.  More precisely, if we do an opening by a ball with radius
$h$, then the radius of curvature  of the external peaks becomes larger than $h$ and if we perform an opening of the shape, the radius of curvature  of the peaks pointing inside becomes larger than $h$.
Thus, the aim of opening and closing is to smooth out the peaks in exactly the same way and it would be quite desirable to have both operations made simultaneously.  In order terms, they should commute, and we could talk about a  
``curvature thresholding'' operator.  
This type of commutation is roughly   asymptotically attained by performing alternate filters \cite{Serra:1982:IAM}.  
The idea is to chose a very small scale $h$, and to alternate the openings $O$  and closings
$F$ in the 
following way :
$$O_tF_tO_{\frac t2}F_{\frac t2}...O_{\frac t{2^n}}F_{\frac t{2^n}}...$$
Since $O_t $ and $F_t$ are idempotent, the growth in scale is necessary in order to perform
a progressive smoothing, up to the scale $t$.

In the same way, affine erosions and dilations do not commute and should alternate. 
Now, they are not idempotent and the situation is simpler : we only need to choose an incremental scale $h$ small enough and to alternate $\tilde E_h$ and $\tilde D_h$, that is, to compute
$(\tilde E_h\tilde D_h)^n.$  In Chapter \ref{chapter22} we describe how to implement such an alternate
filter.  Its relevance will be demonstrated in Chapter \ref{allcontrastinvariantandaffineinvariantscalespace},  where we prove that there is 
only one way to smooth out shapes in an affine invariant way, the ``affine shortening'' or AMSS model. In  Section \ref{Convergenceofiteratedaffineinvariantoperatorstoaffineinvariantcurvaturemotion}, we shall prove that
when $h\to 0$, the iterated alternate affine erosion $(\tilde E_h\tilde D_h)^n$ converges,
when $n\to +\infty$ and $h\to 0$ in an adequate way, to the solution of the 
affine shortening equation. More precisely,
let $c_0$ be a Jordan curve, which is the boundary of a simply connected set
$X$.  Iterating affine erosions and
dilations on $X$ gives a numerical scheme that computes the affine shortening
$c_T$ of $c_0$ at a given scale $T$. If 
$c_T$ is the curve represented by the function $s\mapsto
{\bf C}(s,T)$, then
\begin{equation}
\deriva{\bf C}{t}(s,t) = \vert \mathrm{Curv}(s,t) \vert^{1/3} \vec{n}(s,t)
\label{ass.equ}
\end{equation}
where $\mathrm{Curv}(s,t)$ and $\vec{n}(s,t)$ are the curvature and the normal
vector at the point with abscissa $s$ of the curve $c_t={\bf C}(\cdot,T)$.


\begin{Exercice}\label{parallelismeimpliqueaffine}
The aim of this exercise is to prove that if an application $\tilde A$ : $\real^2\to\real^2$ preserves parallelism between pairs of points, then there is a linear map $A$ and a vector 
$\fxb$ such that $\tilde A (\fxx)=A\fxx + \fxb.$  The preservation of parallelism will be stated in the following way.
If any four points $\fxx_1, $ $\fxx_2$, $\fxx_3$ and $\fxx_4$ satisfy 
$\fxx_1-\fxx_2=\lambda(\fxx_3-\fxx_4)$  for some real number $\lambda$, then there exists a real number $\mu$ such that
$ \tilde A\fxx_1-\tilde A \fxx_2=\mu(\tilde A \fxx_3-\tilde A \fxx_4).$
\newline 1) Consider a basis $(\vec i, \vec j)$ of the plane, set 
$0=(0, 0)$ and
$\fxx = x\vec i + y\vec j.$
Set $A\fxx=\tilde A\fxx - \tilde A0$ and prove that there exist real functions
$\mu_1(x)$ and $\mu_2(y)$ such that
$A(x\vec i)=\mu_1(x)\vec i$ and $A(y\vec j)=\mu_2(y)\vec j.$
\newline
2) Notice that $A$ preserves parallelism and satisfies $A0=0.$
\newline
3) Show that $A(\fxx)=\mu_1(x)\vec i+\mu_2(y)\vec j.$
\newline
4) By using Thales' Theorem, show that $\mu_1(x)=\alpha \mu_2(x)$ for some real constant $\alpha$.
\newline
5) Replace $\vec i$ by $\beta \vec i$ and apply the preceding results : deduce that $\beta \mu_1(\beta^{-1}x)=c$ is a constant and conclude.

\end{Exercice}


\zbibnote
Clearly, planar shape recognition algorithms are be more efficient when
they are affine invariant, since most optical duplication devices (scanners, 
photocopiers, faxes) perform slight
affine distortion on planar images. Also, all diffeomorphisms are locally affine distortions.
Shape affine invariant matching techniques are described in 
\cite{Hummel:1988:AIM}
 and discussion on the role of affine  and projective
invariance for  object recognition in  \cite{Bose:1996:MBO, 
Weiss:1995:LPA, Kempenaers:1991:SRU}.
Clearly, corners and T-junctions can be seen in projective scenes with arbitrary angles. The detection 
of angles between two straight lines must be affine invariant. Algorithms are proposed in 
\cite{Blom:1992:AIC, Alvarez:1997:AMM, Vasselle:1994:FCC, Deriche:1993:CAC}.
See Merriman, Bence, Osher \cite {Merriman:1994:MMJ}
 for a very original numerical view of the
filtering of multiple junctions. Because of its relevance in Computer Vision, affine invariant definitions 
 of classical geometric measure
or integral geometry concepts have been actively sought for.
\cite{Dibos:1996:ALA} contains an interesting attempt to define an "affine invariant length"
and an "affine invariant dimension", by analogy with Hausdorff lengths and dimensions.
The diameters of the sets of a Hausdorff covering are simply replaced by their area.
Several attempts to define affine invariant analyses of discrete set points are 
described in 
 \cite {Geraets:1995:ASS, Sapiro:1997:SSC}.
  \cite{Giblin:1997:AIS} defines an affine invariant symetry set (skeleton) for shapes
and \cite{Pollick:1997:CAV} relates to affine invariance the 1/3 power law of
                 planar motion perception and generation.
Some of the techniques on affine erosions and dilations presented in this chapter were announced in \cite{Lisani:2000:AIM}. We used liberally the Matheron formalism for set monotone operators   
\cite{Matheron:1975:RSI}. 


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


\chapter{\label{Affinelocality} Localizing a family of structuring elements \label{chapter12}}


When the set of  structuring elements $\setB$ is affine invariant, the associated rescaled
 operators 
$$ IS_hu(\fxx) =\inf_{B\in h \setB}\sup_{\fxy \in B}u(\fxx+\fxy)
$$  commute with a lot of plane transforms :  with space
translations, $u(\fxx)\rightarrow u(\fxx+\fxy_0)$, with grey level translations  
$u(\fxx)\rightarrow u(\fxx)+C$, with
linear maps with determinant 1, $u(\fxx)\rightarrow u(\AA\fxx)$ where $\AA\in
SL(\real^2)$ and with  contrast changes $u \rightarrow g\circ u$  when $g$ is
continuous and nondecreasing.  Now, the affine invariance entails a loss of locality.
 The  value at $\fxx$ of $IS_hu$ may depend
upon values of $u(\fxy)$ at points which are arbitrarily far from
$\fxx$, no matter how small $h$ is.  Indeed, the linear invariance permits to stretch an element
of $\SetB$ in any direction. Indeed, if $B\in \setB$, then $A_\varepsilon B\in \setB,$ where $A_\varepsilon =\left[ \begin{array}{ll}
                 \varepsilon & 0 \\
		 0 & \frac 1\varepsilon
             \end{array} \right].$

  Thus $IS_h$ looks like an {\it a
priori}   non local operator.  We shall
see that this is not the case for a very general class of families
$\SetB$, for which $IS_h$ behaves like  a local operator, though involving
arbitrarily elongated  sets.  The locality property which we wish for
$IS_h$ (in fact, a local comparison principle) will be deduced from a
corresponding ``localizability" property for $\SetB$.  The same problematic applies
to median filters when their weight function is not compactly supported. So we shall
also treat the case of gaussian weighted median filters and show that they in fact like
local filters, their set of structuring elements $\setB$ being ``localizable''.


\section {Localizable families of structuring elements }
\begin{pro} {\bf and definition}
\label{Localizability} Let $\alpha>0$ be a positive constant which will play the role of an ``exponent of localizability''. 
We shall say that a set of structuring elements  
$\setB$ is $\alpha$-localizable  if there exists a constant $c > 0$ such that for every 
$\rho > c^{-1}$ we can assert that $$\forall B \in \setB, \exists B' \in \setB,
B' \subset D(0, \rho)$$
 and $B' \subset D_{\frac{c}{\rho^\alpha}}(B)=
\{x, d(x, B) \leq \frac{c}{\rho^\alpha}\}$,
where $d$ denotes the euclidean distance, $d(x, B)=\inf_{y \in B} d(x, y)$.
\newline
As a consequence, by rescaling by a scale factor $h$, we have the equivalent property :
 $$\exists c > 0,\; \forall r>0,\; \forall h \leq c r,\;
\forall B \in \setB_h,\; \exists B' \in \setB_h,\; B' \subset D(0, r)$$ and 
$B' \subset D_{  \frac {ch^{\alpha+1}}  {r^\alpha}  }(B)$.
\end{pro}

\paragraph{Proof}
\label{proof_localizable}
In order to deduce the second relation from the first, we simply set 
$r=\rho h$. We have $B \in \setB$ if and only if $h B \in \setB_h$.
We therefore replace $B$ by $h B$ and $B'$ by $h B'$ and we get
for the new $B$ and $B'$ in $\setB_h$ :
$$B'\subset D_{\frac{c h}{\rho^\alpha}}(B) = D_{\frac{h^{\alpha+1}}{r^\alpha}}(B),$$
provided $\rho > c^{-1}$, i.e. $r > c^{-1} h$, i.e. $h<cr$.
%\square
\enddemo
Let us give a first criterion for the 1-localizability, which will apply to affine invariant
families of structuring elements.
\begin{pro}
\label{criterion}
Let $\setB$ be made of subsets of $\real^2$ containing $0$. Assume that there exists
$c > 0$ such that if $B \in \setB$ and $r > c$, then the connected component
of $D_{\frac{c}{r}}(B) \cap D(0, r)$ containing $0$ is in $\setB$ (resp. contains an 
element of $\setB$). Then $\setB$ is 1-localizable.
(We denote by $D_{\frac{c}{r}}(B)$ the dilate of $B$,
$\{x, d(x, B) \leq \frac{c}{r}\}$).
\end{pro}

\paragraph{Proof}
\label{proof_criterion}
For any $B$ in $\setB$, we consider $B'$, the connected component of 
$D_{\frac{c}{r}}(B) \cap D(0, r)$ containing $0$. In the second case, we consider
an element $B'$ of $\setB$ contained in this connected component.
\enddemo
 

\begin{pro}
\label{Baff_localizable}
If $\setB = \setB_{\mathrm{aff}}$ is the set of all affine structuring elements, then $\setB$ is localizable.
\end{pro}


\begin{figure}[htbp]
\begin{center}
\mbox{\gfigbox{50mm}{\FDIR/fig3}}
\caption{Proof of Proposition \ref{Baff_localizable}.}
\label{figure_proof_Baff_localizable}
\end{center}
\end{figure}

\paragraph{Proof}
\label{proof_Baff_localizable} 
We want to apply proposition \ref{criterion}.
Let $B\in \setB_{\mathrm{aff}}$ and $b_B>1$ such that for every $\Delta$ passing by 0, the areas of the connected components of 
$X\setminus \Delta$ containing 0 are larger than $b_B$. 
Let $B'$ be the connected component of 
$D_{\frac{3}{r}}(B) \cap D(0, \rho)$ containing $0$.  
We shall show that $B'$ belongs to $\setB_{\mathrm{aff}}$. Let us consider
${\cal C}'$, one of the two connected components of 
$B'\setminus \Delta$ containing 0 in its boundary. Consider also 
$\cal C$, the connected component of $(B\setminus \Delta)\cap D(0,\rho)$ containing 0 in its boundary and on the same side of $\Delta$ as ${\cal C}'$.
Notice that ${\cal C}\subset {\cal C}'$.
\newline
\newline {\bf Two cases :} If $\cal C$ does not meet $\partial D(0, \rho)$, then $\cal C$ is the one of the connected components of $B\setminus \Delta$ containing 0 and, in addition, ${\cal C}'$ contains $\cal C$. Thus 
area(${\cal C}'\geq b_B$ and we are done.
\newline
\newline 



Let $\Delta$ be a line passing
by $0$. We consider one of the two connected components ${\cal C}'$ of 
$B' \setminus \Delta$ containing $0$ in their boundary. We also consider ${\cal C}$ the 
connected component of $B \setminus \Delta$ containing $0$ in their boundary and such that 
${\cal C} \cap D(0, r) \subset B'$.
\newline
Two cases : if ${\cal C}$ is contained in $D(0, r)$, then by definition of chord-arc
sets, the area of ${\cal C}$ is larger than $b$. Therefore, the area of ${\cal
C}'$
is larger than $b$. \newline
Second case : if ${\cal C}$ is not contained in $D(0, r)$, we consider the connected
component ${\cal C}_1$ of ${\cal C} \setminus \partial D(0, r - \frac{2b}{r})$ which contains
$0$. ${\cal C}_1 \subset {\cal C}$ meets $\partial D(0, r - \frac{2b}{r})$ at some
points, then, by connectedness, each line orthogonal to $[0, x]$ and passing by
$tx$, with $0 \leq t \leq 1$, meets ${\cal C}_1$ at at least one point 
$x(t) \in D(0, r - \frac{2b}{r})$. Noting $\nu = \frac{x^{\bot}}{\| x \|}$,
a unit vector orthogonal to $x$, we notice that the interval 
$[ x(t) - \frac{2 \nu}{r}, x(t) + \frac{2 \nu}{r} ]$ is contained in 
$D_{\frac{2b}{r}}({\cal C}_1) \subset D_{\frac{2b}{r}}({\cal C}) \subset B'$.
In addition, one half at least of this interval is contained in ${\cal C} '$.
Thus, provided $r \geq 2b$, 
${\rm area} ({\cal C}') \geq (r - \frac{2b}{r}) \frac{2b}{r} = 2b -
\frac{4b^2}{r^2} \geq b$.
%\square
\enddemo
We can roughly say that all affine invariant families made of connected sets containing 0 are
localizable, provided the shape of the elements is not too much distorted. The next example
gives another example, where the ``not too much distorted'' condition is given by convexity.
\begin{Exercice}\label{examplesdelocalisables} Examples  of localizable families.
\newline
 1)
Let $\setB$ be an affine invariant family of convex sets containing 0, all with area 
less than 1. Show that $\setB$ is localizable.
Here is a way to prove it : Let $B \in \setB$. If $B\subset D(0, \rho)$, we are done.
Otherwise, let $\fxx$ be the element of $B$ with largest norm.  Consider  the special linear symmetric  map $A$ with eigenvectors $\fxx$ and $\fxx^\perp$ and respective eigenvalues $\frac{\rho}{\vert \fxx\vert} $ and $\frac{\vert \fxx\vert}{\rho}$. Then check that if  $\rho$ is larger than some universal constant $C$, then  $AB\subset D(0, \rho)$.  Set $B'=AB$, which belongs by assumption to $\setB$, and prove that for  some other  universal constant $c$,
$B'\subset D_{\frac c \rho}(B)$.  Conclude.
\newline 2) Let $B$ be a bounded  connected  set whose interior contains 0 and define an affine 
invariant family $\setB=\{AB, \; A\in SL(\real^2)\}$, where $SL(\real^2)$ denotes the
special linear group of all linear maps with determinant 1.  Show, by using the same method 
as in 1), that $\setB$ is localizable.
\end{Exercice}
\section{Localizability of the gaussian median filter}
We shall now give another relevant instance of localizable family, associated with 
the weighted median filter.  Although one can state much more general results, we shall
restrict ourselves to the case where the weight function $k$ of the median filter is the Gauss function $G(\fxx)=\frac 1 {(4\pi)^{\frac N2}}e^{-\frac{\vert\fxx\vert^2}{4}}.$
We then  have $\int_{\real^N}G(\fxx)d\fxx=1$ and we can consider in the following the 
family of structuring elements $\setB$ associated with $G$.  For brievety, we write
$\vert B\vert_G$ for $\int_B G(\fxx)d\fxx.$  Then 
$$\setB=\{B\subset\real^N,\; \vert B\vert_G\geq \frac 12\}.$$
\begin{pro}\label{mediangaussienlocalisable1}
The set $\setB$ associated with the gaussian median filter is $\alpha$-localizable for every
$\alpha>0$. More precisely,
$$\forall\alpha>0,\; \exists c=c(\alpha),\; \forall \rho\geq c, \; \forall B\in \setB,\;
\exists B'\in \setB, \; B'\subset B(0, \rho) \hbox{ such that } B'\subset D_{\frac 1{\rho^\alpha}}(B).$$
\end{pro}

\begin{cor}\label{mediangaussienlocalisable2}
As an immediate consequence of Definition-proposition \ref{Localizability}, we obtain by scaling $\setB$ into $\setB_h=h\setB$ :
$$
\forall r>0,\;\forall h\leq cr,\;\forall B\in\setB_h,\; \exists B'\in \setB_h, \;
B'\subset B(0,r)\; \hbox{ and } B'\subset D_{  \frac { h^{\alpha +1} }{r^\alpha  }}(B).
$$
\end{cor}
\paragraph{Proof of Proposition \ref{mediangaussienlocalisable1}}
We begin by choosing $\rho_0$ such that
$$\vert B(0, \rho_0)\vert_G=\frac 34.$$
We then  call $\rho_1$ the value  $\rho_1\geq \rho_0$ for which 
$$\vert B(0, \rho_1)\vert_G=\frac 18$$
 and we assume in the following $\rho\geq\rho_1$.
\newline Two cases :
\newline\newline
$\bullet$ If $B\in\setB$ satisfies $$\vert B\vert_G\geq \frac 12+\vert B(0,\rho)^c\vert_G,$$
we simply set $B'=B\cap B(0, \rho)$ and we get
$$\vert B'\vert_G\geq \vert B\vert_G-\vert B(0, \rho)^c\vert_G\geq \frac 12,$$
which proves that $B'\in \setB$, $B'\subset B$  answers the question.
\newline\newline
$\bullet$ If $B\in \setB$ satisfies $$\vert B\vert_G\leq \frac 12 +\vert B(0, \rho)^c\vert_G
\leq \frac 12 +\frac 18,$$
then 
\fb&
\label{loco1}
\vert B\cap B(0, \rho_0)\vert_G\geq \vert B\vert_G-\vert B(0,\rho_0)^c\vert_G\geq \frac 12-\frac 14=\frac 14,
\fe&
\fb&
\label{loco2}
\vert B^c\cap B(0, \rho_0)\vert_G\geq \vert B(0, \rho_0)\vert_G-\vert B\vert_G\geq 
\frac 34-(\frac 12+\frac 18.
\fe&
Since $G\leq 1$, we have for every measurable set $A$, $\vert A\vert_G\leq \meas(A).$
Thus, from (\ref{loco1}-\ref{loco2}), 
\fb& \label{loco4}
\meas(B\cap B(0,\rho_0))\geq \frac 14 \hbox{  and  } \meas(B^c\cap B(0, \rho_0))\geq \frac 18.
\fe&
By Lemma \ref{isoperimetric}, which we state in continuation, and Relation (\ref{loco4}),
we obtain, for  a universal constant $C$, 
$$\meas(B(0, \rho_0)\cap D_{\frac 1{\rho^\alpha}}(B\cap B(0, \rho_0))\setminus B))\geq 
\frac C{\rho^\alpha}$$
and therefore
\fb& \label {loco5}
\vert B(0, \rho)\cap D_{\frac 1{\rho^\alpha}}(B\cap B(0, \rho))\setminus B\vert_G \geq
\frac C{\rho^\alpha}\frac { e^{-\frac{\rho_0^2}4}} {(4\pi)^\frac N2 }  \geq \frac C{\rho^\alpha} 
\fe&
for some universal constant $C$.
We finally set $$B'=B(0, \rho)\cap D_{\frac 1{\rho^\alpha}}(B\cap B(0, \rho),$$  so that
$d(B', B)\leq \frac 1 {\rho^\alpha}$, 
$B'\subset B(0, \rho)$.  We then have by (\ref{loco5})
$$\vert B'\vert_G \geq \vert B\vert_G-\vert B(0, \rho)^c\vert_G+\frac C{\rho^\alpha},$$
that is 
$$\vert B'\vert_G\geq \vert B\vert_G+\frac C{\rho^\alpha}-\int_{\vert\fxx\vert\geq\rho}G\geq
\vert B\vert_G\geq \frac 12,$$
for $\rho\geq c(\alpha)$, where $c(\alpha)$ only depends on $\alpha$.
Indeed, 
$$\int_{\vert\fxx\vert\geq \rho}G\leq c_N\rho^{N-1}e^{-\frac{\rho^2}4}$$
for a universal constant $c_N$.
\enddemo
\begin{lem}\label{isoperimetric}
Let $B(0, \rho_0$ be  a ball and $B$ a subset of $\real^N$ satisfying for some constant
$\delta>0$,
$$\meas(B\cap B(0, \rho_0))\geq \delta \hbox { and } \meas(B^c\cap B(0, \rho_0))\geq\delta.
$$
Then there are constants $C(\rho_0, \delta)$ and $\eta_0(\rho_0, \delta)$ such that
$$\forall \eta\leq \eta_0, \;\; \meas(B(0, \rho_0)\cap D_eta(B\cap B(0,\rho_0))\setminus B)\geq
C\eta.$$

\end{lem}
\paragraph{Proof}
This is an easy consequence of  the isoperimetric inequality (\cite{Ambrosio}).
\enddemo



\section{\label{Affinelocalcomparison}A local comparison principle.}


 We shall now prove that our definition of ``localizable family''
for $\SetB$ indeed yields locality properties for the associated operator 
$$ IS_hu(\fxx) =\inf_{B\in h \setB}\sup_{\fxy \in B} u(\fxx+\fxy).$$ 
Intuitively, an operator $T_h$ depending on a scale parameter $h$ is local if its value
$(T_hu)(\fxx)$ at a point $\fxx$ primarily depends  upon the values of $u(\fxy)$ in a
neighborhood of $\fxx$ whose size tend to zero as $h$ tends to zero. This can be stated
in many ways.   Thanks to the monotonicity of the considered operators, we can
formulate it as a local comparison principle.
 %%%%%%%%%%%%%% PAGE 7  %%%%%%%%%%%%%%%

\begin{lem}  \label{conslem3}  {\rm [local maximum principle]} \index{local comparaison principle}
%§labelconslem3 \newline
Let $\SetB$ be an $\alpha$-localizable set of plane closed nonempty sets.  Let $u$ and $v$ be two Lipschitz functions  in a disk
$D(\fxx_0, r)$  satisfying $u(\fxx) \leq v(\fxx)$ in $D(\fxx_0, r)$. Let  $K$ be the
Lipschitz constant of $u$.
 Then if  $h\leq cr$,
$$(IS_h u) (\fxx_0) \leq (IS_h v)(\fxx_0) + Kc\frac{h^{\alpha+1}}{r^\alpha}.$$

 \end{lem}

\vff


\paragraph{Proof of Lemma \ref{conslem3}. } 
$$ (IS_h v) (\fxx_0) =
\inf_{B\in \setB_h+\fxx_0}\sup_{\fxy\in B} v(\fxy) \geq \inf_{B \in \SetB_h +\fxx_0} \sup_{\fxy\in B\cap
D(\fxx_0, r)} v(\fxy) $$ $$ \geq \inf_{B \in \SetB_h + \fxx_0}
\sup_{\fxy\in B\cap D(\fxx_0, r)} u(\fxy) $$
By  Definition \ref{Localizability}, for all $B \in \SetB_h +\fxx_0$, 
there exists $ B'$ in $\SetB_h +\fxx_0$, $ B' \subset D(\fxx_0,r)$,
such that $\delta(B,  B') \leq c\frac{h^{\alpha+1}}{r^\alpha}$.
Thus, since $u $ is $K$-Lipschitz,
 $$
\sup_{\fxy\in B\cap
D(\fxx_0, r)} u(\fxy) \geq \sup_{\fxy \in  B'} u(\fxy) - Kc\frac{h^{\alpha+1}}{r^\alpha}. 
$$
The two preceding relations yield
\fb& \label{7.1}
%§label {7.1}\quad
 (IS_h v) (\fxx_0) \geq \inf_{B \in \SetB_h + \fxx_0}
\sup_{\fxy\in B\cap D(\fxx_0, r)} u(\fxy) 
\fe& 

$$ 
\geq \inf_{B' \in \SetB_h +
\fxx_0 , \; B' \subset D(\fxx_0, r)} \sup_{\fxy \in B'} u(\fxy) - Kc\frac{h^{\alpha+1}}{r^\alpha} \geq \inf_{B \in \SetB_h + \fxx_0} \sup_{\fxy \in
B} u(\fxy) - Kc\frac{h^{\alpha+1}}{r^\alpha}.
$$
We obtain
$$
(IS_h u)(\fxx_0) = \inf_{B\in \setB_h+\fxx_0}\sup_{\fxy\in B} u(\fxy) \leq 
(IS_h v)(\fxx_0) +  Kc\frac{h^{\alpha+1}}{r^\alpha}.
$$ 


\endproof 
The next lemma permits to fix an optimal relationship between the localization scale 
$r$ and the operator's  scale $h$.

\begin{lem} (Locality) \label{lemma7} \index{locality Lemma}
%§label lemma7\newline
Let $\SetB$ be an $\alpha$-localizable set of subsets of $\real^N$. Let $u,v$ be two $K$-Lipschitz functions such that 
$$ |u(\fxx)-v(\fxx)|\leq C|\fxx|^3$$
in a neighborhood of 0. Then
$$ |IS_h u(0) -IS_h v(0)| \leq (C +
Kc)h^\frac{3(\alpha+1)}{3+\alpha}.$$

\end{lem}

\paragraph{Proof.}
Applying the local maximum principle (Lemma \ref{conslem3}), we deduce from
the relation $$v(\fxx)-Cr^3 \leq u(\fxx) \leq v(\fxx) + Cr^3$$
on $D(\fxx, r)$ that
$$(IS_h v)(0)-Cr^3 -Kc\frac{h^{\alpha+1}}{r^\alpha} \leq (IS_h u)(0) \leq (IS_h
v)(0)+Cr^3 + Kc\frac{h^{\alpha+1}}{r^\alpha}$$
We choose $r$ in such a way that both infinitesimals appearing in the second member of the former inequality be of the same order : $r^3 =\frac{h^{\alpha+1}}{r^\alpha}$, which yields
$$r=h^{\frac{\alpha +1 }{3+\alpha}}\; r^3=\frac{h^{\alpha+1}}{r^\alpha}=
h^{\frac{3(\alpha +1) }{3+\alpha}}.$$
We obtain
$$(IS_h v)(0)-Ch^{ \frac {3(\alpha +1) } {3+\alpha} } -Kch^{ \frac {3(\alpha +1) } {3+\alpha}}
 \leq (IS_h u)(0)
\leq (IS_h v)(0) +Ch^{ \frac {3(\alpha +1) }  {3+\alpha} } +Kch^{ \frac {3(\alpha +1) } {3+\alpha}}.$$
\endproof

The main interest of lemma \ref{lemma7} is to reduce the asymptotic analysis of the
operator $IS_h$ as $h\rightarrow 0$ to the case
where it is applied to second order polynomials.
 In all that follows, we adopt  the rule of 
scale $r=h^{\frac{\alpha +1 }{3+\alpha}}$. This choice will be justified in Lemma\ref{lemma7}
to follow. 



\noindent In the following, it will be useful to associate with the operators $IS_h$ new
operators
$$ (IS_h^r u)(\fxx_0) = \inf_{B \in \SetB_h + \fxx_0} \sup_{\fxy
\in B\cap D(\fxx_0, r)} u(\fxy), $$ 
whose  locality has been enforced : we truncate  all elements in $\SetB$ by removing their
parts outside  $D(0,r)$.  We shall now estimate the asymptotic
difference between $IS_h$ and $IS_h^r$. 


\begin{lem} \label{Localizationlemma}
(Localization Lemma)  \index{localization lemma for affine invariant operators}
\newline
\noindent
Let $\SetB$ be an $\alpha$-localizable set of structuring elements in $\real^N$ and 
 $u$ a    $K$-lipschitz function on  $D(\fxx_0, 1)$. Let us set $r=h^{\frac{\alpha +1 }{3+\alpha}}$.
 Then
$$(i) \qquad IS_h^r u(\fxx_0) \leq IS_h u(\fxx_0) \leq IS_r^ru(\fxx_0)
+Kch^{\frac{3(\alpha +1) }{3+\alpha}}. $$  
for $r$ small
enough. As a consequence,
$$(ii) \qquad | SI_h^ru(\fxx_0) - SI_hu(\fxx_0)|\leq
Kch^{\frac{3(\alpha +1) }{3+\alpha}}. $$
$$(iii) \qquad | IS_h^ru(\fxx_0) - IS_hu(\fxx_0)|\leq
Kch^{\frac{3(\alpha +1) }{3+\alpha}}, $$

$$(iv) \qquad | SI_h^rIS_h^ru(\fxx_0) - 
SI_hIS_hu(\fxx_0)|\leq 2Kch^{\frac{3(\alpha +1) }{3+\alpha}} $$
\end{lem}

\paragraph{Proof~:} The  inequality (i) follows from
the inequalities (\ref{7.1}), in the proof of Lemma \ref{conslem3}, by taking $u =
v$. The inequalities (ii) and (iii) are deduced by using $IS_s(-u)=-SI_s(u)$. 
In order to obtain (iv), we notice that if $u$ is globally
$K$-Lipschitz, then so is $IS_h u$ by Lemma \ref{Lips}. We have by (ii) and (iii)

\fb&
 \label{8.1}
%§label{8.1}\newline
 SI_h^ru   \leq
SI_h u \leq Kch^{\frac{3(\alpha +1) }{3+\alpha}}+SI_h^ru 
\fe&
\fb&
 %§label{8.2} \newline
\label{8.2}
IS_h^ru   \leq
IS_h u \leq Kch^{\frac{3(\alpha +1) }{3+\alpha}}+IS_h^ru 
\fe&
Taking in (\ref{8.1}) $u=IS_hu$ and using (\ref{8.2}), we obtain
$$
SI_h^rIS_h^ru  \leq
SI_hIS_h u \leq
2Kch^{\frac{3(\alpha +1) }{3+\alpha}}+SI_h^rIS_h^ru,
$$
which proves (iv). \endproof

\zbibnote


The  mathematical techniques for localizing a set of structuring elements
developped in this chapter were first explained in 
\cite{Guichard:1996:PDE, Guichard:1995:PDE, Guichard:1994:AAM}. The version presented here is much simpler.  Fr\'ed\'eric Cao's  and Denis Pasquignon  PhD's contain
related localization techniques \cite{Cao:1998:PDE, Cao:2000:PT,Pas3}.




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{\label{Consistency}Asymptotic behavior of affine and contrast invariant filters. \label{chapter13}}
\thispagestyle{empty}


 
In this chapter, we analyze, in dimension 2, the asymptotic behaviour of
contrast invariant affine invariant monotone  operators. By  {\it affine invariance}\index{affine invariance of Matheron operator}, we mean that
the operators commute with all linear maps of the plane with determinant 1.  We know that such operators have an  $\inf\sup$ (or  $\sup\inf$) form,
$$
Tu(\fxx)= \inf_{B\in \setB}\sup_{\fxy\in \fxx+B}u(\fxy)
$$
  We
denote by
$SL(\real^2)$\notation the special linear group, that is, the group of all linear
transforms 
$A= 
\left(
\begin{array}{ccc}
a & b  \\
c & d  \\ \end{array} \right)$ such that $|det(\AA)|=|ad-bc|=1$.
If the operator $T$ is affine invariant,   its   set $\setB$ of
structuring elements is obviously also invariant under special linear transforms of the plane :
$AB \in  \setB$ if $B\in \setB$ and $det(A)=1$.
Conversely,
 if  $\AA\setB=\{AB, B\in
\setB\}$ is equal to $\setB$, then the associated $\inf\sup$ or $\sup\inf$ operators $T$
are affine invariant : Denoting by $\AA u(\fxx) = u(\AA\fxx)$,\notation  we obviously have
$T(\AA u) = \AA T(u).$
  Since, in addition, $T$ commutes
with translations, it indeed commutes with all affine maps of the plane.  By abuse, we
shall sometimes say that
$\setB$ is affine invariant.
An obvious example of affine invariant set $\setB$ is  the family of ellipses with
area 1 centered at 0.  More generally, we can consider the set
$\{\AA B, \AA \in SL(\real^2) \}$
where $B$ is an arbitrary bounded set of the plane.

In what follows, we write as usual $\fxx, \fxy, \fxz$ for elements of
$\real^2$ and $\fxx = (x,y)$. We consider a scaling parameter $h>0$, and we
set
$\setB_h= \{ h B, B \in \SetB  \}$. 

We  set, for every real function $u(\fxx)$ defined on the plane,
$$ SI_h u (\fxx) = \sup_{B\in \setB_h}\inf_{\fxy\in \fxx+B}u(\fxy),$$
$$ IS_h u (\fxx) = \inf_{B\in \setB_h}\sup_{\fxy\in \fxx+B}u(\fxy).$$
$SI_hu$ is understood as an ``affine erosion" of $u$ and $IS_hu$ as an
``affine dilation".  \index{affine erosion or dilation}  Since $SI_hu=-IS_h(-u)$, we
choose to study in the following one of these operators, namely $IS_h$. All theorems
will be trivially adapted to $SI_h$.
 Our main concern is the
behavior of $IS_hu(x)$ when $u(x)$ is a smooth ($C^3$) function and  $ h\rightarrow 0$.
We prove in this chapter that if $\setB$ is affine invariant and
1-localizable (as shown in the preceding chapter, affine invariance entails  easily the
the 1- localizability),
$$\lim_{h\to 0} \frac{(IS_hSI_hu)(\fxx_0) -u(\fxx_0)}{h^\frac
4 3}=c_{\setB}|Du|\curv(u)^\frac 1 3,$$
where $c_{\setB}$ is a suitable constant and $r^\frac 13$ is meant for $\frac
r{|r|}|r|^\frac 13$.  This main result extends to affine invariant Matheron operators
the asymptotic analysis performed in the preceding chapter  for euclidean invariant 
local operators.  


Lemma \ref{lemma7} shows that if $\setB$ is localizable, then the behaviour of a 
$C^3$ function is very close to the behaviour of its Taylor expansion of order 2.
If $u$ is $C^2$, let us write 
$$u(\fxx)=u(x,y)=u(0,0)+ax^2+by^2+cxy + O(\vert \fxx\vert^3)=v(\fxx)+O(\vert \fxx\vert^3).$$
If
$\setB$ is 1-localizable, then by Lemma\ref{lemma7} we have
$$ |IS_h u(0) -IS_h v(0)| \leq (C +
Kc)h^\frac 32.$$
Thus we have to compute the action of $IS_h$ on polynomials of degree 2.
 We shall
consider in the series of lemmas to follow more and more general
such polynomials. In the following, because of the translation invariance of the 
operators $IS_h$, we can assume without loss of generality for the asymptotic
  analysis of $IS_hu(\fxx)$ that $\fxx=0$ and $u(0)=0$. Thus, we take 
``$IS_h(x+ax^2+by^2+cxy)$" as an abbreviation for ``$IS_h(x+ax^2+by^2+cxy)(0)$".
As we shall see, the cases $a= c = 0,  b=+1$ and $b=-1$ play a canonical role, so
that we set
$$c^+_\SetB=\inf_{B \in \SetB} \sup_{\fxy\in  B}(x+y^2), \quad 
c^-_\SetB=\inf_{B \in \SetB} \sup_{\fxy\in  B}(x-y^2).$$
Since our main results involve these constants, it is worth noticing that  they
can be different from zero.

 \begin{lem} \label{lemma8}
%§label lemma8\newline
(i)  If $\SetB$ is a set of convex sets, invariant by $SL^2(\real^2)$ (or a set of
boundaries of convex sets), all with area 1 and symmetric with respect to 0, then 
$c^+_\SetB > 0$ and $c^-_\SetB = 0.$
\newline
(ii)  If $\setB_{aff}$ is the set of all affine structuring elements defined in Definition \ref{affine_structuring_element}, then $c_{\setB}^+\geq 1$, $c_{\setB}^-=0.$
 \end{lem}


\paragraph{Proof.} Proof of (i).
Consider the disk $D=D(0, \frac{1}{\sqrt{\pi}})$, with area $1$. All
elements $B$ in $\SetB$ have  area $1$ and therefore
meet the boundary $ \partial D$ of $D$. Thus, taking into account that
$x\geq x^2$ for $\fxx=(x,y)\in D$, 
$$
c^+_\SetB \geq \inf_{B \in \SetB} \sup_{(x,y) \in B\cap D} (x+
y^2) \geq  \inf_{B \in \SetB} \sup_{(x,y) \in B\cap D} (x^2+ y^2) \geq \frac{1}{\pi}.
$$
Indeed, since the sets $B$ are symmetric with respect to $0$,
$\sup_{B\cap D} (x+y^2)$ is always attained for some $(x,y)$ with $x\geq 0$.
In order to prove that $c^-_\SetB =  0,$ we first remark that since every $B\in
\SetB$ surrounds 0, it contains at least  one point where $x>0$ and $y=0$.  Thus
$c^-_\SetB \geq 0.$  We then fix a set $B$ in $\SetB$ and consider the new sets obtained
by squeezing $B$ onto the line $x=0$~: 
$$
B_\varepsilon = \{(\varepsilon x, \frac
{y}{\varepsilon}) \quad, (x,y)\in B\}.
$$  
 Then $B_\varepsilon \in \SetB$ and therefore
$$c_\SetB^-\leq\sup_{B_\varepsilon} (x-y^2)\leq \sup_{B_\varepsilon} (x) \leq
C\varepsilon .$$
Thus, $c_\SetB^-=0.$
\newline\newline
Proof of (ii).  Let $B$ be an affine structuring element. Then its intersection with every
half plane whose boundary contains 0 has measure larger than 1. Let us choose as half plane
$H=\{(x,y),\;  x\geq 0.\}$
We deduce that $$(\sup_{B\cap H}x)(\sup_{B\cap H}\vert y\vert)\geq 1.$$
Let us estimate
$$c_{\setB} \geq \sup_B(x+y^2)\geq \sup_{B\cap H} (x+y^2)\geq \inf(\sup_{B\cap H}x,\sup_{B\cap H}
y^2).$$ Setting $\xi =\sup_{B\cap H}x$, we deduce that
$$c_{\setB}\geq \inf_{\xi\geq 0}(\xi, \frac 1{\xi^2})=1.$$
 \endproof


\begin{Exercice} As shown in this exercice, one can have $c_{\setB}<0$ for an even simple affine invariant family of structuring elements.
\newline
1) Let  $\SetB= \{\AA C, \AA \in \hbox{SL}(\real^2)\}$, where $C$ is a truncated square with
center 0, half side 2 and one of the sides missing, (e.g. $(x,y)\in C$ if
$x=-2 $ and $ -2\leq y\leq 2$ or
 $-2\leq x\leq 2$ and $y=+2$ or $y=-2$)
  Show that $c^+_\SetB > 0$ and $ c^-_\SetB <0$.
\newline 2)  Show that this family of structuring elements is localizable.

%Solution :Let us now consider the case of the truncated square $C$ defined above.  We obviously
%have $sup_C (x-y^2)=-2$, so that $c^-_\SetB<0$.  For  every image of $C$ by a
%special linear map $\AA$, the parallelogram defined as the convex hull of $\AA C$
%has area 4 and therefore one of the two pairs of diagonally opposite vertices of the
%parallelogram has a length larger than 2. We take such a pair $\fxx, \fxy$ and
%note that it  belongs to  $\AA C$.  We select the one of both vertices, say
%$\fxx = (x,y)$, satisfying $x \geq 0$.  Since $x^2+y^2\geq 1$, we then have
%$x+y^2\geq (\hbox{min} (x,1))^2 + y^2\geq 1$ and  we conclude that
%$c^+_\SetB \geq 1$.

\end{Exercice}
 
There is one case of simple function, which turns out to be canonic, where we can 
compute by invariance argument the action of an affine invariant operator $IS_h$.
\begin{lem} \label{lemma9}
Let $\setB$ be  a set of structuring elements  invariant by the special 
linear group and let $IS_h$ its associated $\inf\sup$ operator.
Let $p>0$. Then
 $$
IS_h(px+by^2)=c^+_\SetB (\frac{b}{p})^\frac{1}{3}p
h^\frac{4}{3} \quad \hbox
{if}\quad b>0,
$$ 
$$
IS_h(px+by^2)=c^-_\SetB  (-\frac{b}{p})^\frac{1}{3}p
h^\frac{4}{3} \quad \hbox {if}\quad b\leq 0.
$$ 
 \end{lem}

  

\paragraph{Proof.} We note that if  $b \neq 0,$
$$B \in \SetB \Leftrightarrow \left(\begin{array}{cc}
h^\frac{4}{3}|b|^\frac{1}{3} & 0 \\ 0 & h^\frac{2}{3}|b|^{-\frac{1}{3}}
\end{array} \right)B \in \setB_h $$
Thus
$$ \inf_{B \in \SetB_h} \sup_{(x,y) \in B} (x+ by^2) = \inf_{B \in
\SetB}\sup_{(x,y) \in B} (|b|^\frac{1}{3} h^\frac{4}{3} x + b(
|b|^{-\frac{2}{3}}h^\frac{4}{3} y^2))$$
$$ = |b|^\frac{1}{3} h^\frac{4}{3} \inf_{B \in
\SetB}\sup_{(x,y) \in B} ( x + \frac {b}{|b|}y^2)$$
$$=c^+_\SetB b^\frac{1}{3}h^\frac{4}{3} \quad \hbox {if}\quad b>0,$$
$$=c^-_\SetB (-b)^\frac{1}{3}h^\frac{4}{3} \quad \hbox {if}\quad b<0.$$
Since $p>0$, we deduce that
$$IS_h(px+by^2)=p IS_h(x+ \frac{b}{p} y^2) $$
$$=c^+_\SetB (\frac{b}{p})^\frac{1}{3}ph^\frac{4}{3} \quad \hbox {if}\quad b>0,$$
$$
=c^-_\SetB (-\frac{b}{p})^\frac{1}{3}ph^\frac{4}{3} \quad \hbox {if}\quad b<0.
$$
Let us now consider the case where $b = 0$. We fix a
set $B$ in $\SetB$ and denote by $R$ its diameter. Then $B$ is
contained in $[-R,R]\times [-R,R]$ and therefore the set $
\left(\begin{array}{cc} h^2\epsilon & 0  \\ 0 & \epsilon^{-1}
\end{array} \right) B$, which belongs to $\setB_h$, is contained in
$[-R\epsilon h^2, R\epsilon h^2]\times [-\frac{R}{\epsilon},
\frac{R}{\epsilon}]$.
Thus
$$0 \leq IS_h(px) \leq \sup_{[-R\epsilon h^2, R \epsilon
h^2]\times [-\frac{R}{\epsilon}, \frac{R}{\epsilon}]} px
\leq pR\epsilon h^2  $$
We can take $\epsilon$ arbitrarily small and  conclude that
$IS_h(px)=0.$ \endproof

\noindent
The next lemma deals with the case where the function to which we apply
$IS_h$ has a
zero  gradient at zero.

\begin{lem} \label{CasDu=0}
%§label CasDu=0\quad
Let $\SetB$ be an affine invariant set of structuring elements, one of which is bounded and 
all of which contain O.  Then there is a  continuous function  $G(Du, D^2u)$ satisfying
 $G (0, 0)=0$ such that for every
$C^3$ function $u$,  the scaled operators  $IS_h$ and $SI_h$ associated with $\setB$ satisfy
$$0\leq \vert  IS_hu(\fxx_0)-u(\fxx_0)\vert  \leq G(D^2u(\fxx_0), Du(\fxx_0)) h^\frac 4 3 +
 o_{\fxx_0}(h^\frac 4 3),$$
where $o_{\fxx_0}(h^\frac 4 3)$ is uniform on compact sets of $\real^2$.
In the same way,   by the relation $IS_h(u)=-SI_h(-u)$,
$$0\geq \vert  SI_hu(\fxx_0)-u(\fxx_0)\vert  \geq - G(D^2u(\fxx_0), Du(\fxx_0)) h^\frac 4 3 +
 o_{\fxx_0}(h^\frac 4 3).$$
 \end{lem}

\paragraph{Proof.}
Since all elements of $\setB$ contain 0, we always have 
$\sup_{\fxy \in \fxx +B}u(\fxy)\geq u(\fxx).$
Let $B$ be  a bounded element of $\setB$ and let $R=\sup_{\fxx\in B}\vert \fxx\vert.$
 Then $B$ is
contained in $[-R,R]\times [-R,R]$ and therefore the set
 $
\left(\begin{array}{cc} h^\frac {4}{3} & 0  \\ 0 & h^\frac {2}{3}
\end{array} \right) B
$,

 which belongs to $\setB_h$, is contained in
$[-R h^\frac 4 3, Rh^\frac 4 3]\times [-Rh^\frac 2 3, Rh^\frac 2 3]$.
By making a Taylor expansion of $u$ in a neighborhood of $\fxx_0$, we have for the usual local 
coordinates $(x,y)$,
$$u(\fxx)-u(\fxx_0)= px+ax^2+by^2+cxy+ o_{\fxx_0}(|\fxx-\fxx_0|^3).$$
Thus
$$0 \leq IS_hu(\fxx_0)-u(\fxx_0) \leq \sup_{(x,y)\in [-R h^\frac 4 3, Rh^\frac 4 3]\times [-Rh^\frac 2 3, Rh^\frac 2 3]} px
+ax^2 +by^2+cxy + O_{\fxx_0}(\vert\fxx\vert^3)\leq (|p|+|a|+ |b|+ |c|)R^2h^\frac 4 3 +o_{\fxx_0}(h^2).
$$
We obtain
$$0\leq IS_hu(\fxx_0)-u(\fxx_0)\leq h^\frac 4 3 ( ||Du(\fxx_0)||+||D^2u(\fxx_0)||)R^2+o_{\fxx_0}(h^\frac 4 3).$$
 \endproof
We are now in a position to state and  prove the first main result of this chapter.
We consider affine erosions and affine dilations.  

\begin{th1} \label{theorem1} 
%§label theorem1\newline
  Let $\SetB$ be a 1-localizable set of plane 
sets which is 
 invariant by the special linear group $SL(\real^2)$.   Assume $u(\fxx)$ is a Lipschitz function and  $C^3$  in a neighborhood of $\fxx_0$.  Then
$$
\frac{(IS_h u)(\fxx_0) - u(\fxx_0)}{h^{4/3}} = |Du| g(\curv(u))(\fxx_0)+o_\fxx(h^\frac 4 3),
$$
where $\o_\fxx(h^\frac 4 3)\leq o_K(h^\frac 4 3)$
on every compact set $K$ of $\real^2$ where $Du(\fxx)$  does not vanish and 
$$
  \begin{array}{rclcl} \hbox{ where } 
g(r) & = & c^+_\SetB (\frac r 2)^\frac{1}{3} & \hbox{ if } & r>0 \\
& = & c^-_\SetB(-\frac r 2)^\frac{1}{3} & \hbox{ if } & r<0. \\
\end{array} \qquad \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; \qquad \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;
$$
\end{th1}

\paragraph{Proof of Theorem \ref{theorem1}.}

 $SI_h$ being
translation and isometry invariant, we can choose the origin 0 at
$\fxx_0$, and  orthogonal axes $(\vec i, \vec j)$ so that $\vec i =
\frac{Du}{|Du|}(0)$ if $Du \neq 0$.  In addition,since $IS_h(u-u(0)) = IS_hu -u(0)$, we
assume without loss  of generality that $u(0)=0$.  With these conventions, 
since $u$ is $C^3$, we can write again the relation (\ref{xix.1})~:
\fb& \label{star3}
 u(\fxx) = px+ ax^2 + by^2 + cxy + O(|\fxx|^3), 
\fe&
where $p=|Du|(0)\geq 0$, $\fxx = (x,y)=x\vec i+ y\vec j$ and, if $p>0$, 
\fb&
 \begin{array}{l} b=\frac{1}{2} \frac{\partial^2 u}{\partial
y^2} (0) = \frac{1}{2} D^2u(\vec j, \vec j)=\frac{1}{2} |Du| \curv(u)(0) \\ \\
a=\frac{1}{2} \frac{\partial^2 u}{\partial x^2} (0) = \frac{1}{2} 
D^2u(\vec i, \vec i) \\ \\
c=\frac{\partial^2 u}{\partial x \partial y} (0) = D^2u(\vec j, \vec
i). \\
\end{array}
\fe&
  
In the following, we consider a radius $r=h^{\frac 1 2}$ and the truncated
operator $IS_h^r$ already considered in Localization Lemma \ref{Localizationlemma}. From
(\ref {star3}) we deduce that for  every $\fxx$ in $D(0,r)$, 
$$
px+ax^2+by^2+cxy-O(r^3) \leq
u(\fxx) \leq px+ax^2+by^2+cxy + O(r^3).
 $$
 Therefore, 

\fb&
 \label{xix.2-bis}
%§label{xix.2-bis}\quad
 (IS_h^ru)(0)= IS_h^r(px+ax^2+by^2+cxy)+
O(r^3)
\fe&
(Recall that, by an anterior convention,  $IS_h^r(px+ax^2+by^2+cxy)$ means
$IS_h^r(px+ax^2+by^2+cxy)(0)$.)

\noindent $\bullet$ {\bf The case $p=|Du(0)|=0$.}
\newline
In this case we have, by the preceding lemma \ref {CasDu=0},
$IS_h(ax^2+by^2+cxy)= O(h^2)$  and therefore
$h^{-\frac 4 3}(IS_hu)(0)= O(h^\frac{2}{3}),$
which proves the assertion in the case $|Du(x_0)|=0$.
 

\noindent $\bullet$ {\bf The case $p=|Du(0)|\neq 0$.}\newline

Setting $\varepsilon = h^\theta$, where $\theta>0$ is a very small real number,
we have 
$$
-|c|\varepsilon y^2 - \frac{|c|}{\varepsilon} x^2 \leq cxy \leq
|c|\varepsilon y^2 + \frac{|c|}{\varepsilon} x^2.
$$
Thus
\fb&
%§label{xix.4-bis}\quad
(IS_h^r) u(0) \leq IS_h^r(px+(a+ |c|\varepsilon^{-1}) x^2 + (b+\varepsilon
|c|)y^2)  + O(r^3), \label{xix.4-bis} 
\fe&
\fb&
%§label{xix.5-bis}\quad
(IS_h^r) u(0) \geq IS_h^r(px+(a-|c|\varepsilon^{-1}) x^2 + (b-\varepsilon
|c|)y^2)  + O(r^3) \label{xix.5-bis} 
\fe&
We are led to study expressions of the type
$$
IS_h^r(px+ a(\varepsilon)x^2 + b(\varepsilon)y^2)  ,
$$
where $a(\varepsilon) = O(h^{-\theta})$ and $b(\varepsilon) = O(1)$.
(We shall only examine the case where $b\neq 0$, the case $b=0$ leading to the 
same calculations and  conclusion.)
We now use the contrast invariance property of $T$ ~:
$g\circ T = T\circ g$, where we fix
$g(s) = s- \frac{a}{p^2}s^2$. This function is increasing in a
neighborhood of zero. Thus, since
$IS_h^r(px+ax^2+by^2) $ tends to zero as $r$ and $h$ tend to zero, using
$g\circ T = T\circ g$, $$
IS_h^r(px+ax^2+by^2)  =
$$
$$
g^{-1} {(}IS_h^r(px+by^2-\frac{a}{p^2}((ax^2+by^2)^2+
2px(ax^2+by^2))) {)} 
$$ 
We then use the following relations (Lemma \ref{lemma9} and  Localization Lemma \ref
{Localizationlemma} (iii)) 
$$g^{-1}(t)=t+O(\varepsilon^{-1}t^2), \quad
IS_h(px+by^2)=O(h^\frac 4 3),$$ 
$$IS_h^r(px+by^2)=IS_h(px+by^2)+O(h^{\frac 3
2})=O(h^\frac 4 3),
$$
$$ a(\varepsilon) = O(\varepsilon^{-1}), \quad b(\varepsilon) = O(1), \quad
r=h^{\frac 1 2}$$
to deduce that
$$
IS_h^r(px+ax^2+by^2) = g^{-1}(IS_h^r(px+by^2)+O(\varepsilon^{-2}h^{\frac 3 2}))
= g^{-1}(IS_h(px+by^2)+O(\varepsilon^{-2}h^{\frac 3 2}))$$
$$=IS_h(px+by^2) +O(\varepsilon^{-2}h^{\frac 3 2}+\varepsilon^{-1}h^\frac 8 3),
$$
and finally
$$
IS_h^r(px+ax^2+by^2) =IS_h(px+by^2) +O(\varepsilon^{-2}h^\frac 32).
$$ 
Using  Relations \ref{xix.4-bis} and \ref{xix.5-bis} and Localization Lemma \ref 
{Localizationlemma},   we  obtain 
$$IS_h(px+b_{-\varepsilon}y^2)-O(h^\frac 32\varepsilon^{-2})\leq
IS_h(u)(0)\leq   IS_h(px+b_\varepsilon y^2) +O(h^{\frac 3 2}\varepsilon^{-2}),
$$
where $b_\varepsilon  = (b + |c|\varepsilon)$ and  $b_{-\varepsilon} = (b - |c|\varepsilon)$.
Using $\varepsilon =h^\theta$,  Lemma \ref{lemma9} and the inequalities
$$(\alpha+\beta)^\frac 13 \leq \alpha^\frac 13+\beta^\frac 13, \quad 
\alpha^\frac 13 -\beta^\frac 13 \leq (\alpha-\beta)^\frac 13$$
for $\alpha, \beta \geq 0$, 
  we get
$$
IS_h(u)(0)=c^+_\SetB (\frac{b}{p})^\frac{1}{3}p h^\frac{4}{3}+O(h^{\frac 3 2}
-2\theta) + O(h^{\frac 4 3 +\frac{\theta}{3}})
 \quad \hbox {if}\quad b>0,
$$
$$=c^-_\SetB (-\frac{b}{p})^\frac{1}{3}p h^\frac{4}{3}+O(h^{\frac 3 2
-2\theta})+O(h^{\frac 4 3 +\frac\theta 3}) 
\quad \hbox {if}\quad
b<0.
$$ 
In order to conclude the proof, we simply replace $p$ by $|Du|$ and $b$ by 
$\frac 1 2 |Du| \curv(u)$ in the above relations and choose (e.g.) $\theta$ such 
that $\frac 32-2\theta = \frac 4 3 +\frac \theta 3$, i.e. $\theta = \frac 1 {14}$.
We finally argue that all of the asymptotic behaviours involved in the proof  are uniform in $a$, $b$, $c$, $p$, provided
$p$ does not approach 0 and $a$, $b$, $c$ remain bounded.  Thus, we can write 
$$
\frac{(IS_h u)(\fxx_0) - u(\fxx_0)}{h^{4/3}} = |Du| g(\curv(u))(\fxx_0)+o_\fxx(h^\frac 4 3),
$$
where $\o_\fxx(h^\frac 4 3)\leq o_K(h^\frac 4 3)$
on every compact set $K$ of $\real^2$ where $Du(\fxx)$  does not vanish.  Indeed, on such a compact
set, $Du$, $D^2u$ and $D^3u$ remain bounded and so does $\frac 1 p =\frac{1}{\vert Du(\fxx)\vert}$,
which is present in the estimates of the proof.
\endproof

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

%%%%%%%%%%%%% PAGE 11 %%%%%%%%%%
\section{\label {Alternateschemes}Alternate schemes} \index{alternate schemes}

In this section, we extend the preceding results to  ``alternate schemes", that is,  products of the kind $IS_h SI_h$. We
shall obtain for such alternate schemes  a convergence theorem extending
Theorem \ref{theorem1}.  The alternate schemes are easier to implement and
numerically more efficient if we want to get the following natural property for a
contrast invariant operator $T$~: $T(-u)=-T(u)$.  Recall that, precisely because this 
property is not satisfied by erosion and dilation operators, it has been proposed
 with some experimental success to build alternate operators like $T=IS_hSI_h$
(those alternate operators could be called ``openings" or ``closings").  It is, in that case, not true that
$T(-u)=-T(u)$. We shall prove, however, that if we let $h\rightarrow 0$ and
consider iterates
$(IS_hSI_h)^n$ with
$n\rightarrow
\infty$, then the limit operators do satisfy this property.   It is not
possible to obtain directly an asymptotic result for $IS_hSI_h$ by 
applying twice Theorem \ref {theorem1}.  Indeed, there is no
guarantee (and it is in general false) that $IS_hu$ is $C^3$ whenever $u$ is
$C^3$. The next lemma explains how we can, however, extend to alternate operators convergence results like the ones given in Theorem \ref{theorem1}.

\begin{lem}\label{alternance}
Let $T_h$ and $S_h$ be two $\inf\sup $ operators.  Let $F_1(A, p, \fxx)$ and $F_2(A, p, \fxx)$ be 
two  functions which are continuous for  $(A, p, \fxx)$ in every compact set on which $p\neq 0$.
Assume that for a suitable exponent  $\beta$ we have
$$T_hu(\fxx)-u(\fxx)=h^\beta F_1(D^2u, Du, \fxx) + o_\fxx(h^\beta),$$
$$S_hu(\fxx)-u(\fxx)= h^\beta F_2(D^2u, Du, \fxx)+o_\fxx(h^\beta).$$
Assume that $S_h$ is localisable, i.e. for a suitable exponent $\gamma$,
$$\vert S_hu(\fxx)-S_hu^{h^\gamma}u(\fxx)\vert \leq o_\fxx(h^\beta)$$
for every Lipschitz function $u$.
In these assumptions,  $o_\fxx(h^\beta)$ denotes any function of $\fxx$ and $h^\beta$ such that
$o_\fxx(h^\beta)\leq o_K(h^\beta)$ for $\fxx$ in a compact set $K$ on which $Du(\fxx)\neq 0$.
Then the alternate operator satisfies
$$T_hS_hu(\fxx)-u(\fxx)=h^\beta (F_1(D^2u, Du, \fxx) +F_2(D^2u, Du, \fxx))+o_\fxx(h^\beta)$$
and $o_\fxx(h^\beta)\leq o_K(h^\beta)$ on every compact set $K$ on which $Du(\fxx) \neq 0.$
\end{lem}
\paragraph{Proof} Fix a compact $K$ on which $Du\neq 0$. 
Let $\fxx_0\in K$ and $\overline{B}(\fxx_0, r)$ a ball with $r$ small enough to ensure that
we still have $Du(\fxx)\neq 0$ on $\overline{B}(\fxx_0, r).$
Let $f^+(r)=\sup_{\fxx\in B(\fxx_0,r)}\vert F_1(D^2u, Du, \fxx)\vert$ and
 $f^-(r)=\inf_{\fxx\in B(\fxx_0,r)}\vert F_1(D^2u, Du, \fxx)\vert.$
We have
$$T_hu(\fxx)-u(\fxx)=h^\beta F_1(D^2u, Du, \fxx) + o_\fxx(h^\beta).$$
Let 
$o_{\fxx_0, r}(h)= \sup_{\fxx\in \overline{B}(\fxx_0, r)} o_\fxx(h^\beta).$
Thus, for $\fxx\in \overline{B}(\fxx_0, r),$
$$u(\fxx)+h^\beta f^-(r)-o_{\fxx_0, r}(h^\beta)\leq T_hu(\fxx)\leq u(\fxx)+h^\beta f^+(r)+o_{\fxx_0, r}(h^\beta).$$
By applying $S_h^{h^\gamma}$ at $\fxx_0$ to the members of this inequality, using the comparison principle, provided we set
$h^\gamma = r$, and the commutation of $S_h$ with the  addition of constants :
 
\fb& \label{alterna1}
S_h^{h^\gamma}u(\fxx)+h^\beta f^-(r)-o_{\fxx_0, r}(h^\beta)\leq S_h^{h^\gamma} T_hu(\fxx)\leq
S_h^{h^\gamma} u(\fxx)+h^\beta f^+(r)+o_{\fxx_0, r}(h^\beta)
\fe&
Now, $F$ being continuous, 

\fb& \label{alterna2}
f^\pm = F_1(D^2u(\fxx_0), Du(\fxx_0), \fxx_0) +o(1)
\fe&
 and, from the assumptions,

\fb& \label{alterna3}
S_h^{h^\gamma}u(\fxx_0)-u(\fxx_0)= h^\beta F_2(D^2u, Du, \fxx_0)+o_{\fxx_0}(h^\beta),
\fe&

\fb& \label{alterna4}
(S_h^{h^\gamma}T_hu)(\fxx_0)=S_hT_hu(\fxx_0)+o_{\fxx_0}(h^\beta).
\fe&
>From (\ref{alterna1})- (\ref{alterna4}), we obtain
$$S_hT_hu(\fxx_0)=h^\beta (F_1(D^2u, Du, \fxx_0)+F_2(D^2u, Du, \fxx_0))+o_{fxx_0}(h^\beta).$$
It is noticeable that we can fix  $r$ independtly of $\fxx_0$ on $K$, in such a way that 
$Du(\fxx)$ does not vanish on the dilated compact $K^r$.  Thus, all convergences in the preceding
proof are in fact uniform for $\fxx_0$ on $K$ and we can bound $o_{\fxx_0}(h^\beta)$ by some
$o_K(h^\beta).$
\enddemo
By repeating word for word the above proof, we can also prove the following, which will
prove of use.
\begin{lem}\label{alternance1}
Let $T_h$ and $S_h$ be two $\inf\sup $ operators.  Let $G_1(A, p, \fxx)$ and $G_2(A, p, \fxx)$ be 
two   continuous functions.
Assume that for suitable exponents $\gamma$ and $\beta$ we have
$$0\leq T_hu(\fxx)-u(\fxx)\leq h^\beta G_1(D^2u, Du, \fxx) + o_\fxx(h^\beta),$$
$$0\geq S_hu(\fxx)-u(\fxx)\geq h^\beta G_2(D^2u, Du, \fxx)+o_\fxx(h^\beta).$$
Assume that $S_h$ is localisable, i.e.
$$\vert S_hu(\fxx)-S_hu^{h^\gamma}u(\fxx)\vert \leq o_\fxx(h^\beta)$$
for every Lipschitz function $u$.
In these assumptions,  $o_\fxx(h^\beta)$ denotes any function of $\fxx$ and $h^\beta$ such that
$o_\fxx(h^\beta)\leq o_K(h^\beta)$ for $\fxx$ in a compact set $K$.
Then the alternate operator satisfies
$$
 h^\beta (G_1(D^2u, Du, \fxx) +o_\fxx(h^\beta)\leq
T_hS_hu(\fxx)-u(\fxx)\leq h^\beta G_2(D^2u, Du, \fxx))+o_\fxx(h^\beta)$$
and $o_\fxx(h^\beta)\leq o_K(h^\beta)$ on every compact set $K$.
\end{lem}
We are now in a position to state an asymptotic behaviour theorem for the main affine
invariant alternate filter, obtained by alternating affine erosions and dilations.


\begin{th1} \label{theoremalterne}
%§label{theoremalterne}\newline
Let $\setB_{aff}$ the set of ``affine structuring elements'' and respectively $IS_h$ and $SI_h$ the associated
affine erosions and dilations as defined in 
Definition \ref{affine_structuring_elements}.  Then  for every Lipschitz function  $u$ which
is $C^3$ in a neighborhood of $\fxx_0$, we have
\fb& \label{theconsistence}
 \lim_{h\rightarrow 0} \frac{(T_h u)(\fxx_0) - u(\fxx_0)}{h^{4/3}} =
c_\SetB |Du| (\curv(u))(\fxx_0)
\fe&
$$  \begin{array}{rclcl} \hbox{ where } 
g(r) & = & (r^-)^\frac{1}{3} & \hbox{ if } & T_h = SI_h \\
& = & (r^+)^\frac{1}{3} & \hbox{ if } & T_h = IS_h \\
& = & (r)^\frac{1}{3} & \hbox{ if } & T_h = SI_h \; IS_h \\
\end{array} \qquad \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; \qquad \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;
$$
This convergence is uniform on all compact sets of $\real^2$ on which $Du(\fxx)$ does not vanish.
In addition, there are continuous functions $G^\pm(D^2u, Du)$ such that
$G^\pm(0,0)=0$ and
\fb& \label{lesG}
 h^\frac 4 3 G^-(D^2u, Du) +o_\fxx(h^\frac 4 3)\leq
T_hu(\fxx)-u(\fxx)\leq h^\frac 4 3 G_2(D^2u, Du))+o_\fxx(h^\frac 4 3)
\fe&
and $o_\fxx(h^\frac 4 3)\leq o_K(h^\frac 4 3)$ on every compact set $K$ of $\real^2$.
\end{th1}
\paragraph{Proof}
By  Theorem \ref{theorem1}, we know  that (\ref{theconsistence}) holds
for $T_h=IS_h$ or $T_h=SI_h$.  Indeed, $\setB_{aff}$ is
a  1-localizable affine invariant family of structuring elements, as requested by Theorem \ref{theorem1}. By Lemma \ref{lemma8}, we know in addition that $c_{\setB_{aff}}^+\geq 1$ and $c_{\setB_{aff}}=0$.
We then apply Lemma \ref{alternance}, with obviously $\beta=\frac 4 3$ and  $\gamma=\frac 12$, to obtain (\ref{theconsistence}) for the alternate operator.

 In order to prove (\ref{lesG}),  we simply apply Lemma \ref{Du=0} to $IS_h$ and $SI_h$, which holds
because  $\setB_{aff}$ is affine invariant and all of its elements contain 0 and some are bounded.
We apply in continuation Lemma \ref{alternance1} to extend (\ref{lesG}) to the alternate operator
$IS_hSI_h$. 
\enddemo
By way of principle, all affine invariant families of connected sets which contain all 0, some of which
are bounded, and whose area is bounded from above, are localizable and permit to define
alternate schemes with the same properties as above. The next exercise examines some examples.
Now, we have seen that affine invariant dilations and erosions have magnificent numerical 
and structural properties and are the natural best candidates for affine invariant shape analysis.
\begin{Exercice}
Check that the preceding proof and results apply to the affine invariant localizable families
considered in Exercice  \ref{examplesdelocalisables}.
\end{Exercice}


\zbibnote

Early versions of the results and proofs contained in this chapter are 
given in \cite{Guichard:1996:PDE, Guichard:1995:PDE, Guichard:1994:AAM}. Our version here is 
easier and shorter.
Alternate sequential filters are
well introduced in Serra \cite{Serra:1986:IMM}.   A general axiomatic theory of Self-dual morphological operators is given by Heijmans
\cite{Heijmans:1996:SDM}. Applications of alternating sequential filters
are discussed in \cite{Pei:1997:ECA}.

\input{latex/nonflat.tex}


\zbibnote

\noindent
{\bf Nonflat mathematical morphology}
\newline
The basic theorem of the  "nonflat", or "grey level" mathematical morphology 
expresses any monotone translation invariant operator as an inf-convolution with
a family of structuring functions. We proved it at the very beginning of this chapter. Its
consequences 
are developped in Serra \cite{Serra:1986:IMM}, Sternberg,
\cite{Sternberg:1986:GM}, Maragos \cite{Maragos:1989:RTM}.  An algebraic 
general framework is proposed by Heijmans \cite{Heijmans:1991:TAG}.
The problematics of simplifying the structuring set of  functions is adressed
in \cite{Gader:1991:SDA, Jones:1994:ADG, Charif-Chefchaouni:1994:MRN}.
 Jackway \cite{Jackway:1995:DMM} develops the notion of a scale space based
on the inf-convolution of the image with quadratic forms at different scales.
  \newline
\newline
{\bf Hamilton Jacobi evolution equations associated with nonflat Mathematical Morphology}

The discovery of the asymptotics of morphological filters 
is relatively recent. See \cite{Brockett:1994:EEC} and 
\cite{Maragos:1998:PDE}, who reinterpret in image analysis results  like the Hopf-Lax formula, which were classical in the numerical  analysis of P.D.E.'s and in Optimal Control. See the books Evans \cite{Evans:1998:PDE} and Barles \cite {Barles:1994:SVE}.
The use of the Fenchel-Legendre of $f$ transform for studying the equation 
$\frac{\partial u}{\partial t}=f(|Du|)$ when $f$ is convex. The "slope transform"
used in \cite{Heijmans:1997:LCM, Maragos:1995:STT} is nothing but a new name 
for the Fenchel-Legendre transform.
For a general study of the approximation of parabolic equations by sup-inf schemes see \cite{Cao:2000:PT}.
\newline
\newline
{\bf Deblurring and inverse heat equation, shock filters}

Gabor seems to be the first to have introduced the problem of deblurring 
an image by inverting the heat equation \cite{Lindenbaum:1994:GCI}.
For more and more sophisticated attempts to perform this inverse
heat equation, see Hummel et al. \cite{Hummel:1983:GBH, Hummel:1987:DGB}.
Nonlinear local filters for image enhancement are proposed as early as 1970
\cite{Scollar:1970:IEU,Schreiber:1970:WQI}. 
Kramer and Bruckner introduced in 1975 the nonlinear enhancement filter which
we called Kramer filter \cite{Kramer:1975:INL}.
In \cite{Schavemaker:1999:ISM}, the Kramer filter and its asymptotics
is discussed in one dimension. We extended this discussion to two dimensions in the present
chapter
and showed that the Kramer filter is a shock filter where the Laplacian is replaced
by the Canny operator $D^2u(Du,Du)$.  Aubert and Kornprobst independently proposed the use of Canny operator for shock filters \cite{Aubert-Kornprobst}.
The term of shock filter itself was framed by Rudin in his PhD dissertation
\cite{Rudin:1987:INA}, inspired from the use of nonlinear filters in 
shock simulation for P.D.E.'s \cite{Engquist:1989:NFE}. The shock filter 
discussed in the text uses Osher-Rudin \cite{Stanley:1990:FOI}
 Alvarez and Mazorra \cite{Alvarez:1994:SIR} proposed to combine in restoration an anisotropic diffusion with 
a shock filter.  Price et al. \cite{Price:1990:IEA} propose instead closely related reaction-diffusion equations 
to the same aim. See also \cite{Alvarez:1997:IQU} for the  use of reaction-diffusion equations
in image quantization : in some extent, quantization acts as a sharpening.
As noticed in \cite{You:1997:FSI}, the Perona-Malik equation leads
to the formation of step images, in the same way as the studied shock filters.
  



\part{Viscosity Solutions and Convergence of Iterated Filters \label{PART4}}

\chapter{Viscosity solutions. \label{chapter15}}
\thispagestyle{empty}

%#s#s1
\section{Definition and main properties.}


In what follows, we always consider  functions $u(t, \fxx)$ which are 
continuous on $[0,\infty[\times \real^N$.  We shall also consider  first and second derivatives
of  real functions.  We recall that if $u$ is $C^2$, then we denote by $Du$ and $D^2u$ the first and second partial derivatives of $u$ with respect to $\fxx$. $D^2u(t,\fxx)$ is a bilinear form, or,
if we choose an euclidean basis,  a symmetric matrix.  Symmetric matrices (or bilinear forms)
can be ordered in the following way.  We say that a symmetric matrix 
$A=(A_{ij})_{1\leq i, j \leq N}$ is nonnegative \index{nonnegative matrix} if for all $p\in
\real^N$, 
$$A(p,p)=^tpAp=\sum_{i,j=1}^NA_{ij}p_ip_j\geq 0.\notation$$
 We say that $A\geq B$ if 
$A-B\geq 0$.  
%%We denote by $(A_{i,j})_{1\leq i,j\leq N}$ the elements of the matrix 
%%$A$, that is~: $A_{i,j}=A(e_i,e_j)$\notation where $(e_i), i=1,...,N$ is the chosen basis.  As
%%for a main example, if we call $(x_i)$ the coordinates of points $\fxx\in \real^N$ in a
%%canonical  basis and if $u$ is a $C^2$ function on $\real^N$, then
%%$(D^2u(\fxx))_{i,j}=\frac{\partial ^2u}{\partial x_i\partial x_j}(\fxx)$\notation.
 The parabolic equations we shall consider in this chapter are associated
with a differential operator $F(D^2u, Du, \fxx, t)$ where $F$ is assumed to 
be continuous with respect to  all of its arguments (except, in some case, at $Du=0$) and
nondecreasing with respect to  the first argument~:
\fb&
\forall\; A, B, p, t, \quad A\geq B \Rightarrow F(A, p, \fxx, t)\geq F(B, p, \fxx, t).
\label{MonotoniedeF}
\fe&

\index{parabolic equation} \index{elliptic differential operator}

\skipaline
It will be  convenient to consider the case where $F(A,p,\fxx,t)$ is not continuous at $p=0$. 
This occurs for one of the most relevant equations considered in this book, the curvature
equation $\frac {\partial u}{\partial t} = |Du|\curv(u)$.  This equation corresponds to 
$F(A,p,\fxx, t)= A(\frac{p^\perp }{|p|}, \frac{p^\perp }{|p|})$ which is not continuous at
$p=0$, but admits an continuous bound. 

\begin{Defi} {\bf and assumption}. \label{extensionsemicontinue} 
We call admissible function $F$ a function $F$ satisfying (\ref{MonotoniedeF}), which is 
%% \begin{description}
%% \item{H}\ref{extensionsemicontinue}.i : continuous for all $A,p,\fxx,t$, and $F(0,0,\fxx,t)=0$.
%%\item{H}\ref{extensionsemicontinue}.ii :
continuous for all $A, p\neq 0, \fxx, t$ and such that there exists two continuous functions $G^+(A,p,\fxx,t)$ and $G^-(A,p,\fxx,t)$, with 
$$ G^+(0,0,\fxx,t) = G^-(0,0,\fxx,t) = 0, $$
$$ \forall A\geq 0,\; G^+(A,0,\fxx,t) \geq 0 \hbox{ and } G^-(-A,0,\fxx,t) \leq 0 \hbox{ and }$$
\fb&
\forall A,p,\fxx,t, \;\hbox{ }  G^-(A,p,\fxx,t) \leq F(A,p,\fxx,t) \leq G^+(A,p,\fxx,t).  \label{extensionsemicontinueB} \fe&
%% \end{description}
\end{Defi}

\begin{Remark} Let us first note that if $F$ is continuous everywhere and  $F(0, 0,\fxx, t)=0$, then $F$ is admissible. (Choose, e.g.  $G^\pm=F$). Conversely, if $F$ is admissible and we set 
$F(0, 0, \fxx, t)=0$, then $F$ is continuous at $(0, 0, \fxx, t)$.
\end{Remark}

\begin{Remark} {\bf (Main example : the curvature equation)}
We remark that in the case of the curvature equation that $F$ is admissible, with e.g. $G^+(A,p,\fxx,t)$ (resp. $G^-$) equal to the largest (resp. smallest) of the eigenvalues of $A$.
\end{Remark}

\noindent
 Returning to
some examples which are of main interest for us, let us list
\newline$\bullet$ $F(A,p)= |p|$ or $-|p|$, which is the case of dilation and erosion with scale
$t$, associated with $\frac{\partial u}{\partial t} = |Du|$ or $-|Du|$,
\newline$\bullet$ $F(A,p)= \hbox{trace}(A)$, which is the case of the heat equation $\frac
{\partial u}{\partial t} = \Delta u$,
\newline$\bullet$ $F(A,p)= \frac{p_1^2A_{2,2}-2p_1p_2A_{1,2}+p_2^2A_{1,1}}{|p|^2}$, which 
corresponds to the  curvature equation in dimension 2,
\newline$\bullet$ $F(A,p)=(p_1^2A_{2,2}-2p_1p_2A_{1,2}+p_2^2A_{1,1})^{\frac 1 3}$ which 
corresponds to an affine invariant and contrast invariant smoothing which we call later on
``Affine Morphological Scale Space (AMSS)". The associated equation  is
\fb&
\label{premierAMSS}
\frac {\partial u}{\partial t} = |Du|(\curv(u))^{\frac 1 3}.
\fe&  \index{AMSS - Affine Morphological Scale Space}
In this later case, notice that $F$ is continuous at all points $(A,p)$.

\begin{Remark}  It would be confortable to define a solution of the preceding equations by
stating that $u$ is $C^2$ in $\fxx$, $C^1$ in $t$ and   satisfies the equation
$\frac {\partial u}{\partial t}=F(D^2u, Du, \fxx, t)$ at all points
$(t, \fxx)$. In this case, we say that $u$ is a ``classical" solution of the equation. Such a
definition works (e.g.) for the heat equation, for which we have shown the existence of classical
solutions.  There are, however, equations among the ones considered above for which a $C^2$, or
even a $C^1$ solution is not to be expected.  
  Let us give an example where
a seemingly ``classical" solution is not the right one and violates the comparison principle. 
Set $u_0(\fxx) = -|\fxx|$.  Then one is tempted to propose, as a solution for
$\frac{\partial u}{\partial t} = |Du|$, the function $\tilde u(t,\fxx) = t-|\fxx|$. For all $t$
and all
$\fxx\neq 0$, we indeed have $\frac {\partial\tilde u}{\partial t}=1=|D\tilde u(\fxx)|$.  Now,
this ``solution" violates the comparison principle.  This 
can be checked by comparing this solution with the $C^\infty$ solution of the same equation with
initial datum $\varphi_0(\fxx) \equiv 0$, which obviously is 
$\varphi(t,
\fxx)
\equiv 0$.  The right, comparison preserving, solution is in fact $u(t,\fxx)  = \min(0,
t-|\fxx|)$.  Notice that this last solution is not $C^1$, so that it cannot be defined as a
classical solution.  The difficulty of defining a right concept of solution is still more
challenging in the case of equations like the mean curvature equation.  A fast way to capt the
difficulty is to use the contrast invariance~: let $g(r)$ be a nondecreasing continuous, but
not $C^1$ real function and $u_0(\fxx)$ an initial datum in $\real^N$. Assume that we have been
able to define a ``classical" solution $u$ for a curvature equation like (\ref{premierAMSS}) or
the mean curvature motion with initial datum $u_0$.  By contrast invariance, it is to be
expected that
$g(u)$ will be a solution for the same equation with initial datum $g(u_0)$.  Since $g$ is not 
$C^1$, it cannot, however, be expected that this solution will be even $C^1$.  We only can
assert that it is continuous. 
 \end{Remark} 



\skipaline
Although we cannot write properly the equation for an expected solution
because of its lack of regularity, we can instead compare it with smooth, classical solutions.
 To this aim, we denote by
$C^\infty(\real^N)$\notation the set of continuous, infinitely differentiable
functions on
$\real^N$.
 \begin{Defi} \index{solution!viscosity} \index{viscosity solution} \index{classical solution}
\label{definitionviscosity}
Let us first assume that $F$ is admissible.
We shall say that
$u$ is a viscosity subsolution at  point $\fxx_0$ and scale $t_0$
of
\fb& 
\label{equationgenerale}
	\frac{\partial u}{\partial t}(t, \fxx) -
F(D^2u(t,\fxx), Du(t, \fxx), \fxx, t) = 0 
\fe&
 if $u$ is a continuous function and if for all 
$\varphi$ in $C^\infty( [0, T]\times \real^N)$ such that $(t_0, \fxx_0)$ is a local strict
maximum point of $u-\varphi$, we have if $D\varphi(t_0,\fxx_0) \neq 0$
\fb&
\label{subsolution}
	\frac{\partial \varphi}{\partial t}(t_0, \fxx_0) -
F(D^2\varphi(t_0,\fxx_0), D\varphi(t_0, \fxx_0), \fxx_0, t_0 ) \leq 0,
\fe&
and if $D\varphi(t_0,\fxx_0) = 0$ and $D^2\varphi(t_0,\fxx_0) = 0$
\fb&
\label{subsolution2}
	\frac{\partial \varphi}{\partial t}(t_0, \fxx_0) \leq 0.
\fe&
Similarly,
$u$ is a viscosity supersolution at  point $\fxx_0$ and scale $t_0$
if for all  $\varphi$ in $C^\infty( [0, T]\times \real^N)$ such that $(t_0,
\fxx_0)$ is a local strict maximum point of $\varphi-u$, we have if $D\varphi(t_0,\fxx_0) \neq 0$
\fb&
\label{supersolution}
	\frac{\partial \varphi}{\partial t}(t_0, \fxx_0) -
F(D^2\varphi(t_0,\fxx_0), D\varphi(t_0, \fxx_0), \fxx_0, t_0 ) \geq 0.
\fe&
and if $D\varphi(t_0,\fxx_0) = 0$ and $D^2\varphi(t_0,\fxx_0) = 0$
\fb&
\label{supersolution2}
	\frac{\partial \varphi}{\partial t}(t_0, \fxx_0) \geq 0.
\fe&

We call $u$  a viscosity solution at  point $\fxx_0$ and scale $t_0$ if it is both a
viscosity subsolution and a supersolution.\newline
If $u(t,\fxx)$ is a viscosity solution of (\ref{equationgenerale}) at each point of
$\real^{+,
\star}\times\real^N$ and if 
$u(0, \fxx) = u_0(\fxx)$, we say that $u$ is a viscosity solution of equation
(\ref{equationgenerale}) with initial condition $u_0$.
\end{Defi}

\PSINGMORPUN
\PSINGMORPTWO


Of course, this definition makes sense only if we prove that ``classical" solutions of 
(\ref{equationgenerale}) also are viscosity solutions !  This will be done in Proposition
\ref{classiqueimpliqueviscosite} below.
The next lemmas yield a significant simplification of the calculations when we check
that a function is a viscosity solution.  Of course, all statements on subsolutions are also
valid for supersolutions with the adequate changes.

\begin{lem}
\label{maximumnonstrict}If $u$ is a
viscosity subsolution and
$u-\varphi$ has a (not necessarily strict) local maximum at $(t_0, \fxx_0)$, then the same
conclusion holds for (\ref{subsolution} or  \ref{subsolution2}).
\end{lem}

\paragraph{Proof}  Just replace $\varphi(t, \fxx) $ by $\psi(t,\fxx)=\varphi(t, \fxx) +
(t-t_0)^4+(\fxx-\fxx_0)^4$.  Then the first and second derivatives of $\psi$ are equal
to those of $\varphi$ and $(t_0, \fxx_0)$ is now a strict local maximum of $u-\psi$.
\enddemo


\begin{Remark}
Let us note that the relations (\ref{subsolution} - \ref{supersolution2}) do not give any bound of the partial derivative of $\varphi$ with respect to $t$, in the case where $D\varphi=0$ and $D^2\varphi \neq 0$.
The next lemma proves that in fact (\ref{subsolution}) and  resp. (\ref{supersolution}) hold even in this case, with $F$ replaced by any function $G^+$ (resp. $G^-$), where $G^\pm$ satisfies \ref{extensionsemicontinueB}. In particular if $F$ is continuous everywhere then (\ref{subsolution}) and (\ref{supersolution}) are satisfied everywhere.
\end{Remark}


\begin{lem} \label{lemmaBarles}
Let us assume that $F$ is admissible, and $G^+$ and $G^-$ two continuous functions satisfying \ref{extensionsemicontinueB}. A continuous function $u$ is a viscosity subsolution (resp. supersolution) at point $(t_0, \fxx_0)$ of (\ref{equationgenerale}) if and only if it satisfies (\ref{subsolution}) at each point $(t_0, \fxx_0)$ which is a local maximum of $u-\varphi$,   and 
\fb& 
\frac{\partial \varphi}{\partial t}(t_0, \fxx_0) -
G^+(D^2\varphi(t_0,\fxx_0), D\varphi(t_0, \fxx_0), \fxx_0, t_0 ) \leq 0  \label{subsolution3}
\fe&
(resp.  it satisfies (\ref{supersolution}) at each point $(t_0, \fxx_0)$ which is a local minimum of $u-\varphi$,  and
\fb& 
\frac{\partial \varphi}{\partial t}(t_0, \fxx_0) -
G^-(D^2\varphi(t_0,\fxx_0), D\varphi(t_0, \fxx_0), \fxx_0, t_0 ) \geq 0  \label{supersolution3}
\fe&
\end{lem}

An immediate consequence of this lemma is that if $F$ is admissible and continous, and $u$ a viscosity subsolution (resp. super-solution), then (\ref{subsolution}) (resp. (\ref{supersolution})) holds even if the gradient is null.


\paragraph{Proof}
It is clear that if (\ref{subsolution3}) holds then (\ref{subsolution2}) holds. Let us prove the 
converse statement:
Let $u$ be a continuous function satisfying (\ref{subsolution}) and (\ref{subsolution2}). Let
 also $\varphi$ be a $C^2$ function such that $(t_0,\fxx_0)$ is a strict local maximum of $u-\varphi$. We have to prove that for any continuous $G^+$ satisfying Condition (\ref{extensionsemicontinueB}), if $D\varphi(t_0,\fxx_0)=0$ and $D^2\varphi(t_0,\fxx_0)\neq 0$, then (\ref{subsolution3}) holds.   (The other cases are immediate).

Let us consider the function $\psi_\epsilon(t,\fxx,\fxy)  = u(t,\fxx) - \varphi(t,\fxy) - \frac{|\fxx - \fxy|^4}{\epsilon}$. Since $(t_0,\fxx_0)$ is a strict maximum point of $u-\varphi$, one proves easily that there exists a sequence $(t_\epsilon,\fxx_\epsilon, \fxy_\epsilon)$ of local maximum points of $\psi_\epsilon$ converging to $(t_0,\fxx_0, \fxx_0)$. For
$\fxx_\epsilon$ fixed, $\psi$ is twice differentiable with respect to $\fxy$ and has a local maximum for $\fxy=\fxy_\epsilon$. Thus
$$D\varphi_\epsilon(t_\epsilon, \fxy_\epsilon) = \frac{4(\fxx_\epsilon - \fxy_\epsilon)|\fxx_\epsilon - \fxy_\epsilon|^2}{\epsilon},$$
and
$$
D^2\varphi(t_\epsilon, \fxy_\epsilon) \geq -\frac{1}{\epsilon} (4|\fxx_\epsilon - \fxy_\epsilon|^2 Id - 8 (\fxx_\epsilon - \fxy_\epsilon) \otimes  (\fxx_\epsilon - \fxy_\epsilon)).
$$

Two cases:

\begin{enumerate}
\item
$D\varphi(t_\epsilon, \fxy_\epsilon) = 0$, then $\fxx_\epsilon = \fxy_\epsilon$. 

Now, fixing $\fxy = \fxy_\epsilon$, $\psi_\epsilon$ has a local maximum at $\fxx_\epsilon$ with respect to the $\fxx$ variable. Using ($\ref{subsolution2}$) we get
$$\frac{\partial \varphi}{\partial t}(t_\epsilon, \fxy_\epsilon) \leq 0$$
and since $D^2\varphi(t_\epsilon, \fxy_\epsilon) \geq 0$, for any continuous $G^+$ satisfying (\ref{extensionsemicontinueB}), $G^+(D^2\varphi(t_\epsilon, \fxy_\epsilon),0,\fxy_\epsilon,t_\epsilon) \geq 0$. Thus
$$\frac{\partial \varphi}{\partial t}(t_\epsilon, \fxy_\epsilon) \leq G^+(D^2\varphi(t_\epsilon, \fxy_\epsilon),0,\fxy_\epsilon,t_\epsilon).$$
Letting $\epsilon$ tends to zero, by continuity of $G^+$, we deduce that (\ref{subsolution3}) holds at point $(t_0,\fxx_0)$.

\item
$D\varphi(t_\epsilon, \fxy_\epsilon) \neq 0$. We remark that $(t_\epsilon, \fxx_\epsilon)$ is a maximum point of
$$(t,\fxx) \rightarrow u(t, \fxx) -  \varphi(t,\fxx - (\fxx_\epsilon - \fxy))  - \frac{|\fxx - \fxy|^4}{\epsilon}$$
Then using (\ref{subsolution}), we have
$$ \frac{\partial \varphi}{\partial t} \leq F(D^2\varphi(t_\epsilon, \fxy_\epsilon),D\varphi(t_\epsilon, \fxy_\epsilon),\fxy_\epsilon,t_\epsilon) \leq G^+(D^2\varphi(t_\epsilon, \fxy_\epsilon),D\varphi(t_\epsilon, \fxy_\epsilon),\fxy_\epsilon,t_\epsilon) $$
Letting $\epsilon$ tend to zero, and using the continuity of $G^+$ we conclude that (\ref{subsolution3}) holds at point $(t_0,\fxx_0)$.
\end{enumerate}

\endproof




\begin {lem} 
\label{formefi=f+gsuffit}
If $u$ satisfies the subsolution (resp. the supersolution) definition \ref{definitionviscosity}
 for any $C^\infty$ function $\varphi$ of the 
form $\varphi(\fxx, t) = f(\fxx)+g(t)$, then it is a subsolution (resp. a supersolution).
\end{lem}

\paragraph{Proof}
Let $\varphi(\fxx, t)$ be a $C^\infty$ function such that $u-\varphi$ attains its 
maximum at $(\fxx_0, t_0)$.  We wish to show that (\ref{subsolution}) is satisfied.  Without
loss of generality, we may assume that the origin  is at  $(\fxx_0, t_0)$, so that $(\fxx_0,
t_0)=(0,0)$.  By Taylor formula, we can write 
$$
\varphi(\fxx, t) = a+bt+\zprec p, \fxx\zsucc
+ ct^2+\zprec Q\fxx, \fxx\zsucc + t \zprec q, \fxx \zsucc +  o(|\fxx^2| + t^2), 
$$
where $a = \varphi(0)$, $q=\frac 1 2(\frac{\partial^2\varphi}{\partial x_1\partial t}(0), ...,
\frac{\partial^2\varphi}{\partial x_N\partial t}(0))$, etc..
We then set
$$f(\fxx) = a + \zprec p, \fxx\zsucc + \zprec Q\fxx, \fxx \zsucc + \varepsilon |\fxx|^2
+\varepsilon |q||\fxx|^2$$ and
$$g(t) = bt +\frac {|q|}{\varepsilon}t^2 + \varepsilon t^2 +ct^2,$$
 so that
$$\varphi(\fxx, t) = f(\fxx) + g(t) - (\varepsilon |q||\fxx|^2 + \frac{|q|}{\varepsilon}t^2 +
t\zprec q, \fxx \zsucc + \varepsilon (|\fxx|^2+t^2)) + o(|\fxx|^2 + t^2).$$
Since, by Cauchy-Schwartz inequality, 
$\varepsilon |q||\fxx|^2 + \frac{|q|}{\varepsilon}t^2 +
t\zprec q, \fxx \zsucc\geq 0,$
we have $\varphi(\fxx, t)\leq f(\fxx) + g(t)$ for $(\fxx, t)$ small enough. Thus, in 
a neighborhood of $0$, $u(t, \fxx)-\varphi(\fxx, t)\geq u(t, \fxx)-f(\fxx)-g(t)$.  This 
means that $u-f-g$ attains its maximum at $0$ and therefore, by assumption,

\begin{enumerate}
\item if $D\varphi(0) = D(f+g)(0) \neq 0$ then by (\ref{subsolution})
$$
\frac{\partial(f+g)}{\partial t}(0)\leq F(D^2(f+g)(0), D(f+g)(0), 0, t).
$$
Noting that $\frac{\partial(f+g)}{\partial t}(0)=\frac{\partial\varphi}{\partial t}(0)$,
 $D^2(f+g)(0)= D^2\varphi(0)-2\varepsilon(1+|q|)Id $ and $D(f+g)(0)=D\varphi(0)$, we finally
obtain
$$
\frac{\partial\varphi}{\partial t}(0)\leq F(D^2\varphi(0)-2\varepsilon(1+|q|) Id, D\varphi(0), 0,
t).
$$
We let $\varepsilon \to 0$, use the continuity of $F$  with respect to $X$
and conclude.

\item if $D\varphi(0) = D(f+g)(0) =0$ then by (\ref{subsolution3}),
$$
\frac{\partial(f+g)}{\partial t}(0)\leq G^+(D^2(f+g)(0), D(f+g)(0), 0, t).
$$
Then letting $\varepsilon \to 0$ and using the continuity of $G^+$ yields (\ref{subsolution3}) with $\varphi$.
\end{enumerate}

  The same proof applies with obvious adaptations to the supersolution property.
\enddemo

\begin{Exercice} \label{viscositeformesquadratiquessuffisent} Let $F$ be admissible.
Show that, in the definition of the viscosity solutions (associated with $\frac{\partial u}{\partial t} = F(D^2u, Du,\fxx,t)$), we can enforce further the test function $f$ to
belong to any class $\cal C$ of $C^2$ functions having the following property:
For any $\fxx \in \real^N$ and any quadratic form $Q$, there exists 
$\varphi \in \cal C$ such that
$$ f(\fxy) = Q(\fxy) + o((\fxy - \fxx)^2). $$
(Indication: use the order 2 Taylor expansion of $\varphi$.)
\end{Exercice}


\noindent
The next two propositions show that the notion of
viscosity solution is a generalization of the  concept of ``classical" solution.

\begin{pro}
\label{classiqueimpliqueviscosite}
Let $F(A,p,\fxx,t)$ be admissible and continuous everywhere, and $u$ be a classical,
(i.e.
$C^2$ with respect to
$\fxx$ and
$C^1$ with respect to
$t$), solution  at  point $(\fxx_0, t_0)$ of 
$$
\frac{\partial
u}{\partial t}(t, \fxx) = F(D^2 u, Du, \fxx, t).
$$ 
Then $u$ is a viscosity solution at this point.
\end{pro}

\paragraph{Proof~:}
We do the case where $Du \neq 0$ at point $(t_0, \fxx_0)$. (The other case,
$Du(t_0, \fxx_0)=0$ and $D^2u(t_0, \fxx_0)=0$, is immediate). Let $\varphi$ be a $C^\infty(\real^N\times\real^+ \rightarrow \real)$
function such that $(t_0,\fxx_0)$ is a local maximum point of
$u-\varphi$.
This implies that 
$(\frac{\partial u}{\partial t}, Du)(t_0, \fxx_0)=
(\frac{\partial \varphi}{\partial t}, D\varphi)(t_0, \fxx_0)$ and 
$D^2(u-\varphi)(t_0, \fxx_0)\leq 0,$ i.e.
$$D^2 u(t_0, \fxx_0) \leq D^2 \varphi ( t_0, \fxx_0).
$$
Thus, 
$$\frac{\partial \varphi}{\partial t}(t_0, \fxx_0) = \ut& (t_0, \fxx_0)
= F(D^2u(t_0,\fxx_0), Du(t_0, \fxx_0), \fxx_0, t_0) \leq F(D^2
\varphi(t_0, \fxx_0), D\varphi(t_0, \fxx_0), \fxx_0, t_0).
$$
We deduce that $u$ is a subsolution and we prove  
in the same way that $u$  also is a supersolution.
\endproof


\begin{pro}
\label{viscositeC2impliqueclassique}
Let $F(A, p, \fxx, t)$ be admissible and continuous everywhere. Let $u(t,\fxx)$ be a
$C^2$ viscosity solution of $\frac {\partial u}{\partial t}=F(D^2u, Du, \fxx, t)$. Then
$u$ is a classical solution of the same equation.
\end{pro}

\paragraph{Proof~:}
We assume that $u$ is a viscosity solution, and is $C^2$ at  point
$(t_0, \fxx_0)$. We note $\tilde Du = (\ut& , Du)\in\real^{N+1}$.  By Taylor formula,
 $$
 u(t, \fxx) = u(t_0,\fxx_0) + \zprec
\tilde Du(t_0,\fxx_0), (t-t_0, \fxx- \fxx_0) \zsucc $$
$$+ \zprec \tilde D^2u (t_0, \fxx_0)
(t-t_0,\fxx - \fxx_0), (t-t_0, \fxx-\fxx_0) \zsucc + o(|\fxx-\fxx_0|^2+|t-t_0|^2).
$$
For $\varepsilon\in \real$ we set
$$
 \varphi_\varepsilon = u(t_0, \fxx_0) + \zprec \tilde Du, (t-t_0,
\fxx-\fxx_0) \zsucc + \zprec (\tilde D^2 u(t_0, \fxx_0) + \varepsilon Id)
((t-t_0, \fxx- \fxx_0), (t-t_0, \fxx-\fxx_0) \zsucc .
$$
Then,
$(t_0, \fxx_0)$ is a local maximum of $u- \varphi_\varepsilon$, and a local maximum
of $\varphi_{-\varepsilon}-u$.
Since $F$ is continuous and $u$ is a viscosity solution at  point $(t_0, \fxx_0)$, we have by the first
definition of viscosity solution (\ref{definitionviscosity})
$$
\frac{\partial u}{\partial t} = \frac{\partial
\varphi_\varepsilon}{\partial t} \leq F(D^2 \varphi_\varepsilon, D\varphi_\varepsilon,
\fxx_0, t_0)= F(D^2 u + \varepsilon Id, Du, \fxx_0, t_0)
$$
$$
\frac{\partial u}{\partial t} = \frac{\partial \varphi_{-\varepsilon}}{\partial t} \geq F(D^2
\varphi_{-\varepsilon}, D\varphi_{-\varepsilon}, \fxx_0, t_0) = F(D^2 u -
\varepsilon Id, Du, \fxx_0, t_0). 
$$ 
Letting $\varepsilon \rightarrow 0$ and using the continuity of $F$
we obtain
$$
\ut& (t_0, \fxx_0) = F(D^2 u, Du, \fxx_0, t_0).
$$


\endproof




\section{Application to mathematical morphology.}

Consider the dilation of a function $u_0(\fxx)$ by balls with radii $t$, that is 
$$u(t, \fxx) = \sup_{\fxy \in B(0, t)}u_0(\fxx+\fxy), \; u(0, \fxx) = u_0(\fxx).$$
In that case, we have shown that at points $(t, \fxx)$ where $u(t, \fxx) $ is  $C^1$, we have
$\frac {\partial u}{\partial t} = |Du|$.  Let us now show that this same equation is satisfied
in the viscosity sense by $u$ at {\it all} points.  The following theorem and proofs are
immediately generalizable to dilations or erosions by an arbitrary convex set.

\begin{th1} The function
$u$ defined by $u(t, \fxx) = \sup_{\fxy \in B(0, t)}u_0(\fxx+\fxy)$ is a viscosity solution of 
\fb&
 \label{visdil} \frac{\partial u}{\partial t} = |Du|, \qquad u(0, \fxx) = u_0(\fxx)
\fe&


\end{th1}

\paragraph{Proof~:}
We shall use the fact that $u$ satisfies the recursive property
\fb&
 u(t, \fxx)= \sup_{|\fxy| \leq h} u(t-h, \fxx + \fxy).\label{dilationrecursive}
\fe&

Let  $\varphi$ $\in C^\infty(\real^N\times\real^+)$. Let $(t_0, \fxx_0)$ a local maximum point
of
$u-\varphi$. In order to prove that $u$ is a subsolution of the equation (\ref{visdil}) we
have to prove that
$$
 \frac{\partial \varphi}{\partial t}(t_0, \fxx_0) - |D\varphi|(t_0, \fxx_0) \leq 0.
$$
We have, for $h$ and $y$ small enough,
$$
 u(t_0-h,\fxx_0+\fxy) - \varphi(t_0- h,\fxx_0+\fxy) \leq u(t_0,\fxx_0)
- \varphi(t_0,\fxx_0).
$$
We deduce that
$$
\sup_{|y| \leq h} u(t_0-h ,\fxx_0+\fxy) \leq u(t_0, \fxx_0) -
\varphi(t_0, \fxx_0) + \sup_{|y| \leq h} \varphi(t_0-h ,\fxx_0+\fxy)
$$
and, using  (\ref{dilationrecursive}),
$$
  u(t_0, \fxx_0) \leq u(t_0, \fxx_0)-
\varphi(t_0, \fxx_0) + \sup_{|y| \leq h} \varphi(t_0-h ,\fxx_0+\fxy).
$$
Thus
$$
\varphi(t_0, \fxx_0) \leq  \sup_{|y| \leq h} \varphi(t_0-h ,\fxx_0+\fxy).
$$
Subtracting $\varphi(t_0-h,\fxx_0)$ on both sides, we get
$$
\varphi(t_0, \fxx_0) - \varphi(t_0-h, \fxx_0)\leq  \sup_{|y| \leq h} \big(
\varphi(t_0-h ,\fxx_0+\fxy) -\varphi(t_0-h, \fxx_0) \big).
$$
Dividing by $h$ and letting $h$ tends to $0$ yields
$$
 \frac{\partial \varphi}{\partial t}(t_0, \fxx_0) - |D\varphi|(t_0, \fxx_0) \leq 0.
$$
Thus $u$ is a subsolution and we prove in the same way that it is a supersolution
of (\ref{visdil}).
\enddemo


\section{Approximation theory of viscosity solutions}
In the following, we consider for simplicity a slightly less general kind of equation for which
the second member is independent of $t$, that is
\fb&
\label{equationgeneralesanst}
	\frac{\partial u}{\partial t}(t, \fxx) -
F(D^2u(t,\fxx), Du(t, \fxx), \fxx) = 0.
\fe&
$F(A, p, \fxx)$ is assumed to be admissible (Definition \ref{extensionsemicontinue}).
 For such equations, we can expect that the operator
$S_t: u_0\to u(\fxx, t)$ can be approximated by the iteration of a single operator $T_h$, that 
is,
$(T_h)^n\to S_t$ in some sense as $nh\to t$. Of course, we have {\it exactly} $S_t=(S_h)^n$ if
$t=nh$.  Now, we are concerned with  operators $T_h$ with a  definition plainer than $S_h$.  To
be precise, we have in mind precisely the same scaled ``$\inf\sup$" operators which have been
considered in the preceding chapter of this book (Chapters \ref{Asymptotic}-\ref{Consistency}).  We shall now list some
very reasonable properties which
$T_h$ must  have if it is asked to have the same structure as
$S_h$ when $h\to 0$.  It is immediately checked  that those properties are true for the
scaled ``$\inf\sup$" operators we have just mentioned.

\begin{Defi} \index{operator!consistency} \index{consistency with an equation}
We say that a family of operators $T_h, h>0$ is \underline {uniformly consistent with Equation
\ref{equationgeneralesanst}} if for every $C^3$, Lipschitz function $u$
we can assert that \fb& 
\label{consistencywithequationgenerale}
\hbox{if } Du(\fxx) \neq 0,
 (T_hu)(\fxx)-u(\fxx) = h F(D^2u, Du, \fxx) + o_{\fxx}(h),
\fe&
where the convergence of $ o_{\fxx}(h)$ is uniform for $\fxx$ in every compact set $K$ contained in the set $\{\fxx, Du(\fxx)\neq 0 \}$. (That is $o_{\fxx}(h) \leq C_{u,K} |h|$, for a constant $C_{u,K}$ depending only of $u$ and $K$.)
\fb&
\hbox{if } Du(\fxx) = 0 , | (T_hu)(\fxx)-u(\fxx)| \leq h G( D^2u,0,\fxx) + o_{\fxx}(h)
\fe&
for a continuous functions $G$, with $G(0,0,\fxx) = 0$, and where the convergence of $o(h)$ is uniform for $\fxx$ in every compact set. \index{uniform consistency}
\end{Defi}

\begin{Defi} \index{operator!local comparaison principle} \index{local comparaison principle} \index{uniform local comparaison principle}
We say that a family of operators $T_h, h>0$ satisfies a uniform local comparison principle  if
for every L and all L-Lipschitz functions $u$ and $v$ such that
$u(\fxy)>v(\fxy)$ on a disk $D(\fxx,r)\setminus \{\fxx\}$ deprived of its center, 
we can assert that 
\fb&
 \label{localmaximumprinciple}
(T_hu)(\fxx)\geq (T_hv)(\fxx) - o(h),
\fe&
where the function $o(h)$ only depends upon the Lipschitz constant $L$ and $r$.

\end{Defi}
Notice that if $T$ is a morphological operator and $T_h$ its rescaled version, (\ref{localmaximumprinciple}) is trivially
satisfied, with $o(h)=0$.

\begin{Defi} 
\label{definitionu-h}
Let $T_h$, $h>0$, be a family of operators consistent with Equation 
(\ref{equationgeneralesanst}).  We call {\bf approximate solutions} of
(\ref{equationgeneralesanst}) with initial condition $u_0(\fxx)$ the
functions $u_h(t, \fxx)$ defined for every $h>0$ by
$$
\forall n\in \natural,\quad u_h(nh, \fxx) = (T_h^nu_0)(\fxx),
$$
$$
\forall t\in [(n-1)h, nh[, \; u_h(t, \fxx) = u_h((n-1)h, \fxx).
$$
\end{Defi}

\index{approximate solutions}
The next proposition is known as the Barles-Souganidis principle for the approximation of viscosity
solutions.
\begin{pro} (Barles-Souganidis) [Convergence] \label{limitedeuhestsolution} \index{convergence lemma towards viscosity solutions.} \index{Barles-Souganidis principle}
Let $(T_h)_{h\geq 0}$ be a family of operators uniformly consistent
with (\ref{equationgeneralesanst}),  satisfying a uniform comparison  principle and commuting
with the addition of constants ($T_h(u+C)=T_hu + C$).  Assume that a sequence of approximate
L-Lipschitz solutions $u_{h_k}$ converges uniformly on every compact set to a function $u$, with
$h_k\to 0$. 
Then
$u$ is a viscosity solution of  (\ref{equationgenerale}).
\end{pro}
Before starting with the proof, let us state an obvious but useful lemma.

\begin{lem}\label{conservationdumaximumstrict}
Let  $v_k$ be a sequence of continuous functions converging uniformly on a disk $D(\fxx,
r)$ to a  function $v$. Assume that $x$ is a strict maximum point for $v$ on $D(\fxx, r)$.
Let $\fxx_k$ be a  maximum point of $v_k$ on $D(\fxx, r)$.  Then $\fxx_k $ tends to $\fxx $
as $k\to +\infty$. 
\end{lem}


\paragraph{Proof of Proposition \ref{limitedeuhestsolution}}
Without risk of ambiguity, we shall write $u_h$ instead of $u_{h_k}$. 
Let  $D=D((\fxx, t), r)$ be a disk and $\varphi (s, \fxy)$ a $C^\infty$ function such that 
$(u-\varphi)(s, \fxy)$ attains its strict  maximum on $D$ at $(t, \fxx)$. Without loss of
generality, we can assume by Lemma \ref{formefi=f+gsuffit} that $\varphi(t, \fxy) =
f(\fxy)+g(t).$ 
Since $u_h-\varphi\to u-\varphi$
uniformly on $D$, we know by Lemma \ref{conservationdumaximumstrict} that a sequence $(\fxx_h,
t_h)$ of maxima of $u_h-\varphi$ on $D$ converges to $(\fxx, t)$.  
Assume that $n_h h \leq t_h < (n_h +1)h$.
 Thus we have in particular for $h$ small enough, i.e. $k$ large enough,
\fb& \label{ineqvarphi}
u_h((n_h-1)h, \fxy)-\varphi((n_h-1)h, \fxy)\leq u_h(t_h, \fxx_h)-\varphi(t_h, \fxx_h).
\fe&
Assume first that $t_h \neq n_hh$. Then, by Definition
 \ref{definitionu-h}, we know that $\frac{\partial \varphi}{\partial t}(t_h,\fxx_h) = 0$.
Since $\varphi$ is $C^\infty$ then we can write 
\fb& \label{balbal}
\varphi(t_h,\fxx_h) = \varphi(n_h h,\fxx_h)+ o(h).
\fe&
This relation still holds if $t_h=n_h h$.
In addition, by Definition \ref{definitionu-h} again, we have $u_h(t_h, \fxx_h) = u_h(n_h h,\fxx_h)$.
 Therefore we deduce from the inequality (\ref{ineqvarphi}) and (\ref{balbal}) that
$$
u_h((n_h-1)h, \fxy)-\varphi((n_h-1)h, \fxy)\leq u_h(n_hh, \fxx_h)-\varphi(n_hh, \fxx_h) +o(h).
$$
for every $\fxy$ such that $(\fxy, (n_h-1)h)\in D$
and therefore
$$u_h((n_h-1)h, \fxy)\leq  u_h(n_hh, \fxx_h)-\varphi(n_hh, \fxx_h)+\varphi((n_h-1)h, \fxy) + o(h)$$
for $h$ small enough (i.e. $k$ large enough) and every $\fxy \in D(\fxx, \frac r 2)$.  Applying
on both sides
$T_h$ and using the  local comparison principle and the commutation of $T_h$ with the addition
of constants,
$$T_h(u_h((n_h-1)h,.))(\fxx_h)\leq 
u_h(n_hh, \fxx_h)-\varphi(n_hh, \fxx_h)+(T_h\varphi((n_h-1)h), .)(\fxx_h) + o(h).$$
Since $\varphi(t,\fxy)=f(\fxy)+g(t)$
and  $T_h(u((n_h-1)h),.)(\fxx)=u_h(n_hh, \fxx)$, we get 
$$
0\leq -f(\fxx_h)-g(n_hh)+T_hf(\fxx_h)+g((n_h-1)h) + o(h),
$$
where we have used again the commutation of $T_h$ with the addition of constants.


Let us first assume that $Df(\fxx) \neq 0$.  
By the uniform consistency assumption (\ref{consistencywithequationgenerale}), since for $h$ small enough $Df(\fxx_h)\neq
0$,
$$
(T_hf)(\fxx_h)=f(\fxx_h)+hF(D^2f(\fxx_h), Df(\fxx_h), \fxx_h)+o(h).
$$
Thus
$$
g(n_hh)-g((n_h-1)h)\leq hF(D^2f(\fxx_h), Df(\fxx_h), \fxx_h) + o(h).
$$
Dividing by $h$, letting $h\to 0$ so that $(\fxx_h, n_hh)\to (\fxx,t)$ and using the
continuity of $F$, we get 
$$\frac{\partial g}{\partial t}(t)\leq F(D^2f(\fxx), Df(\fxx), \fxx),$$
that is to say
$$\frac{\partial \varphi}{\partial t}(t)\leq F(D^2\varphi(\fxx), D\varphi(\fxx), \fxx).$$

We treat now the case where $Df(\fxx)=0$ and $D^2f(\fxx)=0$. The uniform consistency yields
$$
|\frac{(T_hf)(\fxx_h)-f(\fxx_h)}{h}| \leq G(D^2f(\fxx_h), Df(\fxx_h), \fxx_h)+o(1).
$$
The right term, by continuity of $G$, tends to zero, when $h$ tends to 0. Thus
$$\frac{\partial \varphi}{\partial t}(t)\leq 0$$
Thus $u$ is a subsolution of Equation (\ref{equationgeneralesanst}) and we prove in exactly
the same way that it is a supersolution and therefore a viscosity solution.
\enddemo



\section{Uniqueness of viscosity solutions.}



\begin{th1} Uniqueness. \label{Uniqueness}

We consider an admissible function $F$, $u_0$ and $v_0$ two continuous and bounded functions of $\real^N$. Assume that $u_0$ and $v_0$ are defined on the hypercube $[0,1]^N$, and subsequently extended to $C=[-1, 1]^N$
by  symmetry across the coordinate hyper-planes and then periodized. Assume that so is $\fxx \rightarrow F(A,p,\fxx,t)$.

If $u$ and $v$ are continuous and viscosity solutions of 
\fb& \label{encore} \ut& = F(D^2u , Du, \fxx, t) \fe&
with initial conditions respectively $u_0$ and $v_0$. Then,
\fb& \sup_{\fxx \in \real^N, t \in \real^+}  u(t,\fxx) - v(t,\fxx)  \leq \sup_{\fxx \in \real^N}  u_0(\fxx) - v_0(\fxx)  \fe&

As consequence, if $u_0=v_0$ then $u(t,\fxx) = v(t, \fxx)$ for all $\fxx$ and $t$.
\end{th1}


\begin{th1} ``Theorem on Sums''.  (revisited).  \label{theCIL}
[Crandal-Ishii-Lions Theorem 8.3]


Let $u$ and $v$ be continuous functions of $\real^+\times \real^N$, and $\phi$ be twice differentiable function of $\real^+\times \real^{N}$. Set $w(t,\fxx,\fxy) = u(t,\fxx) - v(t,\fxy) - \phi(t,\fxx - \fxy)$, suppose that $(t_0,\fxx_0,\fxy_0)$ is a local maximum of $w$. Then, there exist 
two sequences of points $(t_n,\fxx_n)$ and $(s_n,\fxy_n)$ converging respectively towards $(t,\fxx_0)$ and $(t,\fxy_0)$, and two sequences of twice differentiable functions of $(\real^+\times \real^N)$: $u_n$ and $v_n$, such that
$$(t_n,\fxx_n) \hbox{ is a local maximum of } u-u_n, \hbox{ and } $$
\fb& (\frac{\partial u_n}{\partial t}, Du_n,D^2 u_n) \rightarrow (a, D\phi ( t_0,\fxx_0,\fxy_0), X) \fe&
$$ (s_n,\fxy_n) \hbox{ is a local maximum of } v_n-v, \hbox{ and } $$
\fb& (\frac{\partial v_n}{\partial t}, Dv_n,D^2 v_n) \rightarrow (b, D\phi ( t_0,\fxx_0,\fxy_0), Y) \fe&
with  $X$ and $Y  \in S(\real^N)$, such that
\fb& \hbox{if } D^2\phi ( t_0,\fxx_0,\fxy_0) \neq 0 : X \leq Y \fe&
\fb& \hbox{if }  D^2\phi ( t_0,\fxx_0,\fxy_0) = 0 : X \leq 0 \hbox{ and } Y \geq 0 \fe&
\fb& \hbox{ and with } \qquad a-b = \frac{\partial \phi}{\partial t}( t_0,\fxx_0,\fxy_0). \fe&

\end{th1}

\begin{lem} \label{maxazero}
Set $\phi(t,\fxx -\fxy)= (4\epsilon)^{-1}|\fxx- \fxy|^4 + \lambda t$, with $\epsilon$ and $\lambda$ two positive numbers. We consider equation (\ref{encore}), where $F$ is assumed to be admissible. Let $u$ and $v$ be continuous and some viscosity solutions of (\ref{encore}) with initial condition $u_0$ and $v_0$. Set $w(t,\fxx,\fxy) = u(t,\fxx) - v(t, \fxy) - \phi(t,\fxx - \fxy)$. If $(t_0,\fxx,\fxy)$ is a local maximum of $w$ then $t_0 = 0$.
\end{lem}

\paragraph{proof}
Let us assume $t_0>0$, we want to obtain a contradiction by using the theorem of the sums, and the fact that $u$ and $v$ are viscosity solutions. We have for some $
\frac{\partial \phi}{\partial t}( t_0,\fxx_0 - \fxy_0)= \lambda >0$, $D\phi ( t_0,\fxx_0 - \fxy_0)  = \epsilon^{-1} |\fxx_0-\fxy_0|^2 (\fxx_0-\fxy_0)=p$.
There exists two sequences of points $(t_n,\fxx_n)$ and $(s_n,\fxy_n)$ converging respectively towards $(t,\fxx_0)$ and $(t,\fxy_0)$, and two sequences of twice differentiable functions of $(\real^+\times \real^N)$: $u_n$ and $v_n$, and $X, Y$, 
$a-b=\lambda$ such that
\fb& (t_n,\fxx_n) \hbox{ is a local maximum of } u-u_n, \hbox{ and } 
 (\frac{\partial u_n}{\partial t}, Du_n,D^2 u_n) \rightarrow (a, p, X) \label{Rsum1} \fe&
\fb& (s_n,\fxy_n) \hbox{ is a local maximum of } v_n-v, \hbox{ and } 
 (\frac{\partial v_n}{\partial t}, Dv_n,D^2 v_n) \rightarrow (b, p, Y) \label{Rsum2} \fe&

Two cases :

\begin{enumerate}
\item if $p \neq 0$, then for $n$ large enough, $Du_n \neq 0$. Then, since $u$ is a viscosity solution of (\ref{encore}), (\ref{Rsum1}) implies
$$ \frac{\partial u_n}{\partial t}(t_n,\fxx_n) \leq F(D^2u_n(t_n,\fxx_n),Du_n(t_n,\fxx_n), \fxx_n, t_n)$$
Letting $n$ tends to $\infty$, and using the continuity of $F$ when its second argument is not zero,
we obtain
\fb& a \leq F(X,p,\fxx_0, t_0) \label{compsum1} \fe&
Similarly with $v_n$, (\ref{Rsum2}) implies
$$ \frac{\partial v_n}{\partial t}(t_n,\fxx_n) \leq F(D^2v_n(t_n,\fxx_n),Dv_n(t_n,\fxx_n), \fxx_n, t_n)$$
And at the limit
\fb& b \geq F(Y,p,\fxx_0, t_0) \label{compsum2} \fe&
(\ref{compsum1}) and (\ref{compsum2}) gives $\lambda=a-b\leq 0$, which is a contradiction.

\item if $p=0$, then $\fxx_0 = \fxy_0$. In that case $D^2 \phi=0$, then $X \leq 0$ and $Y \geq 0$.
We define $\tilde u_n(t, \fxx)  = u_n(t, \fxx) + \zprec X (\fxx_n - \fxx), \fxx_n - \fxx \zsucc$, and
 $\tilde v_n(t, \fxx)  = u_n(t, \fxx) + \zprec Y (\fxx_n - \fxx), \fxx_n - \fxx \zsucc$. We then have
\fb& (t_n,\fxx_n) \hbox{ is a local maximum of } u- \tilde u_n, \hbox{ and } 
 (\frac{\partial \tilde u_n}{\partial t}, D\tilde u_n,D^2 \tilde u_n) \rightarrow (a, 0, 0) \label{Rsum1b} \fe&
\fb& (s_n,\fxy_n) \hbox{ is a local maximum of } \tilde v_n-v, \hbox{ and } 
 (\frac{\partial \tilde v_n}{\partial t}, D\tilde v_n,D^2 \tilde v_n) \rightarrow (b, 0, 0) \label{Rsum2b} \fe&
By (\ref{subsolution3}) we have, since $F$ is admissible, for a continuous function $G$ satisfying \ref{extensionsemicontinueB}:
$$ \frac{\partial \tilde u_n}{\partial t}(t_n,\fxx_n) \leq G(D^2\tilde u_n(t_n,\fxx_n),D\tilde u_n(t_n,\fxx_n), \fxx_n, t_n)$$
and
$$ \frac{\partial \tilde v_n}{\partial t}(t_n,\fxx_n) \geq -G(D^2\tilde v_n(t_n,\fxx_n),D\tilde v_n(t_n,\fxx_n), \fxx_n, t_n)$$
Letting $n$ tends to $\infty$, one obtains
$a \leq 0$ and $b\geq 0$, which is again in contradiction with $a-b = \lambda > 0$.

\end{enumerate}
\endproof

\paragraph{Proof of Theorem \ref{Uniqueness}}
We consider $w(t,\fxx,\fxy) = u(t,\fxx) - v(t, \fxy) - \phi(t,\fxx - \fxy)$, with $\phi$ given in the preceding lemma.
Since $u$ and $v$ are assumed to be bounded, $w$ tends to $-\infty$ when $t$ increases.
The periodicity of $u$, and $v$ with respect to $\fxx$ insures existence of a maximum of $w$ for a point $(\fxx, \fxy, t) \in \real^N\times \real^N \times \real^+$. According to lemma \ref{maxazero}, $t=0$, so we have
$$u(t, \fxx) - v(t, \fxy) - (4\varepsilon^{-1}|\fxx-\fxy|^4 - \lambda t)
\leq \sup_{\fxx,\fxy \in \real^N}\big( (u_0(\fxx) - v_0(\fxy)) -
(4\varepsilon)^{-1}|\fxx-\fxy|^4 \big)$$
Letting $\lambda$ tend to $0$, we finally get
$$ u(t, \fxx) - v(t, \fxx) \leq
\sup_{\fxx \in \real^N} (u_0(\fxx) -v_0(\fxx)) $$
\endproof

\index{uniqueness of viscosity solutions} \index{AMSS!uniqueness of viscosity solutions}
\index{mean curvature motion!uniqueness of viscosity solutions}

\zbibnote


The simple definition of viscosity solution given in this chapter
 was proposed by Crandall and Lions
\cite{Crandall-Lions}, originally for first order equations arising in 
Optimal Control.  It was then proved to apply to second order equations as well, in particular the so called geometric equations like the mean curvature motion. The first complete treatise is Crandall, Ishii, Lions {\it 
User's guide to viscosity solutions}
\cite{Crandall:1992:UGV}. The first order equations are extensively treated in 
Barles \cite{Barles:1994:SVE}. The Evans textbook on Partial Differential Equations Evans \cite{Evans:1998:PDE} gives an elementary 
presentation for the first order equations. Crandall's later 
presentation of the theory for both first and 
second order equations, published in \cite{Montecatini:1997:}, is a masterpiece
of simplicity and brievety.  This volume contains a pretty complete overview
of the techniques, results and applications of viscosity solutions, not including the applications to image processing, though.

The approximation theory of viscosity solutions presented here is based on the seminal Barles and Souganidis paper \cite{Barles:1991:CAS}.

The proof of uniqueness for viscosity solutions of second order 
parabolic or elliptic solutions is the technically difficult part of the theory.
Let us mention Jensen \cite{Jensen:1988:MPV} and \cite{Zhu:1994:EUR,Changhe:1998:UVS}
for recent general uniqueness proofs for the parabolic case.
Some alternative or related existence and uniqueness theories, namely the 
nonlinear semigroup theory and the barrier theory are respectively discussed in  \cite{Giovanni:1998:CRB} and  \cite{Evans:1997:RFN}.
  


\chapter{Curvature equations and iterated contrast invariant operators \label{chapter16}}
\thispagestyle{empty}

\section{Main curvature equations for image processing}
In this chapter, we  study the convergence of contrast invariant operators to equations of the
kind
\fb&
\label{equationgeneralecourbure}
\frac{\partial u}{\partial t} = |Du|\beta(\curv(u)),
\fe&
or, in dimension $N$, of the kind
\fb&
\label{equationgeneralecourbures}
\frac{\partial u}{\partial t} = |Du|\beta(\kappa_1(u), \kappa_2(u), ... \kappa_{N-1}(u)),
\fe&
where $\beta$ is a  continuous real function nondecreasing with respect to its variables and 
$\kappa_1, ..., \kappa_{N-1}$ denote the principal curvatures of the level surface of $u$.  In
other terms, they are the eigenvalues of the restriction of $D^2u$ to the plane orthogonal to
$Du$ (Proposition \ref{definitionprincipalcurvatures}).

 We shall deduce from the convergence results for approximate solutions the  existence of
viscosity solutions to these equations, wherever approximate solutions $u_h$ have been
constructed.  There are other methods for proving existence of viscosity solutions (the  so
called ``vanishing viscosity" method, and the Perron method).  Now, we shall obtain, besides
existence, a proof that the main iterated contrast invariant operators considered in the preceding
chapters converge to equations of the kind  (\ref{equationgeneralecourbures}). Let us list the
main examples we have in mind~: this will orient us as for the assumptions we shall make on
$\beta$.  In dimension 2, we have put in  evidence as relevant for image processing the equations
\fb&
\frac{\partial u}{\partial t} = |Du|\curv(u)
\label{MCM2D}
\fe&
and 
\fb&
\frac{\partial u}{\partial t} = |Du|\curv(u)^{\frac 1 3}
\label{AMSS},
\fe&
as well as variants like
\fb&
\frac{\partial u}{\partial t} = |Du|(\curv(u)^+)^{\frac 1 3}
\label{AMSS+}
\fe&
which correspond to affine erosions.
In dimension 3, we shall be concerned with
\fb&
\frac{\partial u}{\partial  t} = |Du|\curv(u)=|Du|(\kappa_1(u)+\kappa_2(u)),
\label{MCM3D}
\fe&
which is the classical ``mean curvature motion", important because it arises as a limit of
iterated median filters (Theorem \ref{B1-bis}). 
 What we'll state also applies to   variants, like
\fb&
\frac{\partial u}{\partial  t} = |Du|\curv(u)=|Du|\min(\kappa_1(u), \kappa_2(u)),
\label{MinCM3D}
\fe&
an equation which performs a less destructive smoothing of the 3D images than the 
mean curvature motion.  Finally, let us mention the Gaussian curvature motion, as a
particularly important equation in 3D~: it  performs an affine invariant smoothing (see
Theorem \ref{AMSS 3-D}), and can also be used in movie smoothing because of its galilean
invariance  (Chapter \ref{chapitremovie})~:

\fb&
\frac{\partial u}{\partial  t} =|Du|\sgn(\kappa_1(u))((\kappa_1(u)\kappa_2(u))^+)^{\frac 1 4}.
\label{AMSS3D}
\fe&
In the next section, we shall fix a common formal framework for these equations. 

\PMEDIAN
\PMEDAMSS
\section{Contrast invariance and viscosity solutions}

In this section, we check that the contrast invariance requirement
for the solutions of the  equations considered in the preceding chapters is compatible with the
concept of viscosity solution.


\begin{lem}\label{proprietesdesF}
Equations (\ref{MCM2D}-\ref{AMSS3D})
%(\ref{AMSS}-\ref{AMSS+}-\ref{AMSS3D}
%-\ref{MCM2D}-\ref{MCM3D}-\ref{MinCM3D})
 can be written as
$\frac{\partial u}{\partial t}=F(D^2u,Du)$ where $F(A,p)$ is an admissible function (see definition \ref{extensionsemicontinue}) of $A$ and 
$p$ and satisfies 
\fb&
 \label{invariancedeF} \hbox{where } Du \neq 0 \qquad F(D^2(g(u)), D(g(u))) = g'(u)F(D^2u, Du)
\fe&
for any $C^2$ nondecreasing function $g$ and any $C^2$ function $u$, and where
\fb& \label{invariancedeFdegrade} \hbox{where } Du=0 \hbox{ and } D^2 u=0, \qquad F(D^2(g(u)), D(g(u))) = F(0,0) = 0 \fe&
\end{lem}

\paragraph{Proof}
If $Du\neq 0$, we know that $\curv(g(u))=\curv(u)$ and $\kappa_i(g(u))=\kappa_i(u)$
(Proposition \ref{invariancedescourburesprincipales}).
Thus 
$$F(D^2(g(u)), D(g(u))=|D(g(u)|\beta(\kappa_1(g(u)), ... \kappa_{N-1}(g(u))) = 
$$
$$
\quad\quad g'(u)|Du|\beta(\kappa_1(u), ... \kappa_{N-1}(u)) = g'(u)F(D^2u, Du),$$
as announced. Let us now consider the case of the mean curvature equations when $Du=0$.  We
only treat the case of the mean curvature motions (\ref{MCM2D}) and (\ref{MCM3D}), the case of
(\ref{MinCM3D}) being similar.
In that case, $F(A, p)= \trace (A) -A(\frac{p}{|p|}, \frac{p}{|p|})p$ and therefore $F(0,0) = 0$.

In addition, if we take $A=D^2(g(u))=g'(u)D^2u + g''(u)Du\otimes Du$ and $D^2u = Du=0$, we have
$D(g(u))=0$ and $D^2(g(u)) = g'(u)D^2u=0$, so that we immediately
obtain $F(D^2(g(u)), D(g(u)))=0$, when $Du=0$ and $D^2 u=0$.
\enddemo



\begin{pro} \index{viscosity solution and contrast invariance}
\label{viscositeestmorphologique} \index{solution!viscosity!contrast invariance}
  If $u$ is a viscosity solution of one of the equations (\ref{MCM2D}-\ref{AMSS3D})
%(\ref{AMSS}-\ref{AMSS+}-\ref{AMSS3D}
%-\ref{MCM2D}-\ref{MCM3D}-\ref{MinCM3D}) 
 and $g$ a
continuous nondecreasing function, then $g(u)$ also is a viscosity solution of 
the same equation.
\end{pro}

\paragraph{Proof}
Let us first assume that $g$ is $C^\infty$ and strictly increasing and set for commodity
$f=g^{-1}$.  Let
$(t,\fxx)$ be a local strict maximum of $g(u)-\varphi$.  
Without loss of generality, we can assume that $\varphi(t, \fxx)-g(u(t, \fxx))=0$ : it enough
to replace $\varphi$ by $\varphi -g(u(t, \fxx))$.
Then $(t, \fxx)$ also is a local
strict maximum of $u-g^{-1}(\varphi)=u-f(\varphi)$.  Indeed, 
$$g(u(s, \fxy))-\varphi(s, \fxy)< g(u(t, \fxx))-\varphi(t, \fxx)=0$$ 
and therefore 
$$u(s, \fxy)<g^{-1}(\varphi(s, \fxy)),$$
i.e. $u(s, \fxy)-g^{-1}(s, \fxy)<0=u(t, \fxx) - g^{-1}(\varphi(t, \fxx)).$

 Since $f(\varphi)$ is $C^\infty$, and
$u$ a viscosity subsolution, we deduce that if $D(f(\varphi))(t,\fxx)  \neq 0$:
$$\frac{\partial (f(\varphi))}{\partial t} (t,\fxx) 
\leq F(D^2(f(\varphi))(t,\fxx) , D(f(\varphi))(t,\fxx) ),$$
which yields by Lemma \ref{proprietesdesF}
$$
f'(\varphi)\frac{\partial \varphi}{\partial t} (t,\fxx)
\leq f'(\varphi)F(D^2\varphi, D\varphi)(t,\fxx),
$$
and, taking into account that $f'>0$,
$$
\frac{\partial \varphi}{\partial t} (t,\fxx)
\leq F(D^2 \varphi, D \varphi)(t,\fxx).
$$
And if $D(f(\varphi)) = 0$, and $D^2(f(\varphi))=0$
$$\frac{\partial (f(\varphi))}{\partial t} \leq 0 \hbox{ and so } \frac{\partial \varphi}{\partial t} (t,\fxx) \leq 0$$

Thus, $g(u)$ is a viscosity subsolution and, in the same way, a viscosity supersolution.
Let us now consider the case where $g$ is not $C^\infty$ and increasing.  In this
case, we replace $g(s)$ by $g_\varepsilon(s) =\psi_\varepsilon(s)\conv (1+\varepsilon s)g(s)$,
where $\psi$ is a compactly supported $C^\infty$ real function such that $\int_{\real} \psi =
1$,
$\psi\geq 0$.  It is easily seen that $g_\varepsilon$ converges uniformly on every compact
subset of $\real$ to
$g$, is
$C^\infty$ and satisfies $g_\varepsilon' \geq \varepsilon$.  If $(t, \fxx)$ is a local
strict maximum of $g(u)-\varphi$, we deduce from  Lemma \ref{conservationdumaximumstrict}
that we can find a sequence $(t_\varepsilon, \fxx_\varepsilon)\to (t, \fxx)$ of local maxima of 
$g_\varepsilon(u)-\varphi$.  Thus when $D\varphi (t, \fxx) \neq 0$, so is $D\varphi (t_\varepsilon, \fxx_\varepsilon)$ for $\epsilon$ small enough, and then
$$
\frac{\partial \varphi}{\partial t} (t_\varepsilon,\fxx_\varepsilon)
\leq F(D^2\varphi(t_\varepsilon,\fxx_\varepsilon) , D\varphi (t_\varepsilon,\fxx_\varepsilon)),
$$
and if $D\varphi(t, \fxx) = 0$, and $D^2\varphi(t,\fxx)=0$, using lemma (\ref{lemmaBarles}) for a continuous function $G^+$ such that $G^+(0,0)=0$, 
$$ \frac{\partial \varphi}{\partial t} (t_\varepsilon,\fxx_\varepsilon) \leq G^+(D^2\varphi(t_\varepsilon,\fxx_\varepsilon) , D\varphi (t_\varepsilon,\fxx_\varepsilon))$$
and in both cases by passing to the limit as $\varepsilon \to 0$ and using the continuity of $F$ in the first case, and of $G^+$ in the second case, 
we conclude that
$g(u)$ is a viscosity  subsolution. The same arguments apply of course for proving that
$g(u)$ is a viscosity supersolution.
\enddemo

\section{Uniform continuity of approximate solutions}
  
\begin{lem}
\label{lipschitzconserve}
  Let $\setB$ be a family of structuring elements in $\real^N$ and $T$ its
associated operator $Tu(\fxx)= \inf_{B\in {\setB}}\sup_{\fxy \in \fxx + B}u(\fxy)$.
If $u$ is a Lipschitz function with Lipschitz constant $L$, then so is $Tu$.
\end {lem}

\paragraph{Proof} Same as Lemma \ref{Lips} and the joint Remark \ref{Lips1}
\enddemo

\begin{lem}
\label{continuiteent}
  Assume that there exist a continuous real function, $k(t)$ satisfying $k(0)=0$
and such that for $nh\leq t$,  $((T_h)^n(L|x|))(0)\leq Lk(t)$ and
$((T_h)^n(-L|x|))(0)\geq -Lk(t)$.  Assume that the operators $T_h$ are monotone,  and commute
with the addition of constants and with translations.  Then for every $L$-Lipschitz function
$u_0$, one has  $-Lk(t) \leq ((T_h)^nu_0)(\fxx) - u_0(\fxx) \leq Lk(t)$. \end{lem}
\paragraph{Proof}
Since the operators $T_h$ commute with translations, we can prove the statements in the case of 
$\fxx = 0$ without loss of generality.  
Since $u_0$ is $L$-Lipschitz, we have 
$$-L|\fxx|\leq u_0(\fxx)-u_0(0)\leq L|\fxx|$$
Applying $(T_h)^n$, using its monotonicity and its commutation with the addition of 
 constants and taking the value at 0,
$$((T_h)^n(-L\fxx))(0)\leq ((T_h)^nu_0)(0)-u_0(0) \leq ((T_h)^n(L\fxx))(0),$$
that is, by assumption if $nh\leq t$,
$$-Lk(t)\leq ((T_h)^nu_0)(0)-u_0(0) \leq Lk(t).$$
\enddemo

\begin{lem} \index{uniform continuity of approximate solutions}
\label{uniformementequicontinue} Let $u_0(\fxx)$ be a lipschitz function on $\real^N$.
  Let $T_h$ be a family of operators satisfying the assumptions of
Lemmas \ref{lipschitzconserve} and \ref{continuiteent} with a function $k(t)$ satisfying
$k(t)\leq t^\alpha$ for some $\alpha >0$ if $t$ is small enough.
 Then the approximate solutions
$u_h(\fxx, t)$ associated with $T_h$ are uniformly equicontinuous when we restrict $t$ to
the set $nh$. More precisely, for all $n, m \in \natural$ and all $\fxx, \fxy$ in
$\real^N$,
\fb& \label{equicont}
|u_h(\fxx, nh) - u_h(\fxy, mh)|\leq L|\fxx -\fxy| +  k(|n-m|h).
\fe&
As a consequence, we can extract sequences $u_{h_n}$, with $h_n\to 0$,  which converge
uniformly on every compact subset of $\real^N\times\real^+$.
 \end{lem}

\paragraph{Proof}
Since by definition $u_h (\fxx) = ((T_h)^nu_0)(\fxx)$, the result is a direct consequence
of Lemmas \ref{lipschitzconserve} and \ref{continuiteent}~: By the first mentioned lemma,
$|u_h(\fxx, nh) -u_h(\fxy, nh)|\leq L|\fxx -\fxy| $ and by the second one applied 
with $(T_h)^{n-m}$, 
$$
|u_h(\fxx, nh)-u_h(\fxx, mh)|=|((T_h)^{n-m}u_h( ., mh))(\fxx) -u_h(\fxx, mh)|
\leq k(|n-m|h).
$$
In order to end with the argument,
we simply notice that
$$|u_h(\fxx, nh)-u_h(\fxy, mh)|
\leq |u_h(\fxx, nh)-u_h(\fxy, nh)| + |u_h(\fxy, nh)-u_h(\fxy, mh)|.$$ 
Consider the linear interpolation of $u_h$, 
$$\tilde u_h(\fxx, t) = \frac{t-nh}h u_h(\fxx, (n+1)h)+\frac{(n+1)h-t}hu_h(\fxx, nh).$$
It is easily checked that
$$\tilde u_h(\fxy, t)-\tilde u_h(\fxy, s)|\leq  \frac{k(h)}h |t-s|\leq |t-s|^\alpha \hbox{ for }
|t-s|\leq h$$ and 
$$|\tilde u(\fxy, t)-\tilde u(\fxy, s)|\leq k(2|t-s|) \hbox{ for } |t-s|\geq h.$$
Thus, by the same argument as above, we conclude that
 the family of functions $\tilde u_h$ is uniformly equicontinuous on all of $\real^N\times
[0, +\infty]$.  In addition, $\tilde u_h(\fxx, 0) = u_0(\fxx)$ is fixed.  We can therefore
apply Ascoli-Arzela Theorem (\cite{}) which asserts that under such conditions, the family of
functions
$\tilde u_h(\fxx,t)$ has  subsequences converging uniformly on every compact of 
$\real^N\times[0,+\infty]$ towards a uniformly continuous function $u(\fxx, t)$.
Same conclusion holds for $u_h(\fxx,t)$.
\enddemo

\section{Convergence of iterated median filters to mean curvature motion}
We prove here one of the main practical and theoretical results of this
book~: the iterated median filters converge to the mean curvature motion equation.

\begin{lem} \index{approximation theory for the mean curvature motion}  \index{mean curvature motion!existence of viscosity solutions}
\label{controledumedianitere} (median filter) Let $k$ be a radial, nonnegative, compactly
supported bounded function and $k_h(\fxy) = \frac 1 {h^N}h(\frac \fxx h)$ the associated
scaled function.  Assume, without loss of generality, that the support of $k_h$ is $B(0,h)$
and consider the weighted median filter associated with $k_h$, $T_hu(\fxx)=\med_{k_h}u(\fxx)$.
Set $v_0(\fxx)=v_0(|\fxx|)=v_0(r)=Lr$.
Then, if $nh^2\leq t$, 
$$(T_h^nv)(0)\leq L\sqrt{2t}.$$
\end{lem}

\paragraph{Proof}
Let  us first estimate $T_hv(r)$ when $v(\fxx)=v(|\fxx|)=v(r) $ is any radial nondecreasing 
function.  To this aim, let $\fxx$ be such that $|\fxx|=r$.  By the triangular inequality, the
sphere with center 0 and radius $\sqrt{r^2+h^2}$ divides the ball $B=B(\fxx, h)$ into two parts
such that
\fb& \label{median1}
\hbox{meas}_{k_h}(\{\fxy, |\fxy|\geq \sqrt{r^2+h^2}\}\cap B-\fxx)\leq \hbox{meas}_{k_h}(\{\fxy,
|\fxy|\leq
\sqrt{r^2+h^2}\}\cap B-\fxx).
\fe&


\MEDIANITERE

\noindent As a consequence, $v$ being nondecreasing, we have 
\fb&
 \hbox{med}_{k_h} v \leq v(\sqrt{r^2+h^2}).
\label{median2}
\fe&
Let us set for brievety $f_h(r)=\sqrt{r^2+h^2}$ and 
$r_{n+1}(r)=f_h(r_n)$, $r_0=r$.
Then we obviously have from (\ref{median2}) and the monotonicity of $T_h$
\fb& 
\label {median3}
(T_h^nv)(r) \leq v(r_n(r)).
\fe&
In addition, since $\sqrt{r^2+h^2} \leq r+\frac 1{2r}h^2$ and $r_n$ is an increasing sequence,
we obtain $r_{n+1}\leq r_n + \frac {h^2}{2r_n} \leq r_n+\frac {h^2}{2r_0}$ and therefore
\fb&
 r_n\leq r+\frac{nh^2}{2r}.\label{median4}
\fe&
Let us assume that $nh^2\leq t$.  Taking into account that $v$ is a nondecreasing function,
(\ref{median3}-\ref{median4}) yield
\fb&
\label{median5}
(T_h^nv)(r)\leq v(r+\frac t{2r}).
\fe&
Since $(T_h^nv)(r)$ is a nondecreasing function of $r$, we deduce that
$(T_h^nv)(r)\leq v(\sqrt{2t})$ if $r\leq \sqrt{\frac t 2}$.
Thus, if $v(r)=Lr$, we have for $nh^2\leq t$
$$(T_h^nv)(0) \leq L \sqrt {2t}$$
as announced.


\enddemo




\begin{th1}  {\rm Convergence of iterated weighted median filter}. Let $k_h$ be as in Lemma
\ref{controledumedianitere} and 
set again 
$(T_hu)(\fxx) =
\med_{k_h}u$.  Let $u_0$ be a Lipschitz function defined on $\real^N$. Then the
approximate solutions $u_h$ converge to a viscosity solution $u$ of the associated equation
$\frac {\partial u}{\partial t} = F(D^2u,Du, \fxx)=c_k|Du|\curv(u)$.
\end{th1}
\paragraph{Proof}
  We know (Theorems \ref{B1}-\ref{B1-bis}) that the weighted median is consistent in any
dimension with the equation 
$\frac {\partial u}{\partial t} = F(D^2u,Du)=c_k|Du|\curv(u)$.   Bounds for the result
of the iterated filter $(T_h)^n$ applied to $+L|\fxx|$ and $-L|\fxx|$ have been computed in 
Lemma \ref {controledumedianitere}, so
that the assumption of Lemma \ref{continuiteent} is true. In addition, we know that $med_h$
is monotone, satisfies a local comparison principle (Relation
\ref{localmaximumprinciple}), commutes with translations and the addition of constants.
Thus, we  can apply Lemma \ref {uniformementequicontinue} which asserts that if $u_0$ is a
Lipschitz function, then  a subsequence of $u_h$ converges uniformly on compact sets 
of $\real^N*\real^+$ to a function $u$.  In addition, by Proposition
\ref{limitedeuhestsolution},  $u$ is a viscosity solution of the equation $\frac{\partial u}{\partial t} = F(D^2u,Du,
\fxx)=c_k|Du|\curv(u)$. Since by Theorem \ref{theCIL}, this solution is unique, we deduce that all of
$(T_h)^nu_0$ converges to $u$.  We have thus proved both existence of a viscosity solution and convergence of  the iterated median filter. 
\enddemo


\section{Convergence of iterated affine invariant operators to affine invariant curvature
motion \label{Convergenceofiteratedaffineinvariantoperatorstoaffineinvariantcurvaturemotion}
}

\index{AMSS!existence of viscosity solutions}
The most important case in dimension 2 for which we analyze convergence of iterated
contrast invariant filters is the equation $\frac{\partial u}{\partial t} = |Du|(\curv(u))^\frac 1 3$, which is associated with  affine invariant inf-sup operators 
$T_hu(\fxx) = \inf_{ B\in {\cal B}}\sup_{\fxy \in \fxx + h^\frac 2 3 B}u(\fxy),$
where $\cal B$ is a family of structuring elements invariant by every linear transform of 
$\real^2$ with determinant 1.  We also set
$$ SI_h u (\fxx) = \supif& u(\fxy)$$
$$ IS_h u (\fxx) = \infsg& u(\fxy)$$
where, here again, the relation $s= h^\frac{3}{2}$ is imposed.
$SI_h$ is understood as an ``affine erosion" of $u$ and $IS_h$ as an
``affine dilation" and we also consider the alternate scheme~:
$SI_h(IS_h u)$
Denoting by $T_h$ one of the schemes $IS_h$, $SI_h$ or $SI_hIS_h$, we
set
$$ u_h(\fxx, (n+1)h) = T_h u_h(\fxx, nh)$$
$$u_h(\fxx, 0) = u_0(\fxx)$$
\begin{th1} \label{theorem2}
%§label theorem2 \quad
There exists a constant $c_\SetB > 0$ such that if
 $u_0(\fxx)$ is any Lipschitz function on $\real^2$, then
$u_h(\fxx, nh)$ tends uniformly on every compact set to $u(\fxx,t)$,
where $u(\fxx, t)$ is the unique viscosity solution of
\fb& \label{equationg} 
%§label equationg \quad
\ut& = |Du| g(\curv(u))\fe&

$$  \begin{array}{rclcl} \hbox{ where } 
g(r) & = &c_\SetB  (r^-)^\frac{1}{3} & \hbox{ if } & T_h = SI_h \\
& = &c_\SetB  (r^+)^\frac{1}{3} & \hbox{ if } & T_h = SI_h \\
& = &c_\SetB  (r)^\frac{1}{3} & \hbox{ if } & T_h = SI_h \; IS_h \\
\end{array} \qquad \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; \qquad \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;
$$
\end{th1}


\PAFFAMSS
\PAFFIS


Theorem \ref{theorem2} is somehow a consequence of theorem \ref{theorem1}, which states
a consistency result for the schemes $SI_h$, $IS_h$, $SI_hIS_h$.  In order to achieve the
proof of Theorem \ref{theorem2}, we need to check that the assumptions of Lemma
\ref{continuiteent} are satisfied.


\begin{lem}
\label{iteratedaffinefilterbound}
Let $\setB$ be a family of subsets of $\real^2$ invariant by $SL(\real^2)$.  Assume that the
convex hull of each element $B$ of $\setB$ is contained in a rectangle with area $a^2$. 
Set for any real function $v$ defined in $\real^2$.
$$T_hv(\fxx) = \inf_{B\in\setB}\sup_{\fxy \in h^{\frac 3 2}B+\fxx}v(y).$$
Consider the radial function
$v(\fxx)=v(|\fxx|)=v(r)=Lr$. Then for $nh\leq t$, 
$$(T_h^nv)(0)\leq L(at+2a\sqrt t).$$

\end{lem}

\paragraph{Proof}
We first assume that $v(\fxx)=v(|\fxx|)=v(r)$ is an arbitrary radial nondecreasing function and
estimate $(T_h^nv)(r)$.  Let $\fxx = (r,0)$.  By assumption, we can enclose any of the elements
$B$ of $h^{\frac 3 2}B$ by a rectangle $R_h$ with area $h^{3\over 2}a^2$.  By the Euclidean
invariance of $\setB$, we can choose this rectangle to have its sides parallel  to the axes,
and by the $SL^2(\real^2)$ invariance of $\setB$ we can further choose $B$ in such a way that
its side parallel to the $x$-axis has length $ah$ and the other one $a^2h^{1\over 2}$.  Since
$B\subset R_h$, we have
$$T_hv(\fxx) \leq \sup_{\fxx + B}v(\fxy)\leq \sup_{\fxx + R_h}v(\fxy).$$
Thus
\fb&
\label{iteratedaffine1}
T_hv(\fxx)\leq  v((r+{ah\over
2})^2+a^2h)^{\frac 1 2})
\fe&

\AFFINEITERE
We set for conciseness $f_h(r)=((r+{ah\over 2})^2+a^2h)^{\frac 1 2}$ and
$r_{n+1}(r) = f_h(r_n), $ $r_0=r$.  Notice that $T_hv$ is a radial nondecreasing function, so
that we can replace $v$ by $T_hv$ in (\ref{iteratedaffine1}). By the monotonicity of $T_h$, we
obtain
\fb&
\label{iteratedaffine2}
(T_h^nv)(r)\leq v(r_n(r))
\fe&
In addition, since $(r^2+\varepsilon)^{\frac 1 2}\leq r + \frac 1 {2r}\varepsilon$ for all
$r, \varepsilon > 0$, we have for $h\leq 1$
$$f_h(r)\leq (r^2+ ahr+ a^2h + \frac 1 4 a^2h^2)^{\frac 1 2}\leq (r^2+ 2a^2h + ahr)^{\frac 1
2}\leq r + \frac 1	 {2r}(2a^2h+ahr).$$
Finally,
\fb&
\label{iteratedaffine3}
f_h(r)\leq r+ah+{a^2h\over r}.
\fe& 
Thus $r_{n+1}=f_h(r_n)\leq r_n+ah+ {a^2h\over r_n}\leq r_n+ ah+{a^2h\over r}$, because $r_n$
is an increasing sequence.  Finally, $r_n\leq r + n(ah+ {a^2h\over r})$ and, by 
(\ref{iteratedaffine2}), 
$$(T_h^nv)(r)\leq v(r+ n(ah + {a^2h\over r})).$$
Let us assume that $nh\leq t$.  Then 
$$(T_h^nv)(r)\leq v(r+ (a + {a^2\over r})t).$$
Considering that the minimum value of $r\to r+ (a+{a^2\over r})$ is attained at $\sqrt t$, we
finally obtain
$$(T_h^nv)(r) \leq v(2a\sqrt t + at)$$
if $r\leq a\sqrt t$.  Thus if $v(r) = Lr$, we obtain
$$(T_h^nv)(0)\leq  L(at + 2a \sqrt t)$$
for $nh\leq t$, as announced. 
\enddemo
Proof of Theorem \ref{theorem2}
By Theorems \ref{theorem1} and \ref{theoremalterne}, the operators $T_h$ are consistent with their
corresponding partial differential equations $\frac {\partial u}{\partial t}=F(D^2u,Du)$ and
satisfy  a uniform local maximum principle.  Being  contrast invariant, they commute with the
addition of constants. Thus, by Proposition  \ref{limitedeuhestsolution}, if a sequence of
approximate L-Lipschitz solutions
$u_{h_n}$ converges uniformly on every compact set to a function $u$,  then
$u$ is a viscosity solution of  (\ref{equationgenerale}).
\newline
Now, since by Lemmas \ref{uniformementequicontinue} and \ref{iteratedaffinefilterbound} the
approximate solutions $u_h$ are  equicontinuous on every compact set of $\real^N\times
\real^+$ and therefore
 have subsequences which indeed converge to a function $u$ on every compact subset of 
$\real^N\times \real^+$. Thus, $u$  is a
viscosity solution. In addition, we know that a viscosity solution is unique (Theorem
\ref{Uniqueness}).  Thus the limit $u$ does not depend on the particular considered
subsequence.  Thus the whole sequence
$u_h$ converges to
$u$.  So we have fully proven both the existence of a viscosity solution and the convergence of
the iterated
$T_hu_0$ to it, under the assumption that the initial function $u_0$ is Lipschitz.
\enddemo 


\section{Solutions of curvature equations for nonsmooth initial images}

Preceeding sections give existency and uniqueness of solution (in sense of viscosity) to the
curvature equations when the initial image is continuous. Curvature equations yield contrast invariant
operator defined on continuous function. Then, using the theorem \ref{extensionapleinementmorpho} yields
to two unique contrast invariant extensions to semi-continuous images: one in case of upper semi continuous initial images, the other 
in case of lower semi-continuous images.

Existence and uniqueness in the case of upper or lower semi-continuous images is then a immediat consequence
of this Theorem.



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

\zbibnote

The  existence and uniqueness theory of viscosity solutions for the Motion by 
Mean Curvature and the relationship of these solutions with other types
of solutions (classical, variational) was developped independently by Evans, Spruck 
\cite{Evans:1991:MLS,C:1992:MLSa, C:1992:MLSb, C:1995:MLS} and Chen, Giga, Goto.
\cite{Chen:1989:UEV, Chen:1991:UEV}.
We do not follow their existence proofs, but rather the elegant numerical
 approximation (the iterated gaussian median filter !) 
invented by Bence, Merriman and Osher \cite{Merriman:1992:DGM}
 and the subsequent convergence proof to the viscosity solution by 
Barles and Georgelin \cite{Barles:1995:SPC}. Other proofs of the gaussian iterated median filter
towards the Mean Curvature Equation are given by \cite{Evans:1993:CAM}, using semigroup
theory  and Ishii \cite{Ishii:1994:GBM}.
Let it be recalled how relevant the iterated median filter is for denoising applications
\cite{Arce:1988:SAR, Ip:1983:INC}



\input{latex/snakes.tex}

\zbibnote
The variational definition of "snakes", or "active contours" is due 
to the seminal paper of Kass, Witkin and Terzopoulos \cite{??KWT}. Many papers have
proposed improvements and attempts to overcome the very numerous 
numerical difficulties of this first  method. See (e.g.) \cite{??Cohen}.
 Caselles, Catt\'e, Coll  and Dibos pointed 
out these difficulties and their mathematical explanations
\cite{Caselles:1993:GMA, Dibos:1992:ACD}.  They  were the first
to propose a (nonvariational) definition permitting to model an active contour
by mean curvature motion.  \cite{Malladi:1995:SMF} proposed
 some numerical improvements. A review is presented in \cite{Caselles:1995:GMA}.
 The fusion of both numerical models is achieved in 
\cite{Caselles:1997:GAC}. For this last definition, 
the so called "geodesic snake" moves, by curve shortening, towards 
a geodesic of an image dependent surface.  
For a general mathematical study of curve shortening on surfaces, see the 
Angenent papers \cite{Angenent:1990:PEC, Angenent:1991:PEC}. Kimmel
\cite{Kimmel:1997:ISS} proposes an image scale space on surfaces based on the same
principle.  Many extensions of the snakes method to deal with images in motion
\cite{Caselles:1997:SM} or medical images are currently being developped.  



\part{Axiomatic Scale-Space Theory \label{Part5}}

\chapter {Scale spaces and Partial Differential Equations 
\label{Scalespace} \label{chapter18}}
\index{scale-space}
\thispagestyle{empty}

\section{What basic principles must obey a scale space?}

In  this chapter, we introduce an abstract framework, the
``scale space", which at the end boils down, from  the algorithmic viewpoint, to iterated
filtering.  This framework  will make it easier to classify and model the
possible asymptotic behaviors of iterated filtering.  We define a ``scale space"
as an abstract family of image smoothing operators $T_t$, depending on a scale
parameter  $t$. \index{family of image smoothing operators} \index{$T_t$} Given an image $u_0(\fxx)$, $(T_tu_0)(\fxx) = u(t,\fxx)$ is 
the ``image $u_0$ analyzed (in fact~: smoothed) at scale $t$".  Formal, but
natural and classical, assumptions on the smoothing process follow.
\newline\newline {\bf The pyramidal structure.}
 We assume that  the output at scale $t$ can be 
computed from the
output at a scale $t-h$ for very small $h$.  This is natural, since a coarser
view of the original picture is likely to be deduced from a finer one without
any dependence upon the original picture. By that way the finest
picture smoothing  is the identity.  $T_t$ is
obtained  by composition  of
``transition filters", which we denote by $T_{t+h,t}$.  \index{transition filters} \index{$T_{t,s}$}

\PTREE

\index{pyramidal structure}
\begin{Defi} \label{Scale-space!Pyramidal}
	We shall say that a scale space is	{\bf  pyramidal }  if  
\fb& T_{t+h} =
T_{t+h,t} T_t, \quad T_0 = Id. \fe&
\end{Defi}

\vspace{4mm}
 A strong version
of the pyramidal structure assumption is the semigroup property

\index{recursivity}
\begin{Defi} \label{Scale-space!recursive}
We shall say that a scale space is {\bf recursive} if 
\fb& T_0 = Id, \qquad
  T_s\circ T_t(u) = T_{s+t}(u) \hbox{ on } \real^N, \\
\hbox{ for all } s, t \geq 0 \hbox{ and } u \hbox{ in } \cal F.
\fe&
\end{Defi}

If the recursivity is satisfied,  $T_t$ can be deduced from
the $n$-times iteration of $T_{t/n}$.  
Let us continue with an intuitive requirement which is called in image processing
"causality".
  Since the visual pyramid is assumed 
to
yield more and  more global information about the image and its 
features,
it is clear that when the scale  increases, no new feature should be
created by the scale space~: the image  at
scale t'$>$t must be simpler than the image at scale
t. 
Furthermore, the operators (or transition filters) $T_{t+h,t}$ are assumed to
act  ``locally",
that  is, to  look at a small part of the processed image.   In other 
terms,
($T_{t+h,t} u_0)(\fxx)$  must essentially 
depend upon
the values of $u_0(\fxy)$  when $\fxy$ lies in a small
neighborhood of $\fxx$. 
 We condense the locality  and the simplification assumptions
in a  {\em local comparison principle\/}~: if an  image $u$ is
locally brighter than  another $v$, then this order must be 
conserved some time by
the analysis (prevalence of local order on global order).  

\PPyramide

\begin{Defi} \index{scale-space!local comparaison principle} \index{local comparaison principle}
A scale space satisfies the {\bf Local Comparison Principle} ,
if for all $u$ and $v$ such that  $u(\fxy)>v(\fxy)$ for $\fxy$ in a neighborhood of $\fxx$
and  $\fxy\neq \fxx$, then for $h$
small enough we have
 					$$(T_{t+h,t}u)(\fxx) \ge (T_{t+h,t}v)(\fxx)$$
and if for all $u$ and $v$ such that $\forall \fxy \in \real^N$, $u(\fxy)\geq v(\fxy)$,
then
\fb& \label{globalcomparison} 
\forall \fxx, \forall h>0, \qquad (T_{t+h,t}u)(\fxx) \ge (T_{t+h,t}v)(\fxx).
\fe&
\end{Defi}

In order to propose a classification of scale spaces,
we finally need some assumption stating that a very smooth image 
must evolve in
a smooth way with the scale space. As we shall prove, it is enough to make this assumption for
quadratic functions.  From the mathematical viewpoint, the next assumption  
implies the existence of an infinitesimal  
generator
for the semigroup $T_t$  (see \cite{Brezis}, \cite{Yoshida}). \index{infinitesimal
generator}  In this chapter, we shall denote for clarity the scalar product between two
vectors of 
$\real^N$ by $\zprec \fxx, \fxy \zsucc=\fxx.\fxy = \sum_1^N x_iy_i.$\notation


\vspace{4 mm}

\begin{Defi} \index{scale-space!regular} \index{regular}

 Let $u(\fxy) = \frac{1}{2}\zprec A(\fxy-\fxx),\fxy-\fxx \zsucc+ \zprec
p,\fxy-\fxx\zsucc +c $ be a quadratic form of $\real^N$. ($A=D^2u(\fxx)$ is a $n*n$ matrix,
$p=Du(\fxx)$ a vector of $\real^N$, $c=u(\fxx)$ a constant.) 

We shall say that a scale space is {\bf regular} if there exists a function 
$F(A,p,\fxx,c,t)$, continuous with respect to $A$, such that 
\fb&
\frac{(T_{t+h,t} u -
u)(\fxx)}{h} \to F(A,p,\fxx,c,t) \quad \hbox{when}\quad h\to 0.
\label{regularite}
%§\quad label regularite
\fe& 
\label{Regunota}  \label{genenota}
\end{Defi}


Since we shall in the following constantly assume that the considered scale spaces
are pyramidal, regular, and satisfy the local comparison principle, it is opportune for this
set of basic properties to be given a single name.  
\begin{Defi} \index{scale-space!causal} \index{causal}
We call {\bf causal} any scale space which satisfies the {\bf Local Comparison Principle}
and is pyramidal and regular.
\label{defcausalite}
%§\quad label defcausalite
\end{Defi}


\begin{Exercice}
\label{extremakilleretscalespace}
Consider the extrema killer operator defined in Section \ref{extremakillersection}, $T_t$ where $t$ denotes the area threshold. Show that the family $(T_t)_{t \in \real^+}$ is pyramidal, satisfies the global comparison principle, but not the local comparison principle. Show that the family is, however, regular at $t=0$ and more precisely,
$$F(A,p,0)=0, \hbox{ if } p \neq 0.$$
\end{Exercice}


As we shall prove in the next section, the causality assumption is enough to imply that the scale space is
governed by a partial differential equation.  

\section{\label{Whypde}Why Scale Spaces are governed by PDE's}


\begin{th1} \index{functions $F$} \index{fundamental theorem}
\label{A-P}
%§\quad label A-P

If a scale space $T_t$ is causal, (that is, pyramidal, regular and satisfying the local
comparison principle), then there exists a function $F$ such that 
 \fb& \label{eqgenerale}
((T_{t+h,t} u -u)/h)(\fxx) \rightarrow F(D^2u(\fxx) ,Du(\fxx),u(\fxx),\fxx ,t)
\fe& as $h$ tends to $0^+$ for all $u$ and $\fxx$ where $u$ is $C^2$.
In addition, $F$ is a continuous and non-decreasing function with
respect to its first argument, that is
\fb&  \hbox{ If }\;  A \geq \tilde A,\; \hbox{ for the ordering of
symmetric matrices }, \fe&
$$ \hbox{then, } \;\;\;F(A,p,c,\fxx, t) \geq 
F(\tilde A,p,c,\fxx,t) ).$$
\end{th1}


Once this theorem  is proved, the
classification of all iterated nonlinear low pass filtering (or, in other words, of all
scale spaces) will be reduced to the classification of all interesting functions
$F$. In dimension 2, these real functions have nine arguments.  This number,
however, will be drastically reduced when we impose obvious and rather necessary
and useful invariance properties to the associated scale space. After the
proof, we shall list these properties and  give the resulting classification
of ``interesting" functions $F$.

\paragraph{Proof of Theorem \ref{A-P}}


Let $w(\fxx ) = \frac{1}{2} \zprec A\fxx ,\fxx
\zsucc+\zprec  p,\fxx \zsucc +c $ be a quadratic form of $\real^N$.
We have assumed, by regularity, that
$
 (T_{t+h,t} w - w)(\fxx
)/h \hbox{ converges towards } F(A,p,\fxx ,c,t)
$
when $h$ tends
to zero, for a function $F$, continuous with respect to
its first argument.
Let $u$ be a function of $\real^N$ into $\real$ such that $u$ is
$C^2$ at point $\fxx$. We shall prove that (\ref{eqgenerale}) is
 true for $u$ at point $\fxx$ for the same
function $F$ introduced in the regularity assumption.
Since $u$ is $C^2$ at $\fxx$, we write 
$$
 u(\fyx) = u(
\fxx)  + \zprec Du,\fyx -\fxx \zsucc  + \frac 12\zprec (D^2u) (\fyx  -\fxx ),\fyx -\fxx
\zsucc  + o(|\fxx -\fyx| ^2), 
$$
where $Du$ and $D^2u$ mean $Du(\fxx)$ and $D^2u(\fxx)$ respectively.
We define, for $\varepsilon>0$, the quadratic forms
$$
Q^+(\fyx ) = u(\fxx ) + \zprec Du,\fyx -\fxx \zsucc  + \frac 12\zprec (D^2u) (\fyx 
-\fxx ),\fyx -\fxx \zsucc  + \frac 12\epsilon (\fxx -\fyx )^2 
$$
$$
Q^-(\fyx ) = u(\fxx ) + \zprec Du,\fyx -\fxx \zsucc  + \frac 12\zprec (D^2u) (\fyx 
-\fxx ),\fyx -\fxx \zsucc  - \frac 12\epsilon (\fxx -\fyx)^2 
$$

When $\fyx \neq \fxx$ and $ \vert \fyx -\fxx \vert$ is small enough,
$$
 Q^-(\fyx ) < u(\fyx ) < Q^+(\fyx ) 
$$
Then using the local comparison principle
(Definition \ref{localmaximumprinciple}),                                        
$$
 T_{t+h,t}  Q^-(\fxx ) < T_{t+h,t} u(\fxx ) < T_{t+h,t} Q^+(\fxx ).
$$ 
Therefore, using $Q^+(\fxx)=u(\fxx)=Q^-(\fxx)$, 
$$
 (T_{t+h,t}Q^-)(\fxx ) - Q^-(\fxx ) <(T_{t+h,t}u)(\fxx ) - u(\fxx ) < (T_{t+h,t} 
Q^+)(\fxx ) - Q^+(\fxx ).
$$
We divide by $h$, and let $h$ tend to zero. Since $T_t$ is regular, we obtain
$$
 \lim_{h\rightarrow 0} \frac{(T_{t+h,t}Q^-)(\fxx ) - Q^-(\fxx )}{h} \leq 
\liminf_{h\rightarrow 0} \frac{(T_{t+h,t}u)(\fxx ) - u(\fxx )}{h} \leq 
$$
$$ \limsup_{h\rightarrow 0} \frac{(T_{t+h,t}u)(\fxx ) - u(\fxx )}{h} \leq 
\lim_{h\rightarrow 0} \frac{( T_{t+h,t}Q^+)(\fyx ) - Q^+(\fyx )}{h} \; \; \; \; 
$$
Thus
$$
 F(D^2 u - \epsilon Id ,  Du , u, \fxx , t) \leq  
\liminf_{h\rightarrow 0} 
\frac{(T_{t+h,t}u)(\fxx ) - u(\fxx )}{h} \leq 
$$
$$
 \limsup_{h\rightarrow 0} \frac{T_{t+h,t}(u(.))(\fxx ) - u(\fxx )}{h} \leq  F(D^2 u + 
\epsilon Id ,  Du , u, \fxx , t)
$$
When $\epsilon$ tends to zero,  using again the fact that $T_t$ is regular (continuity of
$F$ with respect to its first argument), we obtain 
$$
  \lim_{h\rightarrow 0}
\frac{(T_{t+h,t}u)(\fxx ) - u(\fxx )}{h} = F(D^2 u,   Du, u, \fxx ,
t)
$$
We now prove that $F$ is nondecreasing with respect to its first argument.  Setting now
for any vector $p$ and any matrices $A\geq\tilde A$, 
$$
Q^+(\fyx ) = c + \zprec p,\fyx -\fxx \zsucc  + \frac 12\zprec A (\fyx 
-\fxx ),\fyx -\fxx \zsucc  + \frac 12\epsilon (\fxx -\fyx )^2,
$$
$$
Q^-(\fyx ) = c + \zprec p,\fyx -\fxx \zsucc  + \frac 12\zprec \tilde A (\fyx 
-\fxx ),\fyx -\fxx \zsucc  - \frac 12\epsilon (\fxx -\fyx)^2,
$$
and applying, as above, the local comparison principle to $Q^+$ and $Q^-$ around $\fxx$,
the regularity and letting $\varepsilon\to 0$, we obtain $F(A, p, c, \fxx, t)\geq
F(\tilde A, p, c, \fxx, t)$. \enddemo

In the next section, we shall start drawing consequences from askable invariance
properties for a scale space.  We shall immediately impose, and always assume in the
following, a basic one.  Any  smoothing process should leave untouched the constant
functions and, a little more generally, should not be altered by the addition of a
constant. 

\begin{Defi} \index{scale-space!grey level translation invariance} \index{grey level translation invariance}
We shall say that a scale space $T_{t,t+h}$ is {\bf invariant by  grey level translation} if
 \fb& \label{GLSI} 
T_{t,t+h}(0) = 0,  T_{t,t+h}(u+C) = T_{t,t+h}(u) + C \hbox{ for any }
u \hbox{ and any constant } C.
%§\quad label GLSI
 \fe&
\end{Defi}
This axiom is equivalent, in the case where $T_{t,t+h}$ is a linear
filter, defined by $T_{t,t+h}u  = u \conv \phi$, to $$\int \phi(x)dx =
1.$$  Let us state the consequence on $F$.

\begin {pro}
\label{nedependpasdec}
%§\quad label nedependpasdec\quad
Let $T_t$ be a causal scale space, invariant by grey level translation.  Then its
associated function $F(A,p, \fxx, c, t)$ does not depend on $c$. 
\end{pro}
\paragraph{Proof}

Let $C$ be an arbitrary real number. Consider the quadratic form 
$u(\fxy) = \frac 1 2 \zprec A(\fxy-\fxx), \fxy-\fxx\zsucc + \zprec p, \fxy-\fxx\zsucc + c$.
By the regularity assumption (\ref{regularite}), 
\fb&
\frac{(T_{t+h,t}( u+C) -
(u+C))(\fxx)}{h} \to F(A,p,\fxx,c+C,t) \quad \hbox{when}\quad h\to 0.
\label{regularite3}
%§\quad label regularite3
\fe& 
Using  the grey level translation invariance (\ref {GLSI}) and again (\ref{regularite}), 
\fb&
\frac{(T_{t+h,t}( u+C) -
(u+C))(\fxx)}{h}=\frac{(T_{t+h,t}(u)+C -
u-C)(\fxx)}{h} \to F(A,p,\fxx,c,t) 
\label{regularite4}
%§\quad label regularite4
\fe& 
when $h\to 0.$
Combining (\ref{regularite3}) and (\ref{regularite4}),
we obtain
$$F(A,p,\fxx, c+C, t)=F(A, p, \fxx, c, t).$$
\enddemo
Because of the assumed commutation of $T_t$ with the addition of constants, we shall
remove in the following the $c$-dependence of $F$.

\PTEXTURESPX13

\section{Why multiscale analyses compute viscosity solutions.}

In this section, we prove that the concept of viscosity solution is the right concept for
defining solutions of partial differential equations associated with a scale space.  In one
sentence, if $T_t$ is a causal scale space then $T_tu_0$ is the viscosity solution of the
equation
\fb& \frac {\partial u}{\partial t}= F(D^2u, Du, t) \label{eqgen}\fe& which is canonically associated with the
scale space.  To be precise, we shall prove the following theorem.



\begin{th1}\label{whyviscosity}Let $T_t$ be a scale space which is causal and commutes with grey
level tranlations $u\to u+C$. We also assume that $u(t, \fxx)= (T_tu_0)(\fxx)$ is a bounded
uniformly continuous function on $[0,+\infty]\times \real^N$.
 Assume finally that the function
$F(A,p,\fxx,t)$ associated with $T_t$ by the regularity assumption is continuous with respect to
$t$.
Then $u(t, \fxx)= T_t u_0(\fxx)$ is
a viscosity solution of Equation (\ref{eqgen}).

\end{th1}



We have taken the assumption that $u(t, \fxx) =
(T_tu_0)(\fxx)$ is uniformly continuous, i.e. 
\fb& \label{uniformecontinuite}
|u(t, \fxx) -u(s, \fxy)|\leq f((t-t')^2+(\fxx-\fxy)^2)
\fe&
for some nondecreasing nonnegative continuous real function $f$.


\begin{Exercice} \label{separationdesvariables}
Show if  (\ref{uniformecontinuite}) holds, then there exists another nonnegative nondecreasing
continuous function $h$ such that
\fb& \label{uniformecontinuite2}
|u(t, \fxx) -u(s, \fxy)|\leq h(|t-t'|)+h(|\fxx-\fxy|)
\fe&
Show that if $u$ is bounded, then we can assume that $h$ is itself uniformly continuous and 
bounded.
%Answer : $|u(t, \fxx)-u(t', \fxx')|\leq f(2\max((t-t')^2, (\fxx-\fxx')^2)) \leq
%f(2(t-t')^2) + f(2(\fxx-\fxx')^2$.
% Since $h$ is nondecreasing, continous  and bounded, we can set (e.g.) 
%$\tilde h (r) = \frac 1r\int_r^{2r} h(t)dt$.  It is easily seen that $\tilde h\geq h$ and
% that $\tilde h$ is uniformly continous and bounded.
\end{Exercice}

\begin{lem}\label{localauglobal}
Let $\tilde f(\fxx)$, $\tilde g(t)$ be two $C^\infty$ functions and $u(t, \fxx)$ a uniformly
continuous function  such that, for some $r>0$,  
\fb& \label{comparaisonsepareelocale}
\tilde f(\fxx) + \tilde g(t) \leq u(t, \fxx)
\fe&
on $B((t_0, \fxx_0), r).$
Then there exist two continuous functions $f(\fxx)$ and $g(t)$ which coincide with $\tilde f$
and $\tilde g$ on $B((t_0, \fxx_0),  r)$ and satisfy a global comparison relation with
$u$, 
 \fb& \label{globale}
f(\fxx) +  g(t) \leq u(t, \fxx).
\fe&
\end{lem}

\paragraph{Proof}
Without loss of generality, we can assume that $B((t_0, \fxx_0), r) =
B(t_0, r) \times B(\fxx_0,r)$.  By the result of Exercise \ref{separationdesvariables}, 
we can assume that (\ref{uniformecontinuite2}) holds.  We then  associate with 
every $t\in \real$ its projection $p(t) $ on the interval $B(t_0,r)$ and its distance to the
interval, $|t-p(t)|$.  In the same way, we associate   with every 
$\fxx \in \real^N$ its projection $p(\fxx)$ on the ball $B(\fxx_0, r)$ and its distance to
the ball, $|\fxx - p(\fxx)|$.  We then simply  set
$$
g(t) = \tilde g(p(t))- h(|t-p(t)|)
$$
and 
$$
 f(\fxx) = \tilde f(p(\fxx))- h(|\fxx-p(\fxx)|).
$$
Then $f(\fxx) + g(t)$ simply coincides with $\tilde f(\fxx) + \tilde g(t)$ on
 $B(t_0, r) \times B(\fxx_0,r)$.
Let us show that (\ref{globale}) holds. By the uniform continuity assumption on $u$,
$$u(t, \fxx) \geq u(p(t), p(\fxx))- h(|t-p(t)|)-h(|\fxx-p(\fxx)|).$$
By (\ref{comparaisonsepareelocale}) and the definition of $f$ and $g$ we then  obtain
$$u(t\fxx) \geq \tilde f(p(\fxx)) + \tilde g(p(t)) -h(|t-p(t)|-h(|\fxx-p(\fxx)|)=
g(t)+f(\fxx),$$
which yields (\ref{globale}).
\endproof


\paragraph{Proof of Theorem \ref{whyviscosity}}
In order to prove that $u(t,\fxx) = T_t(u_0)(\fxx)$ is a viscosity
solution of (\ref{eqgen}), we only to check that $u$
is a viscosity subsolution of (\ref{eqgen}), the supersolution property
being shown in the same way. 
Let
$(t_0, \fxx_0)$ in $[0, \infty]\times\real^N$ be a strict local maximum point of
$u-\phi$ where $\phi$ is in $C^\infty( \real^N\times[0, T])$ for any
$T<\infty$. (We denote by $C^\infty$\notation the set of $C^\infty$ bounded functions). We
need to show that

\fb&
	\frac{\partial \phi}{\partial t}(t_0, \fxx_0) -
F(D^2\phi(t_0,\fxx_0), D\phi(t_0, \fxx_0), \fxx_0, t ) \leq 0.
\fe&

 Without loss of generality, we may assume that $u(t_0, \fxx_0) =
\phi(t_0, \fxx_0)$.
Without loss of generality again, we may assume by Lemma \ref{formefi=f+gsuffit} that $\phi$ is
of the form
$	\phi(t,\fxx)  =  f(\fxx) +   g(t)$ where $  g(t_0) = 0$, $ f(\fxx_0) =
u(t_0, \fxx_0)$ and $  f$ is in $C^\infty(\real^N)$, $  g$ is in
$C^\infty([0, \infty[)$.  
By Lemma \ref{localauglobal} we can assume (w.l.o.g.) that the inequality between $u$ and $\phi$
is global, i.e.  $u\leq \phi$ on $[0, \infty]\times \real^N$. 
 Let $h > 0$. We
set $u(t) = u(t, .)$ for all functions $u$ on $\real^N*[0, \infty[$.  We have $u(t) \leq
\phi(t)$, then $u(t_0-h, \fxx) \leq \phi(t_0-h, \fxx)$ for all $h<t_0$
and $\fxx$. Using the global comparison principle (\ref{globalcomparison}), we obtain
$$
T_{t_0,t_0-h}(u(t_0-h) )(\fxx_0) \leq
T_{t_0,t_0-h}(\phi(t_0-h))(\fxx_0)
$$ 
Now, by the commutation of $T_t$ with the addition of constants and since $	\phi(t,\fxx)  =
f(\fxx) + g(t)$ we have

$$
 T_{t_0,t_0-h}(u(t_0-h) )(\fxx_0) \leq
T_{t_0,t_0-h}(\phi(t_0-h))(\fxx_0) \leq T_{t_0,t_0-h}(f)(\fxx_0)
+ g(t_0-h).
$$ 
We deduce that 

$$
 u(t_0,\fxx_0) -
(T_{t_0,t_0-h}(f)(\fxx_0) + g(t_0-h)) \leq 0
$$ 
Since  $u(t_0,\fxx_0) = \phi(t_0,\fxx_0)$ and then
 
$$
g(t_0) - g(t_0-h) \leq T_{t_0,t_0-h}(f)(\fxx_0) - f(\fxx_0)
$$
Then,
$$ 
(g(t_0) - g(t_0-h))/h \leq
(T_{t_0,t_0-h}(f)(\fxx_0) - f(\fxx_0))/h
$$
and letting
$h$ go to $0$, using (i), we recover
$$
\frac{\partial g}{\partial t}(t_0-h) - F(D^2f(\fxx_0), Df(\fxx_0), \fxx_0,
t_0-h) \leq 0
$$  
Using the facts that $\phi$ and $g$ are in $C^\infty$ in a neighborhood of $(t_0, \fxx_0)$
and that $F$ is continuous with respect to $t$, letting $h$ tends to
zero, we finally deduce 
$$
\frac{\partial g}{\partial t}(t_0) -
F(D^2f(\fxx_0), Df(\fxx_0), \fxx_0, t) \leq 0
$$
and (iii) is shown since $\partial \phi/\partial t (t_0, \fxx_0) =
g'(t_0)$ and $D^\alpha \phi(t_0, \fxx_0) = D^\alpha f(\fxx_0)$ for
$|\alpha| = 1$, $2$.
We conclude that $T_t u$ is the unique viscosity solution of
(\ref{eqgen}). \endproof


\section{\label {Invariance}Scale space and invariance properties}
In this section, we shall do a first classification of the admissible functions $F$,
depending on the invariance assumptions made on the associated scale space.
\subsection {Geometric  invariance axioms} \index{geometric invariance axioms}


We shall first list a series of axioms which traduce the invariance of
scale space with respect to  the respective positions of the {\it percipiens}  and
{\it perceptum} in the image generation process.  This leads us to define more and more precisely
which functions $F$ are admissible for a general purpose, and therefore invariant, scale
space. We define the translation operator $\tau_{\fxz}$ by~:
\fb& (\tau_{\fxz} .u)(\xbol) = u(\xbol-\fxz ) \fe&
where $\fxz$ is in $\real^N$.

\vff





\begin{Defi} \index{scale-space!translation invariance} \index{translation invariance}
We shall say that the scale space is {\bf translation invariant} if 
\fb& \label{nota3}  
T_{t+h,t} (\tau_{\fxy} .u) = \tau_{\fxy} .(T_{t+h,t}u) \hbox{ for all } \fxy \hbox{ in }
\real^N,\; t \geq 0, \; h\geq 0.
%§\quad label nota3
\fe&
\end{Defi}



\begin {pro}
\label{nedependpasdex}
%§\quad label nedependpasdex\quad
Let $T_t$ be a causal and translation invariant scale space.  Then its associated function
$F(A,p, \fxx, c, t)$ does not depend on $\fxx$. 
\end{pro}
\paragraph{Proof}
Consider the quadratic forms 
$u(\fxy)=\frac 1 2 \zprec A\fxy), \fxy\zsucc + \zprec p,\fxy\zsucc + c$
and $\tau_{\fxx}u(\fxy) = \frac 1 2 \zprec A(\fxy-\fxx),\fxy-\fxx\zsucc + \zprec p,
\fxy-\fxx\zsucc + c$. By the regularity assumption (\ref{regularite}), 
\fb&
\frac{(T_{t+h,t} u -
u)(0)}{h} \to F(A,p,0,c,t) \quad \hbox{when}\quad h\to 0.
\label{regularite1}
%§\quad label regularite1
\fe& 
and 
\fb&
\frac{(T_{t+h,t}(\tau_{\fxx} u) -
\tau_{\fxx}u)(\fxx)}{h} \to F(A,p,\fxx,c,t) \quad \hbox{when}\quad h\to 0.
\label{regularite2}
%§\quad label regularite2
\fe& 
On the other hand, by the translation invariance (\ref{nota3}), 
\fb&
\frac{(T_{t+h,t}(\tau_{\fxx} u) -
\tau_{\fxx}u)(\fxx)}{h}  = \tau_{\fxx}(\frac{(T_{t+h,t} u - u)(\fxx)}{h} )
= \frac{(T_{t+h,t}u - u)(0)}{h} 
\label{regulariteetinvariancepartranslation}
%§\quad label  regularite2
\fe& 
Combining (\ref{regularite1}, \ref{regularite2}, \ref{regulariteetinvariancepartranslation}) 
we obtain
$$F(A,p,\fxx, c, t)=F(A, p, 0, c, t).$$
\enddemo


\noindent If $R$ is an isometry of $\real^N$, we denote by $Ru$ the  function $Ru(\fxx) =
u(R\fxx)$. \notation


\begin{Defi} \index{scale-space!euclidean invariance} \index{euclidean invariance} \index{euclidean invariance|see{Isotropic}}
We shall say that a scale space $T_{s,t}$  is {\bf Euclidean invariant}  if for
every isometry $R$ of $\real^N$, 
 \fb& RT_{t+h,t} = T_{t+h,t} R 
\label{euclideaninvariance}
%§\quad label euclideaninvariance
\fe&
\end{Defi}

\PILLUSROT


\begin{lem} 
\label{lemmeinvarianceparrotation}  If a translation invariant causal  scale space is
Euclidean invariant (isotropic), then its associated function $F$ satisfies for every
linear isometry
$R \in O^N$,
\fb&
F(RA^tR, Rp, t) = F(A, p, t) 
\label{invarianceparrotationpourF}
%§\quad label invarianceparrotationpourF
\fe&
\end{lem}

\paragraph{Proof}  
Let us first recall the chain rules : 
\fb& \label{chainrules}
D^2(u\circ R) = ^tR(D^2u\circ R)R, \quad D(u\circ R) = ^tRDu\circ R.
\fe&
We have $T_{t+h,t}R=RT_{t+h,  t}$.  We apply this relation to a quadratic form $u$ such
that $D^2u(\fxx)=A$, $Du(\fxx)=p$ and
deduce 
$$
T_{t+h,t}(Ru)=R(T_{t+h, t}u), \hbox{  that is,  } T_{t+h,t}(u\circ R)=(T_{t+h,t}u)\circ R
$$  Differentiating this relation with
respect to $h$ at $h=0$, which is licit by  the regularity of the scale space,  we get
$$
\frac {\partial}{\partial h}_{|h=O} (T_{t+h,t}(u\circ R)(x))=
\frac {\partial}{\partial h}_{|h=O} (((T_{t+h, t}u)\circ R)(x)).
$$
Using on both sides
the regularity formula (\ref{eqgenerale}) and 
taking into account that, by the chain rules (\ref{chainrules}), $D^2(Ru)=^tRAR$ and
$D(Ru)=^tRu$, we obtain
$$F(^tR(D^2u\circ R)R,^tRDu\circ R, t) = F(D^2u, Du, t)\circ R,$$
which yields
$$F(^tRAR,^tRp, t) = F(A,p,t).$$
Relation (\ref{invarianceparrotationpourF}) follows by changing $R$ into $^tR$.
\enddemo

\subsection{Contrast invariance}


%%%%FFFFF
\PCONTRAST_GAUSS
%%\PILLUSMORPH

\begin{Defi} \index{scale-space!contrast invariance} \index{contrast invariance}
We shall say that a scale space is contrast invariant if
\fb& \label{Morp} g\comp T_{t+h,t} =T_{t+h,t}\comp g, 
\label {contrastinvariance}
%§\quad label contrastinvariance
\fe&
for any nondecreasing continuous function $g$ from $\real$ into $\real$.
\end{Defi}
\vspace{4 mm}

\PTJONC

We now seek for a relation traducing  for $F$ the ``contrast invariance". 


\begin{lem} 
\label{lemmeinvariancemorphologique}  If a  causal  scale space  is
contrast invariant, then its associated function $F$ satisfies 
\fb& F(\mu A+\lambda p\otimes p, \mu p, t)=\mu F(A, p, t), 
\label{invariancemorphologiquepourF}
%§\quad label invariancemorphologiquepourF
\fe&
for every real
values $\lambda$, $\mu$, every symmetric matrix $A$ and every two-dimensional
vector $p$. \end{lem} 

\vff
By $p\otimes p$ we mean the tensorial product, or in a more
intuitive way, the matrix product  $p^tp$, where $p$ is thought of as a
column matrix, that is $$p\otimes p= \left[ \begin{array}{ll}
                 p_1^2... & p_1p_N \\
		 p_1p_N... & p_N^2
             \end{array} \right].$$
\index{tensor product}

\paragraph{Proof}  By taking $g(s)=0$, and $g(s)=s+C$, we see that the scale space is
invariant by grey level translations.  Thus, by Proposition \ref{nedependpasdec}, $F(A, p,
\fxx, c, t)$ does not depend on $c$.
  We have by contrast invariance
$T_{t+h,t}\circ g = g\circ T_{t+h,  t}$.  We apply this relation to an arbitrary quadratic form
$u$ such that
$D^2u(\fxx)=A$,
$Du(\fxx)=p$  and to an arbitrary
$C^2$ function
$g$.  We
 deduce that  $$T_{t+h,t}(g\circ u)=g\circ(T_{t+h, t}u).$$  Differentiating this relation with
respect to $h$ at $h=0$ (which is licit by Theorem \ref{A-P}),  we get

\fb&
\frac {\partial}{\partial h}_{|h=O} (T_{t+h,t}(g\circ u)(\fxx))=
\frac {\partial}{\partial h}_{|h=O} (g\circ(T_{t+h, t}u)(\fxx)).
\label{derivationd'invariancemorpho}
%§\quad derivationd'invariancemorpho
\fe&
Using  
Formula (\ref{eqgenerale}) on both sides of (\ref{derivationd'invariancemorpho}), we deduce
that 
$$
 F(D^2(g(u)), D(g(u)), \fxx, t) = g'(u)F(D^2u, Du, \fxx, t).
$$
By the chain rule,

$$
D^2(g(u))= g'(u)D^2u+g''(u)Du\otimes Du, \quad D(g(u))=g'(u)Du.
$$
Thus, considering that $Du=p$, $D^2u=A$, $h(u)$, $h'(u)$, $h''(u)$  can take
arbitrary values, we obtain (\ref{invariancemorphologiquepourF}).
\enddemo



 \subsection{ \label{Normalization}Scale invariance~: How to fix a relation between
scale and space}

\index{normalisation of scale}

{\it This
subsection  is devoted to a study of the effect of the scale invariance axiom,
and more generally of the affine invariance on the scale space, in order to
establish a normalized link between scale and space.
We shall assume, for avoiding spurious cases, that the scale space is
not cyclic, that is,  $T_t =  T_s$ implies $t=s$.  This is no serious restriction for a scale
space !  In fact, we shall need no other assumption on  the family $T_t$, except
for the scale invariance assumptions which follow.  So all statements to come
will be true for any scale invariant one to one family of operators $T_t$, which
depend upon a scale parameter. The consequences of the scale/space normalization
results  are therefore wide and can be stated as a general principle, according
to which, ``the relation between scale and space can be normalized", and more
precisely normalized so that $t'=
\lambda t$ if we denote by $t$ the scale parameter before zooming with  a factor
$\lambda$ and $t'$ the smoothing scale after zooming.   }
\newline 
In order to perform such a scale/space normalization, we need to state the
scale invariance in a more precise way~: we need some technical regularity  assumptions on
the scale\space relation. Define $H_\lambda (\xbol ) = \lambda \xbol $  for any $\xbol  \in
\real^N$.
 \begin{Defi} \index{scale-space!scale invariance} \index{scale invariance}
 \label{scaleinvarianceprecise}
%§label scaleinvarianceprecise\quad
We shall say that a family of operators $T_t$ is {\it scale invariant} if for any positive
$\lambda$ and $t$, there exists $t'>0$ such that $H_\lambda T_{t'}=T_tH_\lambda$ and if, in
addition,
$t'(t,\lambda)$ is differentiable with respect to $\lambda$ at $\lambda = 1$, and the function
$\phi(t)=\partial t'/\partial \lambda(t, 1)$ is continuous and positive for $t>0$.    
\end{Defi}

\index{rescaling function}

\begin{Defi} \label{invarianced'echelledef}
We say that  a family of operators $T_t$ is {\bf scale invariant} if there exists a rescaling
function $t'(t,\lambda)$, defined   for any $\lambda>0$ and $t\geq 0$, 
such that  
\fb& H_\lambda T_{t'}=T_tH_\lambda 
\label {scaleinvariance}
%§\quad label scaleinvariance
\fe&
and, more generally~:
\fb& H_\lambda T_{t', s'}=T_{t,s}H_\lambda. 
\label {scaleinvariance1}
%§\quad label scaleinvariance1
\fe& 
where we note $t'=t'(t,\lambda)$ and $s'=t'(s, \lambda)$.  In addition,
$t'(t,\lambda)$ is assumed to be differentiable with respect to $\lambda$ at $\lambda = 1$,
and the function
$\phi(t)=\partial t'/\partial \lambda(t, 1)$ is continuous and positive for $t>0$.  
\end{Defi}

\paragraph{Remarks.} 
In fact, (\ref{scaleinvariance1}) implies (\ref{scaleinvariance}) and must be considered as
a slightly stronger form which will make easier our classification of scale invariant scale 
spaces in the following chapters.  Now, as we shall see in Section
\ref{Normalization}, (\ref{scaleinvariance}) is enough to ensure a normalization of
the function $t'(t,\lambda)$.  We cannot fix {\it a priori} the form of $t'$ because it can
vary in concrete examples of scale spaces.  We shall prove in Section \ref{Normalization} 
that it can be ``normalized", which means that we always can, by an adequate rescaling of
any scale space, set $t'=\lambda t$. 

 The scale invariance means that the result of the scale space $T_t$
is independent of the size of the analyzed features~: this is very
important in ``natural images", since the same object can be
photographed at very different distances and therefore at very different
scales.  Thus, it is essential for the stability of shape analysis
that the result of an analysis of this object should not yield a
different ``shapes" at different distances.  Thus, the sequence of the
shapes obtained by scale space must be independent of the ({\it a
priori} unknown) size of the object in the picture.  
Of course, we cannot impose $t'=t$ because scale of smoothing and scale of the image
are covariant, as can be appreciated by considering the examples of linear filtering
and the heat equation.
\newline


   
The assumption  $g(t)=\partial
t'/\partial \lambda(t, 1) >0$ can be interpreted by looking at the
relation $H_\lambda T_{t'}=T_tH_\lambda$ when the scale $\lambda$ increases, i.e. when
the size of the image is reduced before analysis by $T_t$. Then, the corresponding
 scale before reduction is increased.  In more informal terms, we can say that
the  scale of analysis  increases with the size of the picture.  This is a natural
assumption, and satisfied by all classical models.  The continuity and
differentiability assumptions on $t'$ are also satisfied by all classical models and
seem natural. 
Notice that no condition has been imposed on the relation between $t'$
and  $(t, \lambda )$.  \newline  
In order to fix ideas, let us examine which function $t'$ is associated with several
classical scale spaces.   In the case of the basic morphological
operators, dilation and erosion, it is easily seen that $t'(t, \lambda) = \lambda t$.  In
the case of the heat equation and of the  mean curvature motion equation, one has
$t'(t, \lambda) =
\lambda^2t$.


 Finally, we state a general invariance axiom which implies the euclidean and the
scale invariances, and also the invariance of the scale space under any orthographic
projection of a planar shape.  Combining those transformations leads
to an arbitrary linear transform $A$ of the plane.  Set, for any such
transform, $Af(\xbol) = f(A\xbol)$.  With the same formalism as for scale invariance, we get~:

\vff

\begin{Defi} \index{scale-space!affine invariance} \index{affine invariance of a scale space}
\label{defaffineinvarianced'unscalespace}
We shall say that a family of operators $T_t$ is {\bf affine invariant} if it is scale
invariant and if the associated function $t'(t, \lambda)$ can be extended into a function
$t'(t, A)$, defined for every $t>0$ and any
linear application $A$ of $\real^N$  with $det(A) \neq 0$, and satisfying 
$$t'(t,\lambda)= t'(t, \lambda Id)$$
and, for every $A$, $s > t>0$, 
\fb& AT_{t', s'}=T_{t,s}A, 
\label {affineinvariance1}
%§\quad label affineinvariance1
\fe&
where we note $t'=t'(t,A)$ and $s'=t'(t,A)$.
 \end{Defi}


This relation means that the result of the scale space 
$T_t$ is
 independent of the distance and orientation in space of the analyzed 
planar image. Indeed,
 any affine map $u\to Au$ can be interpreted as the anamorphosis of a planar image  $u$
when it is
presented to the eye at any distance large enough with respect to 
its size and
with an arbitrary orientation in space.  


The fact that the scale-space function $t'(t,\lambda)$ can be {\it a priori} different for
each scale space looks mysterious.  We shall fix it in the next lemma by proving that we can,
without loss of generality, {\bf impose} all scale spaces to have the same scale-space
function.  It may be anyway convenient to keep a different one from the normalized one we
propose here.  Now, as we shall see in the chapters devoted to the identification of {\bf all}
scale spaces of a certain kind, the next lemma is an essential tool to perform  this
identification, which will then be made ``up to a rescaling".
\index{rescaling}

\begin{lem}
\label{Nsc}
%§label Nsc
{\bf (Normalization of scale\/.)} \index{normalization of scale Lemma}
\newline
\noindent (i) Assume that $t \rightarrow T_t$ is a one to one, scale invariant,
family of operators acting on real functions defined in $\real ^N$ and satisfying $T_0=Id$. 
Then there exists an increasing differentiable rescaling function 
$\sigma: [0, \infty ] \rightarrow  [0, \infty ]$, such that 
$t'(t,\lambda)=\sigma^{-1}(\sigma(t)\lambda)$. If we set
$S_t=T_{\sigma^{-1}(t)}$, we then have $t'(t, \lambda)=t\lambda$ for the
rescaled analysis. 
\newline\newline\noindent
(ii) Assume that the family of operators $T_t$ is affine invariant.  Then the function
$t'(t,B)$ only depends on
$t$ and $\vert detB \vert$:   $t'(t,B)=t'(t,\vert detB\vert^{1/N})$ and is increasing with
respect to $t$. Moreover, there exists an increasing differentiable rescaling function 
$\sigma: [0, \infty ] \rightarrow  [0, \infty ]$, such that 
$t'(t,B)=\sigma^{-1}(\sigma(t)\vert detB\vert^{1/N})$ and if we set
$S_t=T_{\sigma^{-1}(t)}$ we have $t'(t,B)=t\vert detB{\vert}^{1/N}$ for the
rescaled analysis.
\end{lem}
Before proving this lemma, we shall state a very useful  consequence~: the
characterization  of affine invariant scale spaces by a simple relation regarding their
associated function $F$.

\begin{lem} \label{lemme3ancien} If a causal scale space is affine invariant, then, after
the adequate renormalization yielded by Lemma \ref{Nsc},
its associated function $F$ satisfies
\fb&
F(BA^tB, Bp, t) = |det B|^{\frac 1 N}F(A, p, |det B|^{\frac 1 N} t).
\label{11ancien}
\fe&
for any linear map $B$.
If a causal scale space is scale invariant, then, after the adequate scale renormalization
(Lemma \ref {Nsc}), its associated function $F$ satisfies
\fb&
F(\mu^2A, \mu p, t) = \mu F(A, p, \mu t).
\label{invarianced'echellepourF}
\fe&
\end{lem}

\paragraph{Proof}  
We have $T_{t+h,t}B=BT_{\lambda(t+h), \lambda t}$, where $\lambda= |det B|^{\frac 1
N}$.  We apply this relation to a quadratic form $u$ such that $D^2u(\fxx)=A$, $Du(\fxx)=p$~:
 $$T_{t+h,t}(Bu)=B(T_{\lambda(t+h), \lambda t}u), \hbox{ that is, }
T_{t+h,t}(u\circ B)= (T_{\lambda(t+h), \lambda t}u)\circ B.
  $$
Differentiating with respect to $h$ at $h=0$  on both sides yields  
$$
\frac {\partial}{\partial h}_{|h=O} (T_{t+h,t}(u\circ B) )=
\frac {\partial}{\partial h}_{|h=O} (T_{\lambda(t+h), \lambda t}u)\circ B).
$$
Taking into account that $D^2(u\circ B)=^tB(D^2u\circ B)B$ and $D(Bu)=^tB(Du\circ B)$ and
using   Formula (\ref{eqgenerale}), we get 
$$F(^tB(D^2u\circ B)B, ^tB(Du\circ B), t) = \lambda F(D^2u\circ B, Du\circ B, \lambda t),$$
which yields

$$F(^tBAB, ^tBp, t) = |det B|^{\frac 1 N}F(A,p, |det B|^{\frac 1 N} t).$$
The relation (\ref{11ancien}) follows by changing $B$ into $^tB$. The second part of the 
lemma is obtained by replacing in the preceding proof $B$ by $\mu I_N$, where $I_N$ is the 
identity of $\real^N$.  
\enddemo


\paragraph{Proof of Lemma \ref{Nsc}.} We directly prove (ii), and will then say how to
simplify the proof of (ii) in order to get (i).  First we notice that for any linear
transforms
$B$ and $C$ and any $t$ one has the semigroup property 

\fb& \hspace{1cm}t'(t,BC)=t'(t'(t,B),C).\label{semigroup}\fe&
Indeed, we have
$BCT_{t'(t,BC)}=T_tBC=BT_{t'(t,B)}C=BCT_{t'(t'(t,B),C)}$. The map which
associates $T_t$ with t being one to one, we deduce (\ref{semigroup}).
Next, 
we show that  
\fb& t'(t,A)  \hbox{ is increasing with respect to } t.\label{increasingint}\fe&
 Let us prove that $t'(t,A)$ is one to one with respect to $t$  for any $A$.
Indeed, if not, there would be some $A$ and some $(s,t)$ such that
$t'(t,A)=t'(s,A)$. Thus $T_tA=AT_{t'(t,A)}=AT_{t'(s,A)}=T_sA$ and 
 therefore $t=s$ because $T_t$ is one to one. Notice that this implies, in
particular, that 
\fb& \label{echellezero}
t'(0,A)=0
\fe&
Indeed, $AT_{t'(0,A)}=T_0A=A$. Thus $T_{t'(0,A)}=Id = T_0$ and
therefore $t'(0,A)=0$.
 As a consequence, since $t'(t,A)$ is nonnegative (by
definition), one to one, and continuous with respect to $t$, we
can deduce that it is  increasing with respect to $t$.

\vspace{4 mm}

\noindent  Let us now show that $t'(t,A)$ satisfies

\fb& 
t'(t,R)=t \quad \hbox{ for any orthogonal transform} \quad R.\label{isometrie}
\fe&
Iterating the formula of (\ref{semigroup})
we have
 $$t'(t'(t'(t'(...t'(t,R)...,R),R),R)=t'(t,R^n)$$
Remark that there is a subsequence of $(R^n)_{n\in \natural}$ tending to $Id$.
(Indeed, there is a subsequence $R^{n_k}$ which converges
to some $H$, orthogonal, because the orthogonal group is compact. Therefore, the
subsequence $R^{n_{k+1}-n_k}$ converges to $Id$.)
Since there exists a subsequence of $R^n$ tending to $Id$ and since 
$t'$ is continuous we have for this subsequence $\lim t'(t,R^n)=t'(t,Id)=t$.
 Assume by contradiction that $t'(t,R)=t"$ with $t"<t$. Then $t'(t'(t,R),R)=t'(t",R)\le
t'(t,R)=t"$ and by recursion, $t'(t,R^n)=t'(t'(t'(t'(...t'(t,R)...,R),R),R)\le t"<t$.
This yields a contradiction. Thus $t'(t,R)\ge t$. We prove the converse 
inequality in the same way and we obtain $t'(t,R)=t$.
   
\vspace{4 mm}     

We note that any linear transform $B$ of $\real^N$ can be obtained
as a product of orthogonal transforms and of linear transforms of the kind $A(\lambda)$:
$(x_1, x_2 ..., x_N) \rightarrow (\lambda x_1, x_2,..., x_N)$ where $\lambda$ is
nonnegative. We only need to make a singular value decomposition \cite{??} of $B$:
  $B=R_1DR_2$, where $R_1$ and $R_2$ both are orthogonal transforms
and $D$ is a transform of the kind 
$(x_1, x_2 ..., x_N) \rightarrow ({\lambda}_1 x_1,{\lambda}_2 x_2, ..., \lambda_N x_N)$
where $\lambda_i$ are non negative.  Now, it is clear that $D$ itself can be decomposed as
$D=A({\lambda}_1)R_2A({\lambda}_2)R_2^{-1}...R_NA({\lambda}_N)R_N^{-1}$ where $R_i$ is the
orthogonal transform: $(x_1,..., x_i ..., x_N) \rightarrow (x_i, ..., x_1 ..., x_N) $
which exchanges $x_1$ and $x_i$.  Using Relation (\ref{semigroup}), $t'(t,R_i)=t$ (which comes
from (\ref{isometrie})), the singular  value decomposition and  the obvious
relation $A({\lambda}_1)A({\lambda}_2)=A({\lambda}_1{\lambda}_2)$, we obtain that 
$t'$ only depends on $t$ and $|\hbox{det}(B)|= \lambda_1...\lambda_N$. So we can write
 $$t'(t,B)=t'(t,\vert detB{\vert}^{1/N}).$$   


\noindent Using (\ref{semigroup}) and (\ref{increasingint}), we have
 \fb&
 \hspace{1cm}t'(t,\lambda \mu)=t'(t'(t,\mu), \lambda) \label{compositionechelles}
\fe&
 for any positive $\lambda$ and $\mu$. Differentiating this relation with respect
to $\mu$ at $\mu = 1$ yields
\begin{equation}
  \label{ZERO}
  \lambda \frac{\partial t'}{\partial\lambda}(t,\lambda)=
\frac{\partial t'}{\partial t}(t,\lambda)\frac{\partial
t'}{\partial \lambda}(t,1)
\end{equation}   
We consider the function $\phi(t)=\frac{\partial t'}{\partial \lambda}(t,1)$, which is positive
by assumption.  We then choose $\sigma$ such that 
\fb& \label{star5}
\phi \sigma'=\sigma
\fe& 
in such a way that
$$\sigma(t)=exp(\int_1^t ds/\phi (s)).$$
Let us finally 
set $$G(x,y) = t'(x, \frac{y}{\sigma(x)})$$, so that
$$t'(t,\lambda)=G(t,\sigma(t)\lambda).$$
By (\ref{ZERO}) and (\ref{star5}) and the differentiability assumption on $t'$ (Definition
\ref{invarianced'echelledef}), 
$$\frac{\partial G}{\partial x}(x,y)=
\frac{\partial t'}{\partial t}((x, \frac y{\sigma(x)})-\frac{\partial t'}{\partial \lambda}(x,
\frac y{\sigma(x)})\frac{y\sigma'(x)}{\sigma(x)^2}= 0.$$
 Thus $G(x,y)=\beta (y)$ for some
differentiable nondecreasing function $\beta$. We obtain  
\fb& \label{star7}
t'(t,\lambda)=\beta
(\sigma(t)\lambda ).
\fe&
 Returning to the  definition of $\phi (t)$ and using (\ref{star5}), we have
$\phi (t)=\frac{\partial t'}{\partial \lambda}(t,1)= \sigma(t)\beta '(\sigma(t))=\phi
(t)\sigma'(t)\beta '(\sigma(t))$. Dividing both sides by $\phi(t)$, we obtain 
$$
\frac{\partial(\beta (\sigma(t)))}{\partial t} =1.
$$
Integrating this last relation between $0$ and $t$ yields $\beta
(\sigma(t))=t+\beta (\sigma(0))$. 
Now, by (\ref{echellezero}), $t'(0,\lambda )=0$.  This implies by (\ref{star7}) that $\beta
(\sigma(0))=0$ and therefore $\beta = \sigma^{-1}$, so that
 $$t'(t,\lambda ) =
\sigma^{-1}(\lambda
\sigma(t)).$$
    In order to complete the proof, we set $S_t=T_{\sigma^{-1}(t)}$ and we prove that the
affine invariance is true for $S_t$ with $t'(t,\lambda)=\lambda t$. We have
$$
S_tB=T_{\sigma^{-1}(t)}B=BT_{t'(\sigma^{-1}(t),\lambda
)}=BT_{\sigma^{-1}(\lambda \sigma(\sigma^{-1}(t)))}=$$ 
$$BT_{\sigma^{-1}(\lambda
t)}=BS_{\lambda t}.$$
\newline\newline\noindent
Proof of (i).  The proof of the first item of the scale normalization lemma is identical
to the proof of the second, which we have just performed.  We only need to replace 
``$ B$" and ``$C$" by $\lambda$, $\mu$ everywhere.
\endproof
%\newpage
%Insert here~: Fig. 10 
 
%A verification of Julesz' theory of textons which yields
%hyperdiscrimination algorithms...
%\newpage

\section{\label{Linearaxioms}First application~: axiomatization of linear scale space}


We shall now deduce from Theorem \ref{A-P} a characterization of the heat equation
 $\partial u/ \partial t = \Delta u$ as
 the unique linear and isotropic scale space.
   As a consequence for image smoothing models,
 linearity and contrast invariance are incompatible, and we obtain
  an explanation for the coexistence of (at least) two different
 schools in image processing~: contrast invariant mathematical morphology on the one side and
 classical linear scale spaces (convolution with gaussians) on the other side.


\begin{th1} \label{?2?}
 Let $T_t$ be a causal, translation invariant scale space defined on a space of functions 
$\cal F$ having the following having the following property $\cal P$ :
\newline
For all $\fxx \in \real^N, p\in \real^N $ and $A$ symmetric $N\times N$ matrix, there is 
$u\in \cal F$ such that $Du(\fxx) = p$, $D^2u(\fxx) = A$.
\newline
 If the operators  $T_{t,s}$ are {\bf linear} and {\bf Euclidean invariant}, then
 (up to a rescaling $t'=h(t) )$, the function $ u(t, \fxx ) = (T_tu_0)(\fxx )$
 is the solution of the heat equation 
\fb& \label{heatequation2}
\partial u/\partial t - \Delta u= 0
 \hbox {  in  }\real^N\times [0,\infty[, \quad u(0, .) = u_0(.) \hbox { in }\real^N.
\fe&
\end{th1}
\begin{Exercice}
  Our axiomatic for causal scale spaces assumes that $T_tu_0$ is well defined
when $u_0$ is a quadratic form. Now, we have defined the solution of the heat equation in
Chapter \ref{chapter1} only when
$u_0$ is bounded.  
One can show  that this solution is easily extended to quadratic forms with the same
convolution formula, $u(t) = \G_t \conv u_0$.  Show, by using the fact that $G_t(\fxx)$ has
exponential decay at infinity, that $u(t, \fxx) = G_t\conv u_0$ is well defined and $C^\infty$
when there exist $C$ and $k>0$ such that
$$|u_0(\fxx)|\leq C(1+|\fxx|^k).$$
Show that $u(t,\fxx)$ is then a classical solution of the heat equation.
\end{Exercice}

\paragraph{Proof.}   Since the scale
space is translation invariant in space, we know that $F(A, p, \fxx, c, t) = F(A, p, c, t)$ does
not depend on $\fxx$ and since it is invariant with respect to grey level translations, $F(A,
p, c, t) = F(A, p, t) $ does not depend upon $c$ (Propositions \ref{nedependpasdec} and
\ref{nedependpasdex}).  
 Since, if $u$ is any $C^2$ function, by Theorem \ref{A-P},  $F(D^2u, Du, t) = \lim_{h
\rightarrow 0} (T_{t+h, t}u - u)/h$, we deduce from the linearity of $T_{t+h, t}$ that $F$ is
linear
 in $u$ and therefore satisfies
 $$F(rD^2u + sD^2v, rDu + sDv, t) = rF(D^2u, Du, t) + sF(D^2v, Dv, t).$$ 
 for any real numbers $r$ and $s$ and any 
$C^2$ functions $u$ and $v$.  
In the arguments which follow, we fix $t$ and we therefore omit 
to mention it and write $F(A, p)$ instead of $F(A, p, t)$, etc.. Since the values of
 $Du, Dv, D^2u, D^2v$ are by Property $\cal P$ arbitrary and can be independently taken to be
$0$, we obtain for any vectors $p, p'$ and symmetric matrices $A, A'$
  that $$F(rA + sA', rp + sp') = rF(A, p) + sF(A', p') $$
 $$ \hbox{and }\;\; F(A, p) = F(A, 0) + F(0, p).$$ 
 Thus we can set $F(A, p) =  F_1(p) + F_2(A)$ and $F_1$ and $F_2$ are linear.
>From the  invariance of the scale space by linear isometry, we also obtain $F(^tRAR,^tRp) =
F(A, p)$
 for any isometry $R$ of $\real^N$.\newline
Taking $A = 0$, we deduce from the preceding
 relations that $F_1(Rp)  = F_1(p)$  and therefore $F_1(Rp) = F_1(p)$
 for any isometry $R$.  Since $F_1$ is linear, this is only possible if
 $F_1(p) = 0$ for any $p$.  Thus $F(A, p) = F_2(A)$.\newline
By the isometry invariance
 again, we have $F_2(^tRAR) = F_2(A)$ for any isometry $R$ and any symmetric
 matrix $A$.  Since every symmetric matrix can be diagonalized in an orthonormal
 basis and every pair of orthonormal bases can be exchanged by an isometry,
 we see that $F_2$ only depends on the eigenvalues $\lambda_1, ..., \lambda_n$ of
 $A$.  Thus we can write $F_2(A) = F_2( \lambda_1, ..., \lambda_n )$.  Since the
 eigenspaces can also be exchanged by isometries, $F_2( \lambda_1, ..., \lambda_n)$ must be
invariant under any permutation of the eigenvalues. 
 Thus $F$ only depends on the symmetric functions of the eigenvalues.
  \newline Now, the only linear symmetric function of $n$ variables is, up to multiplicative
constant, the sum.  Thus  $F_2(A)$
 only depends (linearly) on the trace of $A$ and therefore $F_2(A) = c \; trace(A)$
 for some constant $c$.  We conclude that $F(D^2u, Du) = c\Delta u$.  Since

 $F$ must
 be increasing in $A$, the constant $c$ is nonnegative. We now remember that all of this 
argument has been made with the omission of the $t$-dependence of $F$. Thus our real
conclusion is  $F(D^2u, Du, t) = c(t)\Delta u$ for
 some continuous nonnegative function $c(t)$.  Doing the rescaling $t'(t)$ defined by
 $\partial t'(t)/\partial t=c(t)$, we again obtain  a heat equation $\partial u/\partial
t' - \Delta u= 0.$ \endproof

\vfp

\subsection{Further invariance properties of the linear scale space.} 
We now list some invariance properties of the operator $T_tu_0= G_t\conv u_0$.  These
properties follow immediately from the properties of $G_t$, so that we essentially leave them
as exercises to the reader.  

\begin{Exercice}  Prove, by using the convolution formula, that
The linear scale space  is  scale
invariant.  More precisely, for any homothety $H_\lambda$, $\lambda > 0$, one has $ H_\lambda
T_t'  = T_t  H_\lambda$, with
 \fb& t' = t\lambda^2. \fe&
Prove that the scale space also is isotropic, i.e. 
$$T_t(Ru_0)= R(T_tu_0)$$
for any isometry $R$ of $\real^N$. (Use the fact that if $R$ is a linear isometry, 
then $G_t(R\fxx) = G_t(\fxx)$.
\end{Exercice}

%\paragraph{Proof by using the heat equation}  This proof requires the uniqueness result for
%the solution of the heat equation, which we have proven to be valid if (e.g.) $u_0$ belongs to
%$L^1_C$.
% We have to prove that $ u(\lambda \fxx, \lambda^2 t)$ is solution
%of  Equation (\ref{heatequation2}). Set $v(\fxx,t)= u(\lambda \fxx, \lambda^2 t)$.  Then
%$\Delta v =
%\lambda^2 \Delta u$, and
%$\frac{\partial v}{\partial t} = \lambda^2 \ut& $.  Thus $$\frac{\partial v}{\partial t} =
%\lambda^2 \Delta u = \lambda^2 (\frac{1}{\lambda^2} \Delta v) = \Delta v$$
%\endproof

\begin{lem}
The scale space defined by the heat equation (\ref{heatequation2}) is invariant by grey level
translations, but not contrast invariant.  \end{lem}


\paragraph{Proof~:}  
   Let $\partial u/\partial t = \Delta u$
 and $u = h(v)$, where $h$ is a $C^2$ nondecreasing function.  Then 
$$h'(v)\partial v/\partial t=h'(v)\Delta v+h''(v)|Dv|^2$$  
If the equation were contrast invariant, then $v$ would satisfy
 $\partial v/\partial t = \Delta v$.  Combining these equations yields  
$h''(v)|Dv|^2 = 0$, and since $v$ is arbitrary, $h''=0$.  Thus, 
the equation is only invariant under affine transforms of the grey level scale. 
\endproof

\subsection{Non causal linear scale-spaces}

It is important to notice that the axioms we have considered can be weakened and
that, in particular, other linear scale-spaces can be derived from slightly different 
principles. As an instance of axiomatics leading to the heat equation but also
to other convolution kernels let us mention that
E.J. Pauwels, P. Fiddelaers, T. Moons, and L.J. Van Gool have
explored linear operators $T_t$ satisfying the recursivity assumption as well as the scale invariance. They proved in \cite{Pauwels:1995:ECS} the following theorem

\begin{th1} \label{Pandal} {\rm [Pauwels and al. 94] $\;\;$ N=2.} 
Assume that $T_t$ is recursive, and that   $T_t u_0 = k_t \circ
u_0$, for a continuous function $k_t$ from $\real^2$ into $\real$. If
$T_t$ satisfies also the scale invariance, commutes with grey level translations and rotations, then $k_t$ is of the
form
$$k_t(\fxx) = \int^{\infty}_0 J_0(r\rho) \exp(-\alpha \rho^\alpha t)
\rho d\rho \qquad \hbox{with } r = |\fxx|,$$
where $\alpha>0$ and $J_0$ is the zeroth order Bessel function,
$$ J_0(x) = \frac{1}{2\pi} \int^{2\pi}_{0} \exp( -ix \cos(\theta) )
d\theta $$
\end{th1}


We obtain that scale-invariance reduces the possible linear and
recursive scale-spaces to a family with only one free parameter
$\alpha$.

Choosing $\alpha = 2$ leads to the gaussian kernel which is, as we have seen,
the unique linear scale-space satisfying also the
local maximum principle.

For $\alpha > 2$, $k_t$ is sometimes negative, then contredicts the
comparison principle.

For $\alpha < 2$, $k_t$ violates the locality condition
included in the local maximum principle. Roughly speaking, this is due to
the fact that the function $k_t$ does not decrease fast enough to
zero when $|\fxx|$ tends to infinity.


\PCAMSS

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

\zbibnote



The presentation of this chapter and of the next one mainly follows the Alvarez et al. papers 
\cite{Alvarez:1992:AEF,Alvarez:1992:ANO, Alvarez:1993:AFE} whose claim was
"We describe all multiscale causal, local, stable and
                 shape preserving smoothing operators. This classification
                 contains the classical ``morphological'' operators, and
                 some new ones."
Several survey papers present this axiomatics with increasingly simple sets of
axioms,  Lions \cite{Lions:1994:ADI}, Alvarez \cite{Alvarez:1999:FCA},
\cite{Guichard:1995:AVP}  and the PhD \cite{Guichard:1994:AAM} which  actually is an early version of the present
book.
\newline
{\bf Linear scale space}\newline
The scale space theory was founded (in a linear framework) by 
Witkin \cite{Witkin:1983:SSF}, Marr \cite{Marr:1982:V} Koenderink.  An earlier development of the linear scale
space has been traced in  Japan \cite{Weickert:1997:HGS, Weickert:1999:LSS}. The work of
Lindeberg \cite{Lindeberg:1994:SSTc} represents  a high state of sophistication in 
the use of Linear Scale Space. Many works of Florack, ter Haar Romeny, Koenderink
and Viergever focus on the computation   of partial derivatives of any order in an image
and their use in image analysis \cite{Florack:1992:FTS,Florack:1992:SDS, Florack:1993:MLJ,
Florack:1994:LSS}. The concept of {\it causality}, used by all of these authors is crucial and
has reinterpreted in this chapter as the combination of two requirements: pyramidal
structure and a comparison principle. De Giorgi \cite{Giorgi:1995:NCF} founded on similar principles
 his mathematical theory of 
barriers for geometric motions.
 There are many axiomatic characterizations of the linear scale space by its invariance,
conservativeness and causal properties. A particular mention is due to the early
Babaud, Witkin, Baudin and Duda \cite{Babaud:1986:UGK} and to Hummel 
\cite{Hummel:1988:SSF}.
A slight relaxation of the initial axioms led Pauwels et al.
\cite{Pauwels:1995:ECS} to discover other possibilities
for the linear scale space, less local though. 
There have also been several attempts to define non linear scale spaces, understood
as
 nonlinear invariant families of scaled smoothing operators. In Mathematical
Morphology, let us mention Chen \cite{Chen:1989:MAB} and Toet \cite{Toet:1989:MPI,
Toet:1990:HMI} and Jackway
 \cite {Jackway:1996:SSP} who emphasizes the scale space properties of multiscale erosions and dilations. After \cite{Alvarez:1993:AFE}, several different axiomatics have been  proposed 
for nonlinear scale-spaces.  Weikert\cite{Weickert:1996:TFA,Weickert:1998:ADI} insists
on  grey level conservation (which excludes all mathematical morphology operators) and
proposes a line of conservative parabolic nonlinear P.D.E.'s.
The axiomatic presentation of Olver et al.
 \cite{Olver:1994:DIS} deduces the various scale spaces as invariant heat flows.
See also \cite{Niessen:1997:GFG} and \cite{Ed:1994:GDD} for a book with miscellaneous
contributions to the subject of geometric diffusion. 
\newline

\noindent
{\bf Extensions}
\newline
Caselles et al. \cite{Caselles:1996:PDE} have questionned the very soundness of applying any of the proposed
scale spaces to natural images : they argue following the Kanisza psychophysical
theory that occlusion generates T-junctions in images and that these T-junctions should be
detected before any smoothing is performed.
In \cite{Caselles:1997:SSV}, the same authors propose the set of level lines of the image,
the so called topographic map, as an alternative multiscale structure for describing images.
 Geraets et al. propose a generalization of scale space to discrete pointsets 
\cite{Geraets:1995:ASS}.
\newline
\newline
{\bf Contrast invariance}
\newline
The invariance of image analysis with respect to changes of illumination is stated
in perception theory by
\cite{Wertheimer:1923:ULG}, as early as 1923.
In Mathematical Morphology, the contrast invariance is commented and used in 
Serra \cite{Serra:1982:IAM}.  Koenderink \cite {Koenderink:1980:PIR} insist a lot on this requirement
and devise photometric invariants.
  A study of contrats invariant differential operators is made in 
Florack \cite{Florack:1994:GIT}. See also \cite{Rahmati:1994:IID} and
Romeny et al. \cite {Romeny:1991:ITO}, where third order contrast invariant
operators are constructed for T-junction detection.
 \newline
\newline
{\bf Scale invariance}\newline
\cite{Beaudet:1978:RII} is one of the first discussions about rotation invariant
image operators.  See also \cite{Lenz:1986:RIO}
 \cite{Baldwin:1998:RAS} discusses scale invariant shape representation. Alvarez
and Gousseau \cite{Alvarez:1999:SON} confirm by numerical experiments on natural images
their scale invariance.
\newline

\noindent
{\bf Affine invariance}
\newline
Affine invariance is viewed as an approximate projective invariance
\cite{Cheng:1996:AAI}, an obvious requirement in 3D object recognition
\cite{Bose:1996:MBO, Zisserman:1995:ORU}. The work of Forsyth, Mundy and Zissermann
\cite{Forsyth:1992:TIP, Mundy:19xx:GIC, Mundy:1994:AIC}
has been seminal and lunched a wide discussion on this theme and many contributions on the
computation and use of
affine and projective differential invariants in image processing
\cite{Salden:1993:APD, Blom:1992:AIC, VanGool:1992:SDI, Weiss:1995:LPA}.



\chapter{All contrast invariant and affine scale spaces  \label{allcontrastinvariantandaffinescalespaces} \label{chapter19}}
\thispagestyle{empty}

\section{The two dimensional case} 
In this section, we  give a characterization of two-dimensional contrast invariant scale
spaces  as ``curvature evolution equations". We prove that
if a two-dimensional scale space $T_t$ is causal and  invariant by
isometries and contrast changes (contrast invariance), then it obeys an equation of the
kind
\index{PDE!curvature equations} \index{curvature equations}
\fb&
\frac{\partial u}{\partial t} = |Du|G( \curv(u), t). 
%\label {10ancien}
\fe&
How to choose $G$ ?  If we impose affine invariance
and reverse contrast invariance for $T_t$, that is, $T_t(-u)=-T_tu$, then  there is a single
equation left~: the so called Affine Morphological Scale Space (AMSS), 
\index{PDE!AMSS} \index{AMSS}
$$
\frac {\partial u}{\partial t} = (\curv(u))^{\frac 1 3}|Du|.
$$
This study can be 
generalized to any dimension. 
 For simplicity, we first treat ``\`{a} la main" the case of dimension 2,
because the computations are in that case more intuitive.

 \skipaline By  Theorem \ref{A-P}, we were led to study scale
space models defined by a partial differential equation $$\frac{\partial u}{\partial t} =
F(D^2u, Du, u, x, t), \quad u(0)=u_0 $$ where $u_0$ is the image to analyze (the datum),
$u(t)$ is the image analyzed at scale $t$ and $F(A, p, c, x, t)$ depends on a symmetric 2*2
matrix $A$, a two-dimensional vector $p$, a constant $c$, a point of the plane $x$ and a
real positive scale $t$. If we assume ~:   
\newline $\bullet$ The translation
invariance, then $F$ does not depend upon $x$ (Proposition \ref{nedependpasdex}). 
\newline
$\bullet$ The invariance by translation of grey level $u\to u+C$, then  $F$ does not depend
upon
$c$ (Proposition \ref{nedependpasdec}).
\newline
$\bullet$  The isotropy, that is, the euclidean
invariance assumption, then we obtain a further  constraint on $F$, which is
given by  Lemma \ref{lemmeinvarianceparrotation}:
$F$ satisfies, for every linear isometry $R \in O^N$,
$$(\ref{invarianceparrotationpourF}) \qquad
F(RA^tR, Rp, t) = F(A, p, t) 
$$
$\bullet$ The contrast invariance~: we know by Lemma \ref{lemmeinvariancemorphologique}  that
it implies 
$$
 (\ref{invariancemorphologiquepourF}) \qquad
F(\mu A+\lambda p\otimes p, \mu p, t)=\mu F(A, p, t), 
$$
for every real
values $\lambda$, $\mu$, every symmetric matrix $A$ and every two-dimensional
vector $p$. 
By $p\otimes p$ we mean the tensorial product, or in a more
intuitive way, the matrix product  $p^tp$, where $p$ is thought of as a
column matrix. In dimension 2, this yields $$p\otimes p= \left[ \begin{array}{ll}
                 p_1^2 & p_1p_2 \\
		 p_1p_2 & p_2^2
             \end{array} \right].$$


We shall now draw from Relations (\ref{invarianceparrotationpourF}) and
(\ref{invariancemorphologiquepourF}) a huge reduction of $F$, which will appear to depend
upon only two real parameters $\tilde a_{1,1}(A,p)$ and $\tilde a_{1,2}(A,p)$.  These
parameters are defined by considering the rotation matrix $$R_p=\frac{1}{|p|} \left[
\begin{array}{ll}
                 p_1 &p_2 \\
		-p_2 & p_1
             \end{array} \right].$$
$R_p$ has been chosen so that it sends $\frac {p}{|p|}$ onto the unit vector
$e_1 =^t(1,0)$, that is 

\fb&
R_p p = |p|e_1. 
\label {4ancien}
%§\quad label 4ancien
\fe&
 Then we set

\fb&
\frac {1}{|p|}R_pA^tR_p = \left[
\begin{array}{ll}
                 \tilde a_{1,1} & \tilde a_{1,2} \\
		 \tilde a_{1,2} & \tilde a_{2,2}
             \end{array} \right].
\label{5ancien}
%§\quad label 5ancien
\fe&
An easy computation yields  (setting
$p^\perp = (-p_2, p_1)$, a vector orthogonal to $p$)

\fb&
\tilde a_{1,2} = \frac{1}{|p|^3}((p_1^2-p_2^2)a_{1,2} +
p_1p_2(a_{2,2}-a_{1,1})) = \frac{A(p,p^\perp)}{|p|^3}, 
\label{6ancien}
%§\quad label 6ancien
\fe&

\fb&
\tilde a_{2,2} = \frac{1}{|p|^3}(a_{1,1}p_2^2 -2 a_{1,2}p_1p_2+a_{2,2}p_1^2)) =
\frac{A(p^\perp,p^\perp)}{|p|^3}, 
\label {7ancien}
%§\quad label 7ancien
\fe&

\skipaline 

\begin{lem} \label{star8}
If $F(A, p, t)$ satisfies (\ref{invarianceparrotationpourF})  and
(\ref{invariancemorphologiquepourF}), then there is a function $G$,  depending on three real
variables only, such that 

\fb&
F(A, p, t) = |p|G(\tilde a_{1,1}, \tilde a_{1,2}, t).
\label{8ancien}
\fe&
\end{lem}

\skipaline

Of course, we must always keep in mind that $A$ represents $D^2u$ and $p$
represents $Du$ so that the result above and the calculations below, though
purely algebraic, have a differential geometry interpretation. 
In particular, we have
$$\tilde a_{2,2}(D^2u, Du) = \div(\frac{Du}{|Du|})= \curv(u) \quad \hbox{and}$$
$$\tilde a_{1,2}(D^2u, Du) = \div(\frac{Du^\perp}{|Du|}) = anticurv(u),$$

\begin{Exercice}  Interpretation of $anticurv(u)$.
 \index{differential operators!anti-curvature}  \index{anti-curvature} Show that
$anticurv(u)(\fxx)$ can
be interpreted as the curvature of the gradient 
lines of $u$. Those lines are
the lines tangent to the gradient of $u$ at every point. They form a bunch
of lines orthogonal to the isolevel lines of $u$. 
\end{Exercice}

\paragraph{Proof of Lemma \ref{star8}}
We first use (\ref{invariancemorphologiquepourF}), setting $\mu = \frac {1}{|p|}$.  Thus
$$F(A,p,t)= |p|F(\frac{A}{|p|}+\lambda p\otimes p,  \frac {p}{|p|},t)$$ for any
real value $\lambda$.  Then, we apply (\ref{invarianceparrotationpourF}) with $R=^tR_p$:
$$F(A,p,t)= |p|F(R_p(\frac A {|p|})^tR_p + \lambda R_p (p\otimes p)^tR_p, 
e_1,t),$$
for any real number $\lambda$.
 It is easily checked that 
$$R_p( p\otimes p)^tR_p = \left[
\begin{array}{ll}
                 |p|^2 & 0 \\
		 0 & 0
             \end{array} \right].$$
Thus, by (\ref{5ancien}),
$$F(A,p,t)= |p|F(\left[
\begin{array}{ll}
                 \tilde a_{1,1}+\lambda|p|^2 & \tilde a_{1,2} \\
		 \tilde a_{1,2} & \tilde a_{2,2}\end{array} \right], e_1,t)$$ for any
$\lambda$.  Consequently, we see that $F$ only depends upon $\tilde a_{2,2}$ and
$\tilde a_{1,2}$, which proves the assertion (\ref{8ancien}).
\enddemo



\begin{lem} The function $G$ only depends upon $\tilde a_{2,2}$
and $t$. 
\end{lem}

\paragraph{Proof}
Here we use the fact that $F(A,p,t)$ is a nondecreasing continuous function with
respect to $A$ (one of the conclusions of Theorem \ref{A-P}).  Recall that by
Relations (\ref{6ancien}) and (\ref{7ancien}), $$\tilde a_{1,2} = \frac{A(p,p^\perp)}{|p|^3},
$$ $$\tilde a_{2,2} = \frac{A(p^\perp,p^\perp)}{|p|^3}.$$
A vector $p\neq 0$ being fixed, let us consider two matrices $A$ and $B$ such that
$A\geq B$.  We have
$$F(A,p,t) = G(\frac{A(p,p^\perp)}{|p|^3},
\frac{A(p^\perp,p^\perp)}{|p|^3},t)$$
In order to simplify notations, we set as above $\tilde a_{2,2}=\frac 1{|p|^3} A(p^\perp,
p^\perp)$,  $\tilde b_{2,2}=\frac 1{|p|^3}B(p^\perp, p^\perp)$, $\tilde a_{1,2}= \frac
1{|p|^3}A(p^\perp, p)$, $\tilde b_{1,2}=\frac 1{|p|^3}B(p^\perp, p)$, and analogs for $\tilde
a_{1,1}$ and
$\tilde b_{1,1}$.  Since the system $(p, p^\perp)$ is orthonormal, one has
$A\geq B$ if and only if for every pair of real numbers $(x,y)$, 

\fb&
(\tilde a_{1,1}-\tilde b_{1,1})x^2 + 2(\tilde a_{1,2}-\tilde b_{1,2})xy + (\tilde
a_{2,2}-\tilde b_{2,2})y^2\geq 0 
\label{9ancien}
%§\quad label 9ancien
\fe&
We fix $\tilde a_{2,2}-\tilde b_{2,2} = \varepsilon >0$ and we notice that if
$-\tilde b_{1,1}$ is chosen large enough in correspondence of arbitrarily fixed
values of $\tilde a_{1,1}$, $\tilde a_{1,2}$, $\tilde b_{1,2}$ and 
$\varepsilon$, then (\ref{9ancien}) is satisfied for every $(x,y)$.  Thus
$F(A,p,t)\geq F(B,p,t)$ and therefore 

$$G(\tilde a_{1,2}, \tilde a_{2,2}, t)\geq G(\tilde b_{1,2},\tilde
a_{2,2}-\varepsilon, t), $$
this relation being true for every $\tilde a_{1,2}$, $\tilde b_{1,2}$,
$\tilde a_{2,2}$ and  $\varepsilon$.  We can let $\varepsilon \to 0$ in the
last inequality, since $F$ is continuous with respect to $A$.  It follows that
$$G(\tilde a_{1,2}, \tilde a_{2,2}, t)\geq G(\tilde b_{1,2},\tilde
a_{2,2},t), $$
 for any value of the three variables.  Thus $G$ only depends on its second and third
argument.
 \enddemo 
We can summarize what we have proved in the following theorem.

\skipaline

\begin{th1}   If a two-dimensional scale space $T_t$ is causal and  invariant by
isometries and contrast changes, then it obeys an equation of the
kind
\fb&
\frac{\partial u}{\partial t} = |Du|G( \curv(u), t),
\label {10ancien}
\fe&
where $G$ is nondecreasing and continuous with respect to its first argument.
\end{th1}

We have not yet used the scale and affine invariances. This is to come now.

\begin{th1} \label {Theorem2ancien} 
%§\quad label Theorem2ancien
  Let $T_t$ be a causal, isotropic constrast invariant scale space.  Assume that it is, in
addition, scale invariant (that is, invariant with respect to zooms) and normalized
according to Lemma \ref{Nsc}. Then its equation is 

\fb&
\frac{\partial u}{\partial t} = |Du|\beta( t \curv(u)) 
\label {12ancien}
%§\quad label 12ancien
\fe&
where $\beta$ is a nondecreasing continuous function.\newline
If we impose a full affine invariance to the scale space and assume again that the scale is
normalized (Lemma \ref{Nsc}), then its equation is

\fb&
\frac{\partial u}{\partial t} = |Du|\gamma( t \curv(u),
\label{13ancien}
%§\quad label 13ancien
\fe&
 where for some positive constants $C$ and $D$, 
$\gamma (s) = Cs^\frac 1 3$ if $s>0$, $\gamma(s) = -D|s|^\frac 1 3$ if $s<0$.
Conversely, this equation defines an affine invariant scale space. 
\end{th1}

\begin{Remark}\label{inversioncontraste}  In order to have $C=D$, it is enough to impose the
"reverse contrast invariance", which extends the contrast invariance 
$T_{t+h,t} \circ g = g\circ T_{t+h,t}$ to nondecreasing contrast functions
$g$. 
\end{Remark}

\skipaline
\noindent {\bf Proof.} 
By Lemma \ref{lemme3ancien}, if a causal scale space is affine invariant, then, after
the adequate renormalization (Lemma \ref{Nsc}),
its associated function $F$ satisfies
\fb&
F(BA^tB, Bp, t) = |det B|^{\frac 1 2}F(A, p, |det B|^{\frac 1 2} t).
\label{11ancienb}
%§\quad label 11ancien
\fe&
for any linear map $B$.
We first apply Relation (\ref{11ancienb}) to the case of a zoom $B= c Id$.  Then
$$\tilde a_{2,2}(BA^tB, Bp)=\tilde a_{2,2}(c^2 A, c p) =
\tilde a_{2,2}(\frac {c^2A(cp^\perp, cp^\perp)}{|cp|^3}) = c\tilde a_{2,2}(A,p).$$
Thus, by relation (\ref{11ancienb}),
$$c|p|G(c\tilde a_{2,2}(A,p), t)=c|p|G(\tilde a_{2,2}(A,p), ct).$$
Since this relation holds for arbitrary values of $A$, $p$, $c$, $t$, we have
for any $c$, $s$ and $t\geq 0$, $G(cs,t)=G(s, ct)$.  Choosing $c=t^{-1}$, we get 
$$G(s,t)=G(st,1)=\beta (st)$$ for a continuous nondecreasing function $\beta$. 
This proves the first statement of the theorem.  Let us now pass to the general affine
invariance. In order to identify the power $\frac 1 3$, we only need to express the affine
invariance  in the particular case of orthogonal affinities with determinant 1,
$$
B(\lambda)=\left[\begin{array}{ll} \lambda & 0 \\ 
0 & \lambda^{-1} \end{array}\right].$$ 
Indeed, every linear map of the plane is a
product of isometries and such affinities and we already have fully used the
invariance by isometries.  We first compute
$$BA^tB=\left[ \begin{array}{ll} 
\lambda^2 a_{1,1} & a_{1,2} \\
a_{1,2} & \lambda^{-2}a_{2,2} 
\end{array}\right],$$

$$Bp=(\lambda p_1, \frac{p_2}{\lambda}).$$
Therefore, using (\ref{7ancien}),

\fb&
\tilde a_{2,2}(^tBAB, Bp)=\frac{a_{1,1}p_2^2-2a_{1,2}p_1p_2+a_{2,2}p_1^2}
{(\lambda^2 p_1^2+\lambda^{-2}p_2^2)^\frac 3 2}. 
\label {13-bisancien}
%§\quad label 13-bisancien
\fe&
We know that $F(A,p,t)=\beta(t\tilde a_{2,2}(A,p,t))|p|$.  Plugging this relation
into the affine invariance relation (\ref{11ancienb}) yields

\fb&
|Bp|\beta(t\tilde a_{2,2}(BA^tB, Bp))=|p|\beta(t\tilde a_{2,2}(A,p)). 
\label{14ancien}
%§\quad label 14ancien
\fe&
We impose $p_2=0$, $p_1=1$, $a_{2,2}=1$, so that from (\ref{13-bisancien}) and
(\ref{14ancien}) follows $$|\lambda|\beta (\frac t {\lambda ^3})= \beta(t),$$
which achieves the proof.
\endproof


%%\PCOURB    ???

\section{General form of contrast invariant scale-space equations in dimension $N$.}

We do the same general assumptions on the considered scale spaces as
in the preceding section :  we consider a scale space defined by an equation
$\partial u/\partial t = F(D^2u, Du, t)$ and we assume that $F(A,p,t)$ is nondecreasing with
respect to 
$A$, that is
$F(A, p, t) \geq F(B, p, t)$ if $A \geq B$
(comparison principle).  The considered $F$'s will always be
continuous with respect to $A$, at least for $p\neq 0$.  
Our aim is to deduce from the contrast invariance the general
form of the function $F$ in dimension $N$. We shall prove that if we
assume also the isometry invariance, then the scale space is described by an equation
$$
\frac{\partial u}{\partial t} = G(\lambda_1, ... , \lambda_{N-1},
\vert Du \vert, t)
$$ \index{PDE!curvature equations N-D}
where $\lambda_1$, ..., $\lambda_{N-1}$ are the principal curvatures
of the level hypersurface of $u$ and   $G$ is a real function defined on
$\real^{N-1}\times[0, +\infty[ \times [0, +\infty[$ which is symmetric with
respect to $(\lambda_1, ..., \lambda_{N-1})$, positively homogenous
with respect to $(\lambda_1, ... , \lambda_{N-1}, \vert Du \vert)$
and nondecreasing with respect to each $\lambda_i (1\leq i\leq N-1)$
for all $t$ in $[0, +\infty[$.
The main axiom which we  introduce in this section is the 
contrast invariance,
$  T_t\circ h = h\circ T_t$ for all $t
\geq 0$, where  $h$ is any  nondecreasing real function.
In the calculations below, we shall forget the $t$-dependence of $F$ because it does not change
calculation and results and write $F(A,p)$ instead of $F(A, p, t)$. 
By Lemma \ref{lemmeinvariancemorphologique}, the function  $F$ associated  with a
contrast invariant scale space satisfies (Relation (\ref{invariancemorphologiquepourF}))
\fb& F(\mu A+\lambda p\otimes p, \mu p, t)=\mu F(A, p, t), 
\fe&
for all real
values $\lambda$, $\mu\geq 0$, every symmetric matrix $A\in S^N$ and every
vector $p\in \real^N$. 
Taking $\lambda = 0$, this yields in particular that $F$ is
positively homogeneous,
\fb&	\label{Mor13}	F(\mu A, \mu p) = \mu F(A, p) \;\; \hbox{ for all } \mu  \geq 0, A \in
S^N,\; p \in \real^N,\; p \neq 0.\fe&
		 (In particular, $F(0, 0) = 0$).
 Now, provided (\ref{Mor13}) holds,  the
contrast invariance reduces to
\fb&	\label{Mor14}	F(A + \lambda p\otimes  p, p) = F(A, p) \hbox{ for all } \lambda \in \real, A \in
S^N, p \in \real^N, p\neq0. \fe&

\noindent If $N=1$, this implies that $F$ depends only on $p$ and in view of
(\ref{Mor13}), $F$ is necessarily given by
\fb&	\label{Mor15}	F(A, p) = ap^+ + bp^- \;\; \hbox{ for some }\;\; a, b \in \real, \fe& 
		where $p^+= max(p,0)$ and $p^- = min(p, 0)$.
Less trivial situations occur if $N\geq 2$, an assumption which we make
in all that follows. If $p\in \real^N$, we denote by $Q_p$  the matrix of
the projection onto   the hyperplane $ p^\perp$
orthogonal to
$p$. 

\index{projection matrix} \index{Giga Goto theorem}

\begin{th1} \label{Morth1} (Giga, Goto \cite{GiGo})
Let $T_t$ be a scale space satisfying the contrast
invariance.  Then the associated $F$ satisfies
\fb&  \label{Mor16} F(A, p) = F(Q_pAQ_p, p) \;\; \hbox{for all }\; A \in S^N,\; p \hbox{ in }
\real^N,\;  p\neq0, \fe&  where $Q_p$ is the
projection matrix, $Q_p = I_N- p\otimes  p/|p|^2$.
\end{th1}

\paragraph{ Proof of Theorem \ref{Morth1}. }   In order to show (\ref{Mor16}), we
fix $p$ in $\real^N$, $p\neq0$ and we select a coordinate system  such that $p=\vert p\vert
(0,... , 0, 1)$, in which case $Q_pAQ_p$ becomes $A' =
(a'_{ij})_{1\leq i,j\leq N}$  where $a'_{ij} = a_{ij}$ if $1\leq
i,j\leq N-1$, $a'_{ij}=0$ otherwise and $p\otimes  p =
|p|^2(\delta_{Ni}\delta_{Nj})_{1\leq i,j\leq N}.$  (As usual, we set $\delta_{k,l}=0$ if 
$k\neq l$ and $\delta_{k,l}=1$ otherwise.)
Relation (\ref{Mor14}) implies that $F(A, p)$ does not depend on $a_{NN}$.
 Set $M=a^2_{N,1} +...+ a^2_{N,N-1}$
and $I_\epsilon = \epsilon I_N+(M/\epsilon -\epsilon)(\delta_{Ni}\delta_{Nj})_{1\leq i,j\leq
N}$.  One easily checks that $Q_pAQ_p \leq  A + I_\epsilon$ and $A \leq  Q_pAQ_p  +
I_\epsilon$. 
Using
$F(A,p)\geq F(B,p)$ if $A\geq B$, and letting $\epsilon$ tend to zero, we obtain,  since $F$ does not
depend on $a_{NN}$ and is continuous for $p\neq0$,  $ F(A,p) = F(Q_pAQ_p, p)$.
\endproof
 
We need to introduce some notations.   Since $Q_pAQ_p$ leaves invariant $(\real p)^\perp$
(for
$p\neq 0$ fixed) and $Q_pAQ_p$ vanishes on $\real p$,  $Q_pAQ_p$ admits $N$ real eigenvalues
which include $0$ and $(\alpha_1, ..., \alpha_{N-1})$ which are the real eigenvalues of the
restriction of $Q_pAQ_p$ to $(\real p)^\perp$. We set, where
$\vert p \vert \neq 0, \;\;\; \lambda_i = \alpha_i / \vert p \vert$
for each $i$ between $0$ and $N-1$. When 
$A=D^2u$ and $p=Du$,  the $\lambda_i$ are by Proposition \ref{definitionprincipalcurvatures}
the principal curvatures of the level hypersurface of $u$.  If $N=2$, by Definition
\ref{definitiondelacourbure},
$\lambda_1 = tr(Q_pAQ_p) / \vert p \vert = \curv(u)$.

\begin{cor} \label{Morcor3}
  Let $N\geq 2$. Let $T_t$ be a scale space satisfying
the contrast and the euclidean invariance, then 

\fb&	 \label{Mor21} F(A, p) = \vert p \vert G (\lambda_1, ..., \lambda_{N-1}),
\fe& 
$$ \hbox{for all } \;\;\; A \in S^N, \; p \in \real^N,  p\neq 0, $$
for some continuous function $ G \hbox{ defined on }  \real^{N-1}\times [0, +\infty[
\hbox{ which is }$
 symmetric with respect to $(\lambda_1,...,\lambda_{N-1}) $
 and nondecreasing with respect to each $ \lambda_i \;\;\; (1\leq i\leq N-1). $
\end{cor}

\paragraph{Proof of Corollary \ref{Morcor3}.}  
 By Lemma \ref{lemmeinvarianceparrotation}  the  function $F$ associated with the scale space
satisfies 
\fb&
\label{Mor20}	F(^tRAR,^tRp) = F(A, p) \;\; \hbox{ for all }\; A 
\in S^N,\; p \in \real^N,\;  p\neq0,\; R \in O^N, \fe&
 where $O^N$  denotes the group of orthogonal transforms of $\real^N$\notation, that is the 
linear transforms preserving the euclidean and therefore satisfying $R^{-1}=^tR$.

The first step consists in showing that for
$p\neq 0$ fixed, (\ref{Mor20}) implies that $F$ is a function  of ($\lambda_1,
...,
\lambda_{N-1}$).  
In order to do so, we consider the subgroup
of $O^N$ defined by those transforms $R$  that leave $p$ invariant i.e. $Rp=p$ so that $^tRp
R^{-1} = p$.  Then, clearly $Q_p$ and $R$ commute and thus (\ref{Mor20}) implies that
$F(^tRQ_pAQ_pR,^tRp)=F(Q_pAQ_p,^tRp) = F(Q_pAQ_p, p)$. 
There therefore is a function $G$ such that $F(A,p) = G_1 (\lambda_1, ..., \lambda_{N-1}, p)$,
where
 $ (\lambda_1, ..., \lambda_{N-1})$ are the eigenvalues
of $Q_pAQ_p$.  Let $R$ in $O^N$ and $q =^tRp$.  We notice that  $Q_q^tRARQ_q =^tRQ_pAQ_pR$.
We deduce that $Q_q^tRARQ_q$ and $Q_pAQ_p$ have the same eigenvalues.
  Thus, by using the euclidean invariance (\ref{Mor20}) again, $F(A, p)
= F(^tRAR,^tRp) = G_1(\alpha_1, ..., \alpha_{N-1}, q)$.  Thus $F$ only depends on the
modulus of $p$ and therefore we can write  $F(A, p) = G_1(\alpha_1, ..., \alpha_{N-1}, |p|)$.
 We use again (\ref{Mor13}), which yields
$$ G_1(\mu \alpha_1, ..., \mu \alpha_{N-1}, \mu \vert p\vert) = \mu
G_1(\alpha_1, ..., \alpha_{N-1},|p|).$$ 
Choosing $\mu = \vert p \vert^{-1}$, we obtain $F(A,p) =  \vert
p \vert G_1( \alpha_1 / \vert p\vert, ..., \alpha_{N-1} / \vert p\vert,
1) =$ $\vert p \vert G (\lambda_1, ..., \lambda_{N-1})$.  In addition, $G$ is a symmetric
function of
$(\lambda_1, ..., \lambda_{N-1})$, and, since $F$ is monotone, $G$ is clearly nondecreasing
with respect to each
$\lambda_i$ for $1\leq i\leq N-1$. \endproof
		
\section{Affine morphological scale spaces ($N\geq 3$).}


\begin{th1}  \label{AMSS 3-D}  $(N\geq 2)$. \index{PDE!affine and contrast invariant N-D}
\index{AMSS 3-D}
\noindent Let $T_t$ be an affine and contrast invariant scale space satisfying
$T_t(-u)=T_t(u)$.  Assume that it is renormalized according to Lemma \ref {Nsc}.  Then its
associated equation is
\fb&	 \label{Mor99} \frac{\partial u}{\partial t} = |Du|  \big|
\prod_{1\leq i \leq N-1}  t \lambda_i \big|^{\frac{1}{N+1}}
 \; \; H\big(\sum_{1 \leq i \leq N-1} sgn(\lambda_i) \big) \fe&
where  the $\lambda_i$ are the mean curvatures of the level
hypersurface, $sgn(\lambda_i)$ denotes the sign of $\lambda_i$ and $H$ is defined by
$$ H(N-1) =  - H(-(N-1)) = 1 \qquad \hbox{ and } \forall i \in Z\!\!\!Z,\;
|i|\neq N-1,  \;\;\; H(i) = 0$$
In other terms, $H$ is equal to zero if all the $\lambda_i$ have not the same sign.
\end{th1}

\paragraph{Proof}
We begin  by using the result of Corollary \ref{Morcor3}.
The contrast and euclidean invariances imply that the scale space is associated an
equation
$$
  \frac{\partial u}{\partial t} = F(D^2u, Du, t)
$$ 
with
$$F(A, p, t)= = |p| G (\lambda_1, ..., \lambda_{N-1}, t),$$
and $G$ is symmetric with respect to
the $\lambda_i$.  If $p\neq 0$, we have set $\lambda_i= \frac{\alpha_i} {|p|}$, where  
$\alpha_i
$ are the eigenvalues of the restriction of $ A$ to the hyperplane orthogonal to $p$, $p^\perp$
(see Corollary
\ref{Morcor3}). In order to simplify the proof, we prefer to use here a more general form for
the function $F$ \fb& \label{morcor3} F(A, p, t) = G_1(\alpha_1, ...,
\alpha_{N-1},| p |, t) \fe&
Of course, $| p | G(\lambda_1, ..., \lambda_{N-1}, t)$ is a particular instance of such a
function $G_1$.
Since the restriction of $A$ to the hyperplane $p^\perp$ is a symmetric matrix, we can choose
a set of orthogonal vectors $e_1, ..., e_{N-1}$ such that $\alpha_i = A(e_i, e_i)$. $(0 \leq i
\leq N-1)$. Notice that each $e_i$ is orthogonal to $p$. Then, in order to have a
complete basis of $\real^N$, we set $e_N = p /| p |$.
Let $B_i$, 
(for $1 \leq i \leq N-1$), be the linear transform from $\real^N$ into
$\real^N$ defined by $$B_i( e_1, ..., e_i, ..., e_{N-1} , e_N) = 
(e_1, ... , \beta e_i, ..., e_{N-1}, \beta^{-1} e_{N}),$$ for $\beta
\in \real$, so that $det(B_i) = 1$.
By (\ref{11ancien}) in Lemma \ref{lemme3ancien}, applied with $B=B_1$, 
$$F(A, p, t) 
=   G( \alpha_1 \beta^2, \alpha_2, ...,\alpha_{N-1}, \beta^{-1} | p|, t ). $$ 
 By choosing $\beta = | \alpha_1|^{-1/2}$ we obtain  
$$
F(A, p, t) =   G( sgn(\alpha_1), \alpha_2, ...,
\alpha_{N-1}, | \alpha_1 |^\frac{1}{2} | p |, t ).
$$
Iterating the same argument with $B=B_i$  for $i=2$ to $i=N-1$ yields
\fb& \label{morcor4}
 F(A, p, t) = G\big( sgn(\alpha_1), ...,sgn(\alpha_{N-1}), | p |
\; | \prod_{0 \leq i \leq N-1} \alpha_i |^\frac{1}{2} , t\big).

\fe&
We now use again  the scale invariance relation (\ref{11ancien}) in Lemma \ref{lemme3ancien}
 and lemma \ref{Nsc}, which yields
$$F(\beta^2 A, \beta p, t) = \beta F(A, p, \beta t)$$
and therefore
$$G\big(sgn(\alpha_1), ..., sgn(\alpha_{N-1}), \beta |p|\beta^{N-1}| \prod_{1\leq i \leq N-1}
\alpha_i \vert ^\frac{1}{2}  ,t\big) =
\beta G\big(sgn(\alpha_1), ..., sgn(\alpha_{N-1}), |p| \prod_{1\leq i\leq
N-1}|\alpha_i|^\frac{1}{2}, \beta t\big).  $$
We deduce that
 $$
 \beta^{-1}  G\big(sgn(\alpha_1), ..., sgn(\alpha_{N-1}), \beta^N |p|  \prod_{1\leq i\leq
N-1} |\alpha_i|^\frac{1}{2} ,t \beta^{-1}\big) = 
G\big(sgn(\alpha_1), ..., sgn(\alpha_{N-1}), |p| \prod_{1\leq i\leq N-1}
|\alpha_i | ^\frac{1}{2}, t \big).
$$ 
Setting $\beta = t$, we obtain 

$$
 F(A, p, t) = t^{-1}
G\big( sgn(\alpha_1), ..., sgn(\alpha_{N-1}), t^N |p| \prod_{1\leq i\leq N-1}
|\alpha_i|^\frac{1}{2}, 1\big)
$$
 $$
 \qquad = t^{-1}
G_1\big(t^N |p| \prod_{1 \leq i \leq N-1} |\alpha_i|^\frac{1}{2},
sgn(\alpha_1), ..., sgn(\alpha_{N-1})\big). 
$$

\vff

\noindent Now, by the contrast invariance relation (\ref{invariancemorphologiquepourF}) in
Lemma \ref{lemmeinvariancemorphologique}, we also have
$$F(\beta^{-1} A, \beta^{-1}p, t) = \beta^{-1}F(A, p, t),$$
so that
$$
\beta G_1\big(\beta^{-1} t^N |p| \prod_{1\leq i\leq N-1}|\beta^{-1}\alpha_i|^\frac{1}{2},
...\big) = 
G_1\big(t^N |p| | \prod_{1\leq i\leq N-1}\alpha_i|^\frac{1}{2}, ...\big).
$$ 
Choosing 
$\beta = \big(t^N |p| \prod_{1 \leq i \leq N-1}
|\alpha_i|^\frac{1}{2})\big)^{\frac{2}{N+1}}$, 
the function $F$ is
reduced to a power function
 $$F(A, p, t) = t^\frac{N-1}{N+1} | p
|^{\frac{2}{N+1}}
 \;\; | \prod_{1 \leq i \leq N-1} \alpha_i|^{\frac{1}{N+1}} \;\;\; 
G_1\big(1, sgn(\alpha_1), ..., sgn(\alpha_{N-1})\big) \;$$
$$ \qquad = t^\frac{N-1}{N+1} |p|^{\frac{2}{N+1}}
 | \prod_{1 \leq i \leq N-1} \alpha_i|^{\frac{1}{N+1}} \;\;\; 
H_1\big( sgn(\alpha_1), ..., sgn(\alpha_{N-1})\big)$$
for some function $H_1$.
\vff
Since $\lambda_i$ $( = \alpha_i / | p|) $, we finally obtain

$$
F(A, p, t) = t^\frac{N-1}{N+1} |p|^{\frac{2}{N+1}} |p|^\frac{N-1}{N+1} | \prod_{1 \leq i \leq
N-1} \lambda_i |^{\frac{1}{N+1}} \;\;
 H_1\big(sgn(\lambda_1), ...,
sgn(\lambda_{N-1})\big),
$$
which yields
$$F(A, p, t)= |p| t^\frac{N-1}{N+1} 
\prod_{1 \leq i \leq N-1} |\lambda_i|^{\frac{1}{N+1}} \;\;\;
H_1\big(sgn(\lambda_1), ..., sgn(\lambda_{N-1})\big).$$

Now, $H_1$ must satisfy some properties~:
Since $T_t$ is invariant by rotation, $H_1$ must be symmetric with respect to its
variables. Because of the term $(\prod_{1\leq i\leq N-1}|\lambda_i|^\frac 1{N+1}$, we are
allowed to set $H(\sgn(\lambda_1), ..., \sgn(\lambda_{N-1}))=0$ if some $\lambda_i$ 
vanishes.
If all $\lambda_i$ are nonzero, $H_1(sgn(\lambda_1), ...,
sgn(\lambda_{N-1}))$  therefore only depends on the number of $\lambda_i$'s which are negative
and therefore upon the sum~: 
$\sum_{1\leq i \leq N-1} sgn(\lambda_i) )$. Thus
$$H_1\big(sgn(\lambda_1), ..., sgn(\lambda_{N-1})\big) = 
H\big(\sum_{1\leq i \leq N-1} sgn(\lambda_i) \big).$$
It is finally easy to see, by changing $u$ into $-u$ and using the assumption $T_t(-u)
=-T_t(u)$ and the regularity relation (\ref{regularite}), that
$H$ satisfies $H(i) = - H(-i)$. At last, we know that $H$ is a
nondecreasing function, since $F$ is nondecreasing with respect to $A$.
\newline\newline
To summarize, we have
\fb& \label{formegenerale}
F(A, p, t)= |p| t^\frac{N-1}{N+1} 
\prod_{1 \leq i \leq N-1} |\lambda_i|^{\frac{1}{N+1}} \;\;\;
H\big(\sum_{1\leq i \leq N-1} sgn(\lambda_i) \big),
\fe&
where $H$ is a nondecreasing real function such that $H(i)=-H(-i)$.
\newline\newline


\noindent {\bf the case $N=2$.} \newline
In that case, $N-1=1$ and we deduce from (\ref{formegenerale}),
$$F(A, p, t) = t^{\frac 1 3}|p| (\frac 1 {|p|}A(\frac {p^\perp}{|p|}, \frac
{p^\perp}{|p|}))^\frac 13.
$$
Returning to the scale space equation, we have $p = Du$, $A=D^2u$ and 
$\curv(u) = \frac 1{|Du|} D^2u(\frac {Du^\perp}{|Du|}, \frac
{Du^\perp}{|Du|})$, so that
the associated scale space equation is 
$$
\frac {\partial u}{\partial t} = F(D^2u, Du ,t) = |Du|(\curv(u))^\frac 13.
$$
We retrieve, as was to be expected, the equation (\ref{AMSS}).
\newline
\newline
\noindent {\bf The case  $N=3$.}\newline
The equation we   obtain is
$$ \ut& = | Du | t^\frac{1}{2} | \lambda_1 \lambda_2 |^\frac{1}{4}
H\big(sgn(\lambda_1)+ sgn(\lambda_2)\big) $$ where $\lambda_1$ and
$\lambda_2$ are the principal curvatures of the level surface. Their
product is nothing but the Gauss curvature $\Gaussiancurv (u)$ of
the level surface of $u$, so that we can write $$ \ut& = | Du | t^\frac{1}{2}
|\Gaussiancurv (u)|^\frac{1}{4}
 H\big(sgn(\lambda_1)+ sgn(\lambda_2)\big) $$
Since $sgn(\lambda_1)+ sgn(\lambda_2)$ can only take three values~: -2, 0, 2, and
using $H(-2) = -H(2)$, we can write
$$ H(2) = - H(-2) = b \geq 0 \qquad H(0) = a \qquad \hbox{ and} \qquad | a | \leq
b$$ Now,  $F(A, Du, t)$ must be nondecreasing
with respect to $A$ and therefore with respect to the curvatures $\lambda_1$ and
$\lambda_2$. It is easy to check, by taking particular values for $\lambda_1$ and
$\lambda_2$ that $a$ must be equal to $0$.  Indeed, if we choose two pairs of
$\lambda_i$~: $(-1, \alpha)$ and $(\alpha, \alpha)$, for some $\alpha$ real and
positive, then $F$ must be larger for the second pair than for the first one, so that $$\alpha
H(0) \leq \alpha^2 H(2)$$ Letting $\alpha$ tend to 0, we obtain $H(0) = a \leq 0$. By choosing
the two pairs $(-\alpha, \alpha)$ and $(-\alpha, 1)$ we obtain in the same way $H(0) = a
\geq 0$. Thus $a=0$. The consequence is that when the principal curvatures have
opposite signs, then $F( A, Du, t)$ is equal to zero. At last, we obtain, up to a
multiplicative constant for the second member, the equation

\fb& \ut& =  sgn(\lambda_1) \; | Du |  t^\frac{1}{2}
\big((\Gaussiancurv (u))^+\big)^\frac{1}{4} \fe& where $x^+$ stands for $\sup( 0,
x)$.\notation
 This equation describes the unique multiscale analysis in dimension 3 which
is both affine and contrast invariant and satisfies $T_t(u) = -T_t(-u)$.
\newline\newline
{\bf The case of arbitrary dimension $N$.}
The same argument as dimension 3 is easily extended in any dimension and yields Equation
(\ref{Mor99}), where $H$ is defined by
$$ H(N-1) =  - H(-(N-1)) = 1 \qquad \hbox{ and } \forall i \in Z\!\!\!Z,\;
|i|\neq N-1,  \;\;\; H(i) = 0$$
In other terms, $H$ is equal to zero if all the $\lambda_i$ have not the same sign.
 \endproof


\newpage

\zbibnote

In this chapter, we followed an axiomatic presentation of scale spaces developped
in \cite{Alvarez:1993:AFE}, which is a simplified version of the original
\cite{Alvarez:1993:AFE, Guichard:1994:AAM}
Other axiomatics for the affine scale spaces have been proposed by 
Olver et al. \cite{Olver:1996:AIG, Olver:1997:IGE}.
The first complete mathematical study on the motion of a surface by its
mean curvature is Brakke \cite{Brakke:1978:MSM}.
The main concern of scale space theory is : how regular is a surface which is
smoothed by the mean curvature motion ? Huisken\cite{Huisken:1984:FMC}
proved that the smooth motion of a convex surface ended into a sphere before 
vanishing to a point, generalizing to more dimensions a Gage result for curve 
evolution. The question of whether a curvature motion ended or not into a sphere
had been first considered by Firey for the Gauss curvature motion.
Osher and Sethian developped the first numerical codes for 
the motion by mean curvature, where topological changes of the surface could
be dealt with efficiently.
Yuille \cite{Yuille:1988:CSD} notices that the Koenderink-Van Dorn  Dynamic Shape algorithm
can create singularities in a dumb-bell shapes surface, the thin central
 part evolving into two 
separate pinches. This contradicts the main causality axiom in Scale Space : no creation
of new features in the shape. See the comments by Koenderink \cite{Koenderink:1989:HUS}.
The corresponding mathematical study of the phenomenon is due to Grayson \cite{Grayson:1989:SNE}.
Gradient bounds for the mean curvature equation are given in Barles \cite{Barles:1991:IGB}.
A general survey of singularity formation by mean curvature is made in 
Angenent \cite{Angenent:1992:SRR} and \cite{Altschuler:1995:MCF} prove the smoothness
of the evolution of rotationally symmetric hypersurfaces, estimating the number of 
singularity points.  On the theme of regularity and singularities by mean curvature flow, see also
\cite{Evans:1997:RFN,  Angenent:1997:DNM, Huisken:1997:SMC, Ilmanen:1998:ESG}.
Ishii and Souganidis \cite{Ishii:1995:GMN} made a general theory of viscosity solutions
for curvature equations of any type, including any power functions of the curvature and 
the gaussian curvature.
A particular mention must be made of the Caselles et al. \cite{Caselles:1996:WBC}
on the properties of scale spaces in three dimension. They prove that the neckpinches
do not occur in the dumb-bell by the affine scale space but show other examples
of surfaces where  anyway singularities may appear.
Chow \cite{Chow:1985:DCH, Chow:1987:DCH} proved  that the affine scale space deforms 
strictly convex surfaces into spheres, a result equivalent to the above mentionned
 Huisken result for the mean curvature motion.
\newline

\noindent{\bf Extensions  of the affine scale space in two dimensions}
Several authors have made attempts to get in two dimensions a scale space still more invariant
than the affine scale space, namely a projectively invariant scale space
Clearly, the results of this chapter show that no local and causal multiscale analysis can 
be projective invariant : we pointed out that asking affine invariance exhausted 
all degrees of freedom in the choice of the partial differential equation.
Thus, one of the requirements must be given up.
Faugeras and Keriven
\cite{Faugeras:1994:CMF, Faugeras:1995:ACA, Faugeras:1995:SRR, Faugeras:1995:SSA}
and Bruckstein and Shaked \cite{Bruckstein:1997:PIS}
 give
up the maximum principle, but get higher order partial differential equations which can hardly 
be considered as smoothing equations.  Mathematical existence proofs and numerical simulations 
of this projective curve scale space are open problems. See also Olver et al.
\cite{Olver:1994:CUI}.
Dibos \cite{Dibos:1998:PAD, Dibos:1995:AMI} does not give up locality or causality
and is able to simulate numerically her scale space.  This scale space
does not depend anymore upon a single scale parameter, but on two.
Geraets et al. \cite{Geraets:1995:ASS, Geraets:1995:ORA} propose affine invariant scale spaces for 
discrete sets and applications to object recognition.
One of the first attempts to use the AMSS model for affine invariant shape recognition
is Cohignac et al. \cite{Cohignac:1994:ILA}. A more complete and sophisticate attempt 
is \cite{Lisani:2000:AIM} which performs image comparison by applying the 
affine scale space to all level lines of each image.
Alvarez and Morales
 \cite{Alvarez:1997:AMM} used the affine scale space for corner  and T-junction detection in digital images. 


\chapter{Scale spaces of shapes \label{Shapes} \label{chapter20}}
\thispagestyle{empty}

\section{\label{Shapeprinciples}All shape scale  spaces.} 

\index{Shape scale-space}

In this section, we  shall list four principles which a shape scale space (identified with
a curve scale space) should satisfy.  We shall prove that a shape scale space must,
according to these principles, be a curvature motion equation whose form is slightly more
general than the intrinsic heat equation. For some of the principles discussed here, it
will be useful to consider both a Jordan curve and the bounded set $\Xbol$ surrounded by the
Jordan curve. So we call {\it shape or silhouette} any bounded closed set   $\Xbol$ whose
boundary is a Jordan curve of $\real ^2$. 
 We denote by $T_t(\Xbol)$  the  {\it shape of $\Xbol$ analysed at scale} $t$.    We call
shape scale space any family of operators
$(T_t)_{t \ge 0}$  acting on shapes and set $\Xbol(t)=T_t(\Xbol)$. 
  

\rm As in  Chapter \ref{Scalespace}, we suppose that the operators
$T_t$ satisfy a pyramidal assumption, $T_t = T_{t,s}T_s$. We now
consider a translation in the shape  analysis framework of the other
basic assumptions made for image scale space. The next assumption is an adaptation to
shape analysis of the local comparison principle.



\skipaline
We  denote by $B(\xbol,r)$ the open disk with center $\xbol$ and radius $r$, and
for a shape $\Xbol$, by $ \partial \Xbol$ the boundary of $\Xbol$.
 Assume that $\Xbol$ and $\Ybol$ are two compact shapes and that for some
 $\xbol \in \partial \Ybol$ and some $r>0$,
 one has $\Xbol \cap B(\xbol,r) \subset \Ybol\cap B(\xbol,r)$.
  Assume further that the inclusion is strict in the sense that
 $\partial \Xbol$ and $\partial \Ybol$ only meet possibly at $\xbol$.
  Then we shall say that {\it the shape } $\Xbol$ {\it is included in shape} $\Ybol$ {\it
around} $\xbol$.  

\index{Shape preserving principles}
\skipaline \index{Shape local inclusion principle}
\begin{Defi} \label{definitionshapelocalinclusionprinciple}
\noindent We say that $T_t$ satisfies the {\tt [Shape local inclusion principle] \rm}, if  for all $\Xbol$ and $\Ybol$ subsets of $\real^2$ such that $\Xbol$ is included in $\Ybol$ around
$\xbol$,
 then for $h$ small enough, $T_{t+h,t}(\Xbol) \cap B(\xbol,r) \subset T_{t+h,t}(\Ybol)\cap B(\xbol,r)$.
\end{Defi}

\LOCINCLUS
\skipaline
This  axiom has two aspects~: First, it implies that the value of $T_{t+h,t}(\Xbol)$ for $h$
small,
 at any point $\xbol$, is determined by the behaviour of $\Xbol$ near $\xbol$.
Second, taking two shapes $\Xbol\subset\Ybol$, it implies for $r$ large enough that 
$T_{t+h,t}(\Xbol)  \subset T_{t+h,t}(\Ybol)$, that is, a {\tt Global inclusion
principle\rm}. \index{global inclusion principle}
Both
preceding principles allow, as we shall see,
 to localize the shape analysis process in space and scale. In order to totally specify
a scale space, we only need, as we shall prove, to say what the scale space makes of very
simple shapes.  We add two  principles which state what happens
 to disks.  Thanks to the local inclusion principle, disks will appear as the ``basis" on
which every more complex
 shape can be decomposed~: When we know what happens to disks in scale space, we can deduce
the destiny of every other shape !


\skipaline \index{isotropy}
\noindent {\tt [Isotropy] \rm} Let $D=D(\xbol,1/r)$ be a disk with curvature
$1/r$ and center $\xbol$.
  Then $T_{t+h,t}(D)$ is a disk with radius $\rho (t, h,1/r ) $ and center
$\xbol$.

\skipaline \index{regularity}
\noindent {\tt [Regularity] \rm} For all $t,r,h>0$, function $h \rightarrow \rho(t,h,1/r)
$ is differentiable with
 respect to $h$ at $h=0$ and the derivative
$
g(t, 1/r) = \frac{\partial \rho}{\partial h}(t, 0, 1/r)
$ is continuous with respect to $1/r$ and has a limit $g(t,0)$ as $r\to \infty$.

\skipaline  The last assumption, that $g(t,0)$ exists, is no serious restriction in view
of the next lemma.

\begin{lem} The function 
$g(t, \kappa) = \frac{\partial \rho}{\partial h}(t,0,\kappa)$
 is nondecreasing with respect to $\kappa$.
\end{lem}
\paragraph{Proof}
Let $r>r'$, set $0=(0,0)$ and $a=(r-r',0)$ and consider the disks $D=D(0,r)$ and  
$D'=D(a,r')$, which are tangent at $\fxx = (r,0)$. By the isotropy principle, $T_{t,t+h}D$
is a disk with center $0$ and radius $\rho(t,h,\frac 1 r)$ and $T_{t,t+h}D'$ a disk with
center $a$ and  radius $\rho(t,h,\frac 1 {r'})$.
 By the shape local inclusion principle, the second disk is contained is the first, which
implies $r'-\rho(t,h,\frac 1 {r'})\geq r-\rho(t,h,\frac 1 {r})$.  Dividing this relation
by $h$ and letting $h\to 0$ yields by the regularity assumption
$$
g(t, \frac 1{r'})=\frac{\partial \rho}{\partial h}(t,0,\frac 1{r'})\geq 
\frac{\partial \rho}{\partial h}(t,0,\frac 1{r})=g(t,\frac 1 r).
$$  
Setting $\kappa '= \frac
1 {r'}$ and
$\kappa = \frac 1 r$ we obtain 
$$\kappa'\geq \kappa\Rightarrow g(t,\kappa')\geq g(t,\kappa).$$
\enddemo

\skipaline
The last shape preserving principles which we shall consider here are the scale
invariance and   the affine invariance of the shape scale space. Define $\Abil \Xbol = \{
\Abil\fxx, \fxx \in
\Xbol\}$ for any linear map $\Abil$. 

\skipaline
\noindent {\tt [Affine invariance]\rm}. \rm	 There exists a $C^1$ function 
$t'(t,\Abil) \ge 0$ defined for any $\Abil $    and $t \ge 0$, such that
 $\Abil T_{t'(t,\Abil),t'(s,\Abil)}=T_{t,s}\Abil$.
In case where  we restrict this last relation to homotheties, we shall say that the scale
space is {\it scale invariant}.
By using Lemma {\ref{Nsc}, we can always take $t'(t,\Abil)=t.\vert
det \Abil\vert ^{1/2}$   up to a rescaling, so that we finally write.
\fb&
\label{affineinvariancescalespace}
\Abil T_{t.\vert \det \Abil\vert ^{1/2},s.\vert \det \Abil\vert ^{1/2}}=T_{t,s}\Abil .
\fe&
    
\skipaline
Let $\fxx(s)$ be a curve parameterized by length.  We recall that in
Definition \ref{parametrisationseuclidiennes} we have defined an intrinsic curvature
vector  $Curv \fxx(s))$. The modulus of the curvature vector  can be interpreted 
 as the inverse of the radius of the osculatory circle to the curve at $\fxx(s)$.
  The curvature is zero if the radius is infinite.
  When $Curv \fxx(s)\neq 0$, the intrinsic normal vector $\nbol(\fxx)(s)=\frac{Curv
\fxx(s)}{|Curv
\fxx(s)|}$ has norm one and can be defined in more geometric terms as the unit vector normal
to the curve and pointing  towards the concavity of the curve.

\begin{th1} \label{shth1} 
 (i) Let  $T_t$ be a shape scale space satisfying the  four
shape analysis principles (pyramidal architecture, shape local inclusion, isotropy and
regularity). Consider an initial Jordan curve $\fxx_0(s)$. Then at each point $(t,s)$ around
which
$\fxx(t,s)=(T_t\fxx_0)(s)$ is differentiable with respect to $t$ and $C^2$ with respect to
an euclidean parameter $s$,
$\fxx(t,s)$ satisfies a curvature equation
 \fb&
 \label{Eq1}
\frac {\partial \fxx}{\partial t}(t,s)= g(t,|Curv \fxx(t,s)|)\nbol(t,s).
\fe&
 where $\kappa \to g(t,\kappa)$ is a nondecreasing function.

\noindent (ii) If in addition the scale space is affine invariant, 
then the equation of the scale space is
\fb& \label{(Eq1.5)}
%§label Eq1.5
\frac {\partial \fxx}{\partial t}(t,s)=(t|Curv \fxx(t,s)|)^\frac{1}{3}\nbol(t,s).
\fe&
With obvious abbreviations, we shall write this last equation
 \fb&
 \label{(Eq2)}
\frac {\partial \fxx}{\partial t}= (t.Curv(\xbol))^\frac{1}{3}\nbol(\xbol) 
\fe&
and call it Affine Scale Space (A.S.S.) \index{affine scale-space of shapes}
  \end{th1}



\paragraph{Proof}

\noindent  The proof of (i) is essentially identical to the proof of Theorem
\ref{A-P}~: Instead of inserting locally the image function  between two
quadratic forms, we shall insert locally the curve $s\to \fxx(t,s)$ between two circles
(surosculator and  subosculator) for which we know the infinitesimal evolution by the
isotropy and regularity principles.
Denote by  $X(t)$ the compact plane set whose boundary is the curve $\fxx(t,s)$.
Let $\fxx$ be a point of this curve.  We shall also when convenient denote this point
by $\fxx(t)$.  Let us consider a subosculatory and
 a surosculatory disk to the curve at $\fxx$.  One is the closed disk $D'$ with radius $r =
\frac 1{\kappa -\epsilon}$ and the other one the closed disk
 $D$ with radius $r=\frac 1{\kappa+\epsilon} $ and both are tangent to the curve
$\fxx(t,s)$ at
$\fxx$. (In the case where $\kappa = 0$, we simply take for $D'$ the half plane tangent to
the shape at $\fxx$ containing $D$ . This does not alter what follows). Let 
$B(\fxx, r)$ be a disk with $r$ small enough so that $D\cap B(\fxx,r)\subset
X(t)\cap B(\fxx,r)\subset D'\cap B(\fxx,r)$ and  $\partial D$, $\partial D'$ and the
curve $\fxx(t,s)$ only meet at $\fxx$ inside $B(\fxx,r)$. Applying the local inclusion
principle, we deduce that 
$$
T_{t+h,t}(D)\cap B(\fxx,r) \subset T_{t+h,t}(X) \cap  B(\fxx,r) \subset T_{t+h,t}(D')\cap
B(\fxx,r).
$$
  Thus, denoting by $\fxx(t+h)$ the point of $\partial T_{t+h}(X)$
 such that $\fxx(t+h) -\fxx(t,s)$ is parallel to $\nbol(\fxx(t,s))$, we obtain
$$\rho (t, h, \kappa- \epsilon ) -\rho (t, 0, \kappa -\epsilon ) \le
(\fxx(t+h)-\fxx(t)).\nbol(\fxx(t)) \le \rho (t, h,\kappa +\epsilon ) -\rho (t, 0,\kappa
+\epsilon )$$
  Dividing by $h$ and passing to the inf- and sup-limits when $h$ tends to $0$
 yields 
$$
\frac{\partial \rho}{\partial h}(t,0,\kappa -\epsilon) \le \liminf_{h\to 0}
\frac{\fxx(t+h)-\fxx(t)}{h}.\nbol(\fxx(t))\leq 
$$
$$
 \limsup_{h\to 0} \frac{\fxx(t+h)-\fxx(t)}{h}.\nbol(\fxx(t)) \le \frac{\partial
\rho}{\partial h}(t,0,\kappa +\epsilon)
$$ 
 By the regularity principle,
 $\kappa \rightarrow \frac{\partial \rho}{\partial h}(t,0,\kappa )$ is continuous. Passing
to the limit when $\epsilon $ tends to $0$,
 \fb& 
\frac {\partial \fxx(t)}{\partial t}(.\nbol(\fxx)(t)= g(t,|Curv \fxx(t)|),
\fe&
which yields Equation \ref{Eq1} because by assumption $\frac {\partial \fxx(t)}{\partial
t}$ is colinear to $\nbol(\fxx(t))$.  

\noindent (ii) After renormalization, we can use the identity
$$ T_{t+h,t}D_{\lambda }=D_{\lambda }T_{(t+h)\lambda ,t\lambda}$$, where
$D_{\lambda}=\lambda Id$.  We deduce that the function $\rho$ of the basic principle must
satisfy
$\rho (t,h,\frac {\lambda}r)=\frac 1{\lambda}\rho(\lambda t,\lambda h,1/r)$ 
After differentiation with respect to $h$ at $0$, we obtain
$$g(t,\lambda s)=g(\lambda t,s)$$ for any $t>0$, $\lambda >0$ and $s \in \real$.
Changing $t$ in $t/ \lambda $ and taking $\lambda =1/t$ we get $g(t,s)=g(1,ts)=\beta (ts)$,
$\beta$ being defined as $\beta (x)=g(1,x)$. Let us now use the full affine invariance. 
After renormalization, we can use the identity 
$T_{t+h,t}A=AT_{t+h,t}$, where $A$ is the linear transform with determinant equal to 1,
$$(x,y) \rightarrow ({\lambda} x,\frac y\lambda), \; \; \lambda>0$$
Let us apply the identity $T_{t+h,t}AD=AT_{t+h,t}D$ to the unit disk $D=D(0,1)$.Consider the
point
$x_0=(1,0)$ on the boundary of $D$. The velocity by $T_t$ of $x_0$
is $(-\beta (t),0)$, and this velocity is transformed by $A$ into $-\lambda \beta(t)$.
  Since $AD $ is an ellipse with curvature
 $\lambda ^{3}$ at point $Ax_0$, the velocity of $Ax_0$ is $(-\beta (t.\lambda ^{3}),0)$.
So we obtain $\beta (t.\lambda ^{3})=\lambda \beta(t)$.   
Taking $t=1$, we get $\beta (x)=a.x^{1/3}$  with($a=\beta (1)$). 
\enddemo


\input{LATEX/appendice.tex}

\zbibnote
{\bf The need for a multiscale curvature in shape analysis}
\newline

Global shape recognition is relatively easy by normalization algorithm, which singles out
 in 
each equivalent class of shapes a  unique representative. Invariant comparison 
of two shapes boils then
down to a comparison of both invariant representatives.  Affine normalization, and 
even projective normalization can be made for invariant shape recognition \cite{Astrom:1994:APN, Rothwell:1993:RUP, 
Rothwell:1995:POR}. See also \cite{Kempenaers:1991:SRU}. A relatively efficient 
comparison of clouds of points can also be performed by geometric hashing
\cite{Hummel:1988:AIM} or by Hough transform \cite{Hough:1962:MMR} 
 Now, most shapes under recognition undergo distorsions and occlusions
which reduce the efficiency of global comparison methods. 
Such methods assume that the shapes undergoing a recognition process are in good shape.
This is seldom the case with shapes extracted by a computer program from a digital image.
Thus, the smoothing of shapes and their comparisons parts by parts are necessary. This
is the main reason of the development of shape scale spaces.
The problem of defining an efficient shape scale space 
is adressed in the early works of Asada and Brady \cite{Asada:1986:CPS},
Horn et Weldon \cite{Horn:1986:FCC}, Lowe \cite{Lowe:1988:OSI}
 and Mackworth-Mockhtarian \cite{Mackworth:1986:SBD}.  After these papers, the 
 search for a good definition of a multiscale curvature has been 
aknowledged as the key to efficient shape recognition :
Dudek, \cite{Dudek:1989:UCI, Dudek:1991:SMC, Dudek:1994:SDC, Dudek:1997:SRR},
Mackworth and Mokhtarian\cite{Mackworth:1992:TMC}, Cohignac
 \cite{ Cohignac:1994:ILA}, Williams \cite {Williams:1992:FAA}, Mokhtarian \cite{F:1993:MST},
Lisani et al. \cite{Lisani:2000:AIM}.

{\bf Morphology and structural decompositions of shapes}
We do not treat here two other ways to analyse a shape, one called {\it structural analysis}
whose aim it is to decompose the shape into its significant parts and the other one
using the shape's skeleton. In both cases, however, scale space is called to help since
skeletonization is made by multiscale erosions and shape structural decompositions by
openings, closings, erosions, dilations, and their differences at different scales 
\cite{Nacken:1994:OCI, Okada:1996:MSS, Pitas:1987:SDM, Zhao:1991:MHM}. See also
Maragos definition of a pattern spectrum \cite{Maragos:1989:PSM}.
The work of Kimia, Tannenbaum and Zucker \cite{Kimia:1992:ECF, Kimia:1995:SSD}
can be viewed as a synthesis of 
\newline
\newline
{\bf Mathematical proofs of scale space properties}
As we already mentionned, the proof that curvature motion in dimension 2 is a perfect
scale space was made from the mathematical point view by
Gage\cite{Gage:1984:CSM}, Gage and Hamilton \cite{Gage:1986:HESb}
and Grayson \cite{Grayson:1987:HESb}
The mathematical arguments for existence and uniqueness of the solutions of the 
Affine Morphological Scale Space were given in Alvarez et al. {Alvarez:1993:AFE} in the
viscosity framework and by Angenent et al. \cite{Angenent:1998:AHF} for the 
affine curve shortening.
The evolution of convex curves had 
been studied in Sapiro \& Tannenbaum \cite{Sapiro:1993:ICE, Sapiro:1994:APC}.
\newline
\newline
{\bf Axiomatics of shape scale spaces}
\newline
Our presentation of the requirements for the shape scale space
 follows a simplified version first proposed in \cite{Lopez ?}, which 
emphasizes the shape inclusion principle as the main axiom, following
the mathematical view of De Giorgi and his disciples \cite{Sapiro:1995:ALP}.
Olver, Sapiro and Tannenbaum have proposed an alternative axiomatics based
on the concept of invariant heat flow \cite{Olver:1994:CUI}.

