From: Bjørn Rustad Date: Sun, 8 Feb 2015 20:10:53 +0000 (+0100) Subject: FIXIN X-Git-Url: http://git.rustad.me/?a=commitdiff_plain;h=833ac02faac6df517e8bb0bdc012096572e49591;p=master FIXIN --- diff --git a/appendix.tex b/appendix.tex index c449181..a7381cc 100644 --- a/appendix.tex +++ b/appendix.tex @@ -2,3 +2,5 @@ \fixme{THIS SHOULD NOT BE INCLUDED ANYMORE!} +\inputminted{c++}{../image-restoration/graph.cpp} + diff --git a/continuous.tex b/continuous.tex index 330fc6c..d05c3e0 100644 --- a/continuous.tex +++ b/continuous.tex @@ -88,8 +88,8 @@ present the formal definition of the anisotropic total variation. \end{equation} \label{def:extended_tv} \end{definition} -\nomenclature{$\TVA(u)$}{Anisotropic total variation of image $u$ given -the anisotropy tensor $A$}% +\nomenclature{$\TVA(u)$}{Anisotropic total variation of $u$ given +anisotropy tensor $A$}% With this extended definition, we have arrived at a minimization problem where we seek to find a minimizer of the functional @@ -129,6 +129,24 @@ $\mathbb{R}^2$. The smoothing parameter $\sigma$ is called the \emph{noise scale}, and it controls the scale at which details are considered to be noise. +\begin{figure} + \centering{} + \begin{subfigure}[b]{0.45\textwidth} + \includegraphics[width=\textwidth]{fig/factory/finger/n_q200.png} + \end{subfigure} + ~ + \begin{subfigure}[b]{0.45\textwidth} + \includegraphics[width=\textwidth]{fig/factory/finger/r_p2_n32_b15000_g150_r20_s3_edge.png} + \end{subfigure} + \caption[The edge detector $\abs{\nabla f_\sigma(x)}$]{% + A noisy fingerprint on the left, and the largest eigenvalue of + the structure tensor is $\abs{\nabla f_\sigma(x)}^2$ on the + left, which---as we can see---functions as an edge + detector. + } + \label{fig:edges} +\end{figure} + As seen in Figure~\ref{fig:edges}, the edge detector is fine for detecting edges, but it can not give us information about larger structures, like corners and textures, which is why we introduce @@ -153,24 +171,6 @@ the \emph{integration scale}, controls the size of the neighborhood which affects the structure tensor. Thus it defines the size of the structures we want our anisotropy tensor to be sensitive to. -\begin{figure} - \centering{} - \begin{subfigure}[b]{0.45\textwidth} - \includegraphics[width=\textwidth]{fig/factory/finger/n_q200.png} - \end{subfigure} - ~ - \begin{subfigure}[b]{0.45\textwidth} - \includegraphics[width=\textwidth]{fig/factory/finger/r_p2_n32_b15000_g150_r20_s3_edge.png} - \end{subfigure} - \caption[The edge detector $\abs{\nabla f_\sigma(x)}$]{% - A noisy fingerprint on the left, and the largest eigenvalue of - the structure tensor is $\abs{\nabla f_\sigma(x)}^2$ on the - left, which---as we can see---functions as an edge - detector. - } - \label{fig:edges} -\end{figure} - The smoothed tensor $S_\rho(x)$ can easily be verified to be symmetric positive semi-definite, just like $S_0(x)$. In addition, when $\rho > 0$, the elements of $S_\rho$ are smooth maps from $\Omega$ to @@ -539,8 +539,8 @@ can conclude that we have existence from \cite[Theorem \section{Anisotropic coarea formula} -The anisotropic coarea formula we will present here allows us to write -the anisotropic total variation as an integral over the levels of the +The anisotropic coarea formula we present here will allow us to write +the an\-isotropic total variation as an integral over the levels of the image. For a similar presentation of the regular coarea formula for all $f \in \BV(\Omega)$ see \cite{evans1991measure}. @@ -570,10 +570,6 @@ image $u \geq 0$ as an integral over all the layers Note that \eqref{eq:positive_int} only holds for non-negative images, which complicates the proof of the anisotropic coarea formula a little. -\begin{figure} - \input{fig/eta_r} -\end{figure} - \begin{theorem}[Anisotropic coarea formula] Given an image $u \in \BV(\Omega)$, the anisotropic total variation can be written as an integral over all the levels @@ -703,6 +699,9 @@ integration theory see for example \cite{bartle1995elements}. \end{cases} \end{aligned} \end{equation} + \begin{figure}% + \input{fig/eta_r}% + \end{figure}% visualized in Figure~\ref{fig:eta_r_both}. By composing the function $\eta_r$ with our image $u$ and using Green's formula, for example from \cite[Corollary @@ -822,7 +821,7 @@ The transformation is motivated by our upcoming anisotropic Cauchy--Crofton integration formula, and the discretization, where an approximation of the perimeter will be computed using a graph cut machinery. -\section{Cauchy--Crofton formulas} +\section{Anisotropic Cauchy--Crofton formula} \begin{figure} \input{fig/line_param} @@ -850,10 +849,10 @@ Cauchy--Crofton formula. Note that the measure $d\mathcal{L}$ is invariant under rotations. \nomenclature{$\mathcal{L}$}{The set of all straight lines in the plane}% -\nomenclature{$\ell_{\phi, \rho}$}{A line given by the angle of the -normal $\phi$ and the distance to origin $\rho$}% -\nomenclature{$\ell_{\nu, \rho}$}{A line given by a tangent vector $\nu$ -and the distance to origin $\rho$}% +\nomenclature{$\ell_{\phi, \rho}$}{Line given by angle of normal +$\phi$ and distance to origin $\rho$}% +\nomenclature{$\ell_{\nu, \rho}$}{Line given by tangent vector $\nu$ +and distance to origin $\rho$}% \begin{theorem}[The Euclidean Cauchy--Crofton formula] Given a differentiable curve $C$ in $\mathbb{R}^2$, the length of this curve $\abs{C}$ is related to the set of lines $\mathcal{L}$ as @@ -875,7 +874,7 @@ $\langle a, b\rangle_M = \langle a, M(x) b \rangle$, then the length of a curve $\gamma$ parametrized by some parameter $t$ becomes \nomenclature{$M(x)$}{The metric tensor}% \nomenclature{$\abs{C}$}{The length of the curve $C$}% -\nomenclature{$\abs{C}_M$}{The length of the curve $C$ calculated using +\nomenclature{$\abs{C}_M$}{The length of the curve $C$ using the metric tensor $M$}% \begin{equation} \abs{\gamma}_M = \int_\gamma \sqrt{\langle \dot{\gamma}, diff --git a/discrete.tex b/discrete.tex index 30d4ddc..67f0a82 100644 --- a/discrete.tex +++ b/discrete.tex @@ -2,7 +2,7 @@ \label{chap:discrete} The whole transformation from the initial functional in -\eqref{eq:first_anisotropic_functional} through the anisotropic coarea +\eqref{eq:first_anisotropic_functional}, through the an\-isotropic coarea formula and the Cauchy--Crofton formula was motivated by the discrete formulation which will be described here. After discretizing the functional, we will see how a graph cut approach can be used to find @@ -239,6 +239,8 @@ will be provided by the following lemma. \begin{equation} \Delta \rho = \frac{\delta^2}{\norm{e}}. \end{equation} + A visual argument for the same result can be seen in + Figure~\ref{fig:area_proof}. \end{proof} Inserting $\Delta \rho = \delta^2 / \norm{e}$ and the tensor approximation of \eqref{eq:tensor_approx} into the curve length @@ -280,7 +282,7 @@ Thus we have arrived at our final discretization, which takes the form N_x(\lambda)\big) \cdot u_x^\lambda, \\ F_{x,y}^\lambda(u_x^\lambda, u_y^\lambda) &= \abs{u_x^\lambda - u_y^\lambda} \frac{\det M(e_{xy}) - \norm{e_{xy}}^2 \delta^2 \Delta \phi}{2 \left( e_{xy}^T \cdot + \norm{e_{xy}}^2 \, \delta^2 \, \Delta \phi}{2 \left( e_{xy}^T \cdot M(e_{xy}) \cdot e_{xy} \right)^{\sfrac{3}{2}}}. \end{aligned} \label{eq:final_discretization} @@ -442,7 +444,7 @@ however have to take these things into account when creating our neighborhood stencil, to make sure that we get a reasonable approximation of the perimeter lengths. -\section{Graph cut formulation} +\section{Graph cut approach} The discretization we arrived at in \eqref{eq:final_discretization} can be minimized using graph cuts. For each level $\lambda$, a minimum graph @@ -470,9 +472,9 @@ allow self-loops in our graph. When a directed graph $G$ is equipped with capacity function $c$, one might call it a capacitated graph or a flow network, but as all our graphs will be capacitated from this point, we will just call them graphs and we write $G = (V, E, c)$. -\nomenclature{$G = (V,E,c)$}{A graph given by the set of vertices $V$, -the set of edges $E$, and the capacity function $c$}% -\nomenclature{$c(u,v)$}{The capacity function $c : V \times V \to \left[0, \infty \right)$}% +\nomenclature{$G = (V,E,c)$}{Graph given by the vertices $V$, +edges $E$, and capacity function $c$}% +\nomenclature{$c(u,v)$}{Capacity function $c : V \times V \to \left[0, \infty \right)$}% There are two special vertices in the graph, the source $s$ and the sink $t$. Contrary to other vertices, which can neither produce nor @@ -578,13 +580,13 @@ $F^{x,y}(u^\lambda_x, u^\lambda_y)$ such that they take all the pixels their argument and then ignore all pixels except the ones they actually depend on. -\subsection{Graph construction} -\label{sec:graph_construction} - -\begin{figure}[t] +\begin{figure}[h] \input{fig/norm_subgraph} \end{figure} +\subsection{Graph construction} +\label{sec:graph_construction} + We will construct a graph in such a way that if a vertex $u^\lambda_x$ ends up on the source side of the cut we set $u^\lambda_x = 1$, and if it ends up on the sink side we set $u^\lambda_x = 0$, as in @@ -598,7 +600,9 @@ functional the output image close to the original image, and the regularization term coming from our aim to minimize the total variation. -\begin{table}[b] +\subsubsection{Fidelity term} + +\begin{table}[t] \centering \caption[Graph construction for $F_\lambda^x(u^\lambda_x)$]{Each row represents one of the two possible values of @@ -623,12 +627,6 @@ term coming from our aim to minimize the total variation. \label{tab:fid_energy} \end{table} -\subsubsection{Fidelity term} - -\begin{figure}[t] - \input{fig/neigh_subgraph} -\end{figure} - The fidelity term of our discrete functional \eqref{eq:final_discretization} simplifies to @@ -674,6 +672,10 @@ on the form shown in Theorem~\ref{thm:graph_rep_id}. Since the energies in \eqref{eq:neigh_energies} are especially simple, the construction and presentation is simplified. +\begin{figure} + \input{fig/neigh_subgraph} +\end{figure} + Figure~\ref{fig:neigh_subgraph} shows two different ways of how a graph can be constructed to represent the regularization term. See Table~\ref{tab:neigh_energy} for an overview of how the values diff --git a/fig/lower_semicont.tex b/fig/lower_semicont.tex index 2e36761..a10e68a 100644 --- a/fig/lower_semicont.tex +++ b/fig/lower_semicont.tex @@ -22,8 +22,8 @@ ] (s) at (3, 2.19) {}; \end{tikzpicture} -\caption[Lower semicontinuous function $f$]{ - A lower semicontinuous function $f : \mathbb{R} \to \mathbb{R}$ can +\caption[Lower semi-continuous function $f$]{ + A lower semi-continuous function $f : \mathbb{R} \to \mathbb{R}$ can have discontinuities, but for a convergent sequence $x_k \to x$ we always have $f(x) \leq \liminf_{k \to \infty} f(x_k)$. } diff --git a/main.tex b/main.tex index 6d3a81d..a7c4662 100644 --- a/main.tex +++ b/main.tex @@ -21,10 +21,11 @@ %\mathtoolsset{showonlyrefs=true} -\newminted{c++}{fontsize=\tiny} +\newminted{cpp}{fontsize=\tiny} \usepackage{polyglossia} \setmainlanguage[variant=american]{english} +\setotherlanguage{norsk} \usepackage[hidelinks]{hyperref} @@ -87,6 +88,8 @@ %\usepackage{makeidx} %\makeindex +\renewcommand{\nomname}{List of Symbols} + \input{commands} \makenomenclature @@ -173,17 +176,22 @@ discuss the results. \section*{Sammendrag} -I denne master-avhandlingen ser vi pÃ¥ en spesifikk kant-bevarende -støyfjerningsalgoritme basert pÃ¥ «total variation». Vi vil ta for oss +\begin{norsk} + +I denne masteroppgaven ser vi pÃ¥ en spesifikk kant-bevarende +støyfjerningsalgoritme basert pÃ¥ «total variation». Vi tar for oss at «total variation» i noen tilfeller fører til tap av kontrast i detaljer og tynne strukturer. For Ã¥ redusere kontrast-tapet introduserer -vi en retningsavhengig anisotrop tensor. Denne tensoren kontrollerer +vi en retningsavhengig anisotropitensor. Denne tensoren kontrollerer støyfjerningen basert pÃ¥ posisjonen i bildet, og retningen til -gradienten. Den blir konstruert basert pÃ¥ kant-informasjon fra det -opprinnelige støyete bildet. Vi optimerer funksjonalen ved hjelp av et +gradienten i punktet. Den blir konstruert basert pÃ¥ kant-informasjon fra det +opprinnelige støyete bildet. Vi minimerer den resulterende funksjonalen +i et graf-kutt-rammeverk, som er gjort mulig ved hjelp av en coarea- og en -Cauchy--Crofton-likning. Vi avslutter med en numerisk studie og -exprimentering pÃ¥ parametrene og diskusjon av resultatene. +Cauchy--Crofton-likning. Vi avslutter med en numerisk studie, +eksperimentering med parametrene og diskusjon av resultatene. + +\end{norsk} \vspace*{\fill} @@ -197,7 +205,7 @@ exprimentering pÃ¥ parametrene og diskusjon av resultatene. \setlength{\parskip}{0.4cm} \setlength{\parindent}{0cm} This master thesis concludes my study at the Applied Physics and -Mathematics Master's degree programme with specialization in Industrial +Mathematics Master's degree program with specialization in Industrial Mathematics at the Norwegian University of Science and Technology (NTNU). @@ -206,7 +214,7 @@ Mathematical Sciences for invaluable help and discussion throughout my work with my project and this thesis. Finally I would like to thank my family for their support, and Mats, -Lars, Kine, Hager, Henrik and Edvard for productive +Lars, Kine, Hager, Edvard and Henrik for productive discussions around the coffee pot. Bjørn Rustad, \today. @@ -271,12 +279,12 @@ Bjørn Rustad, \today. \markboth{\MakeUppercase\nomname}{\MakeUppercase\nomname} \printnomenclature[2.5cm] -%\cleardoublepage -%% En latex-kommando for Ã¥ si fra at kapitlene/seksjonene fra nÃ¥ -%% av skal nummereres med store bokstaver: -%\appendix -% -%\input{appendix} +\cleardoublepage +% En latex-kommando for Ã¥ si fra at kapitlene/seksjonene fra nÃ¥ +% av skal nummereres med store bokstaver: +\appendix + +\input{appendix} % Indeks for rapporten. Ta bort prosenttegn hvis du vil ha det med. %\printindex diff --git a/maxflow.tex b/maxflow.tex index 8fc5b1d..0fbc607 100644 --- a/maxflow.tex +++ b/maxflow.tex @@ -1,4 +1,4 @@ -\chapter{Maximum flow approach} +\chapter{Maximum flow} \label{chap:maxflow} In the previous section we have seen how finding the minimum cut of @@ -366,7 +366,8 @@ residual graph, and $d$ remains a valid labeling. The capacity constraint and preflow constraint remain satisfied assuming they were satisfied before the procedure was started. -\subsection{Putting it all together} +\subsection{Final algorithm} + These basic procedures are then applied to active vertices and admissible edges until we obtain our minimum cut. We will see later that when there are no more active vertices, we can extract the minimum cut from the @@ -645,7 +646,7 @@ $\lambda$ these edges will increase monotonically with decreasing $\lambda$ parameter. \item[Edges from $u$ to $v$\textmd{:}] - These edges have no $\lambda$-dependence and will remain + These edges do not depend on $\lambda$ and will remain unchanged. \item[Edges from $v$ to $t$\textmd{:}] As seen in Figure~\ref{fig:norm_subgraph_pos} the capacity of @@ -755,11 +756,7 @@ graph re-use. Goldfarb and Yin \cite{goldfarb2009parametric} have found that the divide and conquer approach only yields improved performance when using -the $L^2$ norm in the fidelity term. This has to do with the fact that -the fidelity term for the $L^1$ norm only changes once for each pixel, -as we can see in Figure~\ref{fig:norm_evolution}, reducing the amount of -work that has to be done in each iteration of the regular parametric -push-relabel algorithm. +the $L^2$ norm in the fidelity term. See \cite{gallo1989fast}, \cite{hochbaum2001efficient} and \cite{goldfarb2009parametric} for more information. @@ -1012,7 +1009,7 @@ graph in Figure~\ref{fig:norm_subgraph_neg}. As $\lambda$ goes from $L-1$ to $0$ stay non-negative. The edge from $u_\lambda^x$ to $t$ is non-decreasing with decreasing $\lambda$ parameter. -\begin{table}[b] +\begin{table}[t] \centering \caption[Graph construction for $F_\lambda^x(u^\lambda_x)$ in the Boykov--Kolmogorov algorithm]{ diff --git a/methods.tex b/methods.tex index dd24581..c8097ec 100644 --- a/methods.tex +++ b/methods.tex @@ -27,7 +27,7 @@ types of noise. We will assume that the given image $f$ is a combination of an underlying, actual image $u^*$, and some noise $\delta$. The simplest -\nomenclature{$\delta$}{Noise}% +\nomenclature{$\delta$}{Noise function}% model is additive noise where the assumption is that $f = u^* + \delta$. \nomenclature{$u^*$}{Usually unknown, actual image without noise}% There is also multiplicative noise where $f = u^* \cdot \delta$. An @@ -167,8 +167,6 @@ edge estimator $\nabla u_\sigma$ where \begin{equation} u_\sigma := K_\sigma * \tilde{u} \end{equation} -\nomenclature{$u_\sigma$}{Edge estimator, image $u$ smoothed with a Gaussian of -parameter $\sigma$}% and $\tilde{u}$ is an extension of $u$ from $\Omega$ to $\mathbb{R}^2$ \nomenclature{$\tilde{u}$}{Symmetric extension of $u$ from $\Omega$ to $\mathbb{R}^2$}% @@ -199,7 +197,7 @@ However, even if the diffusivity tensor was introduced to reduce the amount of smoothing across edges, the solution of \eqref{eq:aniso_diff} will still be infinitely differentiable \cite{weickert1998anisotropic}, i.e.\ $u(T) \in C^\infty(\Omega)$ for $T > 0$. Thus there are no real discontinuities, and -\nomenclature{$C^\infty(\Omega)$}{The space of infinitely differentiable +\nomenclature{$C^\infty(\Omega)$}{Space of infinitely differentiable functions from $\Omega$ to $\mathbb{R}$.}% no real edges in the solution. @@ -278,11 +276,10 @@ variation using the distributional derivative. $\Omega$. \label{def:tv} \end{definition} -\nomenclature{$\TV(u)$}{Total variation of the image $u$}% -\nomenclature{$C^\infty_c\left(\Omega, \mathbb{R}^2\right)$}{The space of smooth +\nomenclature{$\TV(u)$}{Total variation of $u$}% +\nomenclature{$C^\infty_c\left(\Omega, \mathbb{R}^2\right)$}{Space of smooth functions from $\Omega$ to $\mathbb{R}^2$ with compact support in $\Omega$}% -\nomenclature{$\varphi$}{Test function}% Note that since $\Omega$ is open and bounded, the test functions $\varphi$ vanish on the boundary of $\Omega$. Thus no variation is diff --git a/results.tex b/results.tex index 363cc3e..2de9db0 100644 --- a/results.tex +++ b/results.tex @@ -329,6 +329,7 @@ not point in one single direction. } \label{fig:n_circle_72} \end{subfigure} + \vspace*{0.1cm}% \begin{subfigure}[t]{0.30\textwidth} \centering @@ -356,6 +357,7 @@ not point in one single direction. } \label{fig:n_octagon_72} \end{subfigure} + \vspace*{0.1cm}% \begin{subfigure}[t]{0.30\textwidth} \centering @@ -412,7 +414,7 @@ Figure~\ref{fig:n_circle} is shaped like an octagon when regularized in Figure~\ref{fig:n_circle_8}. However the stencil of size 72 manages to keep the circular shape. -Next, in Figure~\ref{fig:n_octagon}, we see that the stencil of size 8 +In Figure~\ref{fig:n_octagon}, we see that the stencil of size 8 actually favors octagon-like shapes, as the restored shape is the same octagon, just with some contrast loss. @@ -537,7 +539,8 @@ one-pixel noise will be smaller for large neighborhoods. } \label{fig:finger_contrast_atv2} \end{subfigure} - \caption[Comparison contrast loss in regular an anisotropic restoration]{% + \caption[Comparison of contrast loss in regular and anisotropic + total variation]{% A noisy fingerprint restored using both isotropic and anisotropic total variation to see how the contrast loss compares. Parameters: $\abs{\mathcal{N}} = 32$, $\sigma = 3$, diff --git a/titlepage.tex b/titlepage.tex index 678469b..baa9867 100644 --- a/titlepage.tex +++ b/titlepage.tex @@ -1,5 +1,5 @@ -\title{Anisotropic total variation based image restoration using graph -cuts} +\title{Anisotropic Total Variation Based Image Restoration Using Graph +Cuts} \date{\today}