From: Bjørn Rustad Date: Fri, 28 Mar 2014 20:03:56 +0000 (+0100) Subject: More fixes X-Git-Url: http://git.rustad.me/?a=commitdiff_plain;h=1b3b0c519e6fb603deddf4bbced13bdcf097b4a2;p=prosjektoppgave More fixes --- diff --git a/total.tex b/total.tex index 89a901c..268255f 100644 --- a/total.tex +++ b/total.tex @@ -1,27 +1,17 @@ -% Dette eksempelet er laget for article-dokumentklassen. Hvis -% skriver i 'book'-dokumentklassen vil du kanskje bytte ut -% \section med \chapter, \subsection med \section, osv... - \section{Total variation} -The method of total variation was initially introduced to image -restoration by L. Rudin, S. Osher, and E. Fatemi in -\cite{rudin1992nonlinear}, but is also used in numerous other -applications. One of its strong theoretical points is its ability to -recover edges, compared to other restoration algorithms which might -smooth over edges in the original image. The method can be formulated as -minimizing the energy function +The image restoration method considered in this project tries to find an +image $u$ which is close to the captured image $v$, while it at the same +time has a low \emph{total variation} by solving \begin{equation} - E_v(u) = - \int_\Omega \abs{u - v}^p - + \beta \TV(u) - \label{eq:energy_function} + \min_u \int_\Omega \abs{u - v}^p + \beta \int_\Omega \abs{\nabla u}. + \label{eq:first_min_presentation} \end{equation} -where $v$ is the original image, and $\Omega$ is the image domain, in -our case an open subset of $\mathbb{R}^2$. Normally, $p$ is chosen to be -1 or 2. +How we can integrate the gradient of an image which can contain +discontinuities will be clarified later, but first we will look at how +this model can be grounded in spatial statistics; \fixme{an important +field in image analysis.} \subsection{Probabilistic background} -\fixme{We discuss pixels here already?} \fixme{The actual expression for the total variation has not been introduced yet!} @@ -32,55 +22,110 @@ how the total variation method can be related to one instance of the so-called maximum a posteriori estimation (MAP for short) of spatial statistics. -We introduce the likelihood $p(u \mid v) \cdot p(u)$ and try to maximize -this in order to obtain our output image $u$. This is equivalent to the -formulation +There are many ways to model noise in an image, and different models +take different physical phenomena into account. We will in this brief +introduction only consider the simplest model, namely \emph{additive +noise}, which given an image $u$ results in a captured image +\begin{equation} + v = u + \epsilon. +\end{equation} + +For a captured noisy image $v$ and we want to recover $u$, or something +as close to $u$ as possible, so we introduce the likelihood function \begin{equation} - \min_u \big( - \ln p(u \mid v) - \ln p(u) \big). + p(u \mid v) = \frac{p(v \mid u) \cdot p(u)}{p(v)} +\end{equation} +using Bayes' theorem. Maximizing this will give us the image $u$ which +is most probable given our noisy image $v$. The \emph{prior} $p(u)$ +represents how probable we think it is to obtain an image like $u$ in +the set of all obtainable images, and $p(v \mid u)$ is our noise model, +how we think a noisy image $v$ is distributed given an image $u$. + +Since $p(v)$ is constant, and the logarithm is a monotonically +increasing function, the maximization problem is equivalent to +\begin{equation} + \min_u \big( - \ln p(v \mid u) - \ln p(u) \big). \label{eq:minimize_neg_log} \end{equation} -If the noise term $p(u \mid v)$ is modeled to be independently and -identically distributed Gaussian noise on each pixel, we have +For discrete images consisting of pixels, we denote use $x$ and $y$ to +denote pixel positions such that $u_x$ and $u_y$ are the values of those +pixels, not to be confused with partial derivatives $\partial_x u$ and +$\partial_y u$. If the noise term $p(v \mid u)$ is modeled to be +independently and identically distributed Gaussian noise on each pixel, +we have \begin{equation} - p(u \mid v) \propto + p(v \mid u) \propto \prod_x \exp \left(-\frac{(u_x - v_x)^2}{2\sigma^2} \right). + \label{eq:gaussian_noise} \end{equation} -The prior $p(u)$ represents how probable we think it is to obtain an -image like $u$. This probability depends on what kinds of images are + +The prior probability $p(u)$ depends on what kinds of images are considered, and how they are obtained. In the theory of Markov random fields, one lets the probability of a pixel value depend only on some -neighborhood $\mathcal{N}$. One common choice for the relation between -neighboring pixels is a Laplace distribution +neighborhood $\mathcal{N}$. A common choice for the relation between +neighboring pixels is the Laplace distribution \begin{equation} p(u) \propto \prod_x \prod_{y \in \mathcal{N}(x)} \exp \left( - \frac{\abs{u_x - u_y}}{b} \right). + \label{eq:laplace_prior} \end{equation} Consult for example \cite{scherzer2008variational} for further reading -on different possibilities for the prior probability. +on noise models and different possibilities for the prior probability. -Taking the logarithm in \eqref{eq:minimize_neg_log} we obtain +Inserting the prior \eqref{eq:laplace_prior} and the noise model +\eqref{eq:gaussian_noise} into \eqref{eq:minimize_neg_log} we obtain \begin{equation} \min_u \left( \sum_x \abs{u_x - v_x}^2 - \beta \sum_x \sum_{y \in \mathcal{N}(x)} \abs{u_x - u_y} \right). - \label{eq:minimizing_probability} + \label{eq:minimizing_probability_l2} \end{equation} -If the noise had been modeled with the Laplace distribution +If the noise is modeled by a Laplace distribution \begin{equation} p(u \mid v) \propto \prod_x \exp \left( - \frac{\abs{u_x - v_x}}{b} \right) \end{equation} -we would have obtained the $L^1$-norm instead of the $L^2$-norm in -\eqref{eq:minimizing_probability}. +we obtain the $L^1$-norm instead of the $L^2$-norm, +\begin{equation} + \min_u \left( + \sum_x \abs{u_x - v_x} + - \beta \sum_x \sum_{y \in \mathcal{N}(x)} \abs{u_x - u_y} + \right). + \label{eq:minimizing_probability_l1} +\end{equation} +We see that the two discrete problems +\eqref{eq:minimizing_probability_l2} and +\eqref{eq:minimizing_probability_l1} resemble the original formulation +in \eqref{eq:first_min_presentation}. Before presenting the +discretization, we will look at a more rigorous presentation of +\eqref{eq:first_min_presentation}, and the definitions, spaces and +theorems needed to treat it. -\subsection{Functional analysis foundation} -\fixme{Meh heading.} +\subsection{Continuous formulation} +The method of total variation was initially introduced to image +restoration by L. Rudin, S. Osher, and E. Fatemi in +\cite{rudin1992nonlinear}, but is also used in numerous other +applications. One of its strong theoretical points is its ability to +recover edges, compared to other restoration algorithms which might +smooth over edges in the original image. The method can be formulated as +minimizing the energy function +\begin{equation} + E_v(u) = + \int_\Omega \abs{u - v}^p + + \beta \TV(u) + \label{eq:energy_function} +\end{equation} +where $v$ is the original image, and $\Omega$ is the image domain, in +our case an open subset of $\mathbb{R}^2$. Normally, $p$ is chosen to be +1 or 2, the two choices that correspond to the two different noise +models in \eqref{eq:minimizing_probability_l1} and +\eqref{eq:minimizing_probability_l2}. -The term $\TV(u)$ is the total variation of the image, and is defined as -follows: +The term $\TV(u)$ is the total variation of the image, introduced +earlier as $\int_\Omega \abs{\nabla u}$, and is defined as follows: \begin{definition}[Total variation] Given a function $u \in L^1(\Omega)$, the total variation of $u$, often written $\int_\Omega \abs{Du}$, where the $D$ is the gradient @@ -88,23 +133,23 @@ follows: \begin{equation} \TV(u) = \int_\Omega \abs{Du} - = \sup \left\{ \int_\Omega u \,\, \mathrm{div} \, \varphi : + = \sup \left\{ \int_\Omega u \cdot \mathrm{div} \, \varphi : \varphi \in C^\infty_c\left(\Omega, \mathbb{R}^2\right), \norm{\varphi}_{L^\infty(\Omega)} \leq 1 \right\}. \end{equation} The test functions $\varphi$ are taken from - $C^\infty_c\left(\Omega, \mathbb{R}^N\right)$, the space of smooth - functions from $\Omega$ to $\mathbb{R}^N$ with compact support. + $C^\infty_c\left(\Omega, \mathbb{R}^2\right)$, the space of smooth + functions from $\Omega$ to $\mathbb{R}^2$ with compact support. \fixme{$\Omega$ open, bounded, Lipschitz boundary?}. \end{definition} -Minimizing the total variationn will smooth out differences in the -image. The term $\int_\Omega \abs{u - v}^p$ of -\eqref{eq:energy_function} will constrain the solution image $u$ to be -close to the input image $v$. Combining the two will give us an image -close to the original, but more regular. The parameter $\beta$ controls -how strongly we want to regularize the image. +Minimizing the total variation will smooth out differences in the image. +The term $\int_\Omega \abs{u - v}^p$ of \eqref{eq:energy_function} will +constrain the solution image $u$ to be close to the input image $v$. +Combining the two will give us an image close to the original, but more +regular. The parameter $\beta$ controls how strongly we want to +regularize the image. When discretizing the energy function \eqref{eq:energy_function} later on, we want to decompose it as a sum over the different levels, or pixel @@ -156,7 +201,7 @@ with different numerical methods for solving it. Results on how the set of jumps in the resulting image $u$ is contained in the set of jumps in the original image $v$ are also presented. -\subsection{Discrete problem} +\subsection{Discrete formulation} Since digital images are given on a discrete grid, with values taken from a discrete and finite set of levels, we want to discretize \eqref{eq:energy_perimeter}, and solve the resulting discrete problem.