From: Bjørn Rustad Date: Sun, 7 Dec 2014 14:47:46 +0000 (+0100) Subject: Results and more X-Git-Url: http://git.rustad.me/?a=commitdiff_plain;h=8c9cc0cda47503203fcfd9caee2262686c0104db;p=master Results and more --- diff --git a/Makefile b/Makefile index ae5624c..5e8b3e4 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ all: - xelatex main + xelatex -shell-escape main bibtex main - xelatex -no-pdf main - xelatex main + xelatex -shell-escape -no-pdf main + xelatex -shell-escape main cp main.pdf ~/Dropbox/master/ diff --git a/main.tex b/main.tex index ffa864a..e2e5549 100644 --- a/main.tex +++ b/main.tex @@ -8,6 +8,7 @@ \usepackage{fontspec} \usepackage{amsthm} \usepackage{graphicx} +\usepackage{minted} \usepackage{polyglossia} \setmainlanguage[variant=american]{english} diff --git a/results.tex b/results.tex index b716335..3c51a53 100644 --- a/results.tex +++ b/results.tex @@ -1,22 +1,16 @@ \chapter{Results} -We show some basic results for different parameters. +In the previous chapters we have carefully constructed a method always +trying to argue how the choices we make can have a positive impact on +the image restoration results. The anisotropic total variation is the +main advance from my project work \cite{project}, and we would like to +see what its effects are. \section{Anisotropy} -We have a few figures showing results with predescribed tensors, so that -we know they actually have an effect. - -We show how the blurring and integration scale parameters have an -effect, maybe the fingerprint is a good example. Maybe a depiction of -the tensors is a good idea here. - -We show how it affects regularization, and contrast loss, using a 1D -slice through a noisy fingerprint image. - \begin{figure} \centering - \begin{subfigure}[b]{0.40\textwidth} + \begin{subfigure}[b]{0.30\textwidth} \centering \includegraphics[width=\textwidth]{fig/circle100n.png} \caption{ @@ -24,18 +18,154 @@ slice through a noisy fingerprint image. } \end{subfigure} ~ - \begin{subfigure}[b]{0.40\textwidth} + \begin{subfigure}[b]{0.30\textwidth} \centering \includegraphics[width=\textwidth]{fig/anisotropy_circle.png} \caption{ - Anisotropically restored. + Uniform tensor. + } + \label{fig:tensor_experiment_unif} + \end{subfigure} + ~ + \begin{subfigure}[b]{0.30\textwidth} + \centering + \includegraphics[width=\textwidth]{fig/circle100a.png} + \caption{ + Normal tensor. + } + \end{subfigure} + \caption{ + Funny caption. Parameters. + } + \label{fig:tensor_experiment} +\end{figure} + +The anisotropy was introduced into the total variation in order to +lessen the regularization done across what we know, or at least are +pretty sure to be edges in the image. Before considering the anisotropy +tensor construction described earlier, we will look at how a simple +predescribed tensor affects the regularization. Imagine a tensor which +is a diagonal matrix $A = \operatorname{diag}(1, \epsilon)$, where +$\epsilon \ll 1$ is small. This would result in us down-weighting the +size of $\nabla \tilde{f}_\sigma$ in the $y$-direction, and thus +regularizing mostly in the $x$-direction. + +The results of this experiment can be seen in Figure +\ref{fig:tensor_experiment}, where a noisy picture of a circle has been +restored in two different ways, first with a uniform anisotropy tensor +$A = \operatorname{diag}(1, \epsilon)$, and then with the tensor +described in Section \ref{sec:anisotropy_tensor}. We see in Figure +\ref{fig:tensor_experiment_unif} that the uniform tensor gives a strong +smoothing in the $x$-direction, while no apparent smoothing in the +$y$-direction. + +In the construction of the tensor in Section +\ref{sec:anisotropy_tensor}, we have several parameters. The \emph{noise +scale} $\sigma$ controls the smoothing done before $\nabla +\tilde{f}_\sigma$ is calculated, and thus controls how sensitive we are +to noise in the input image $f$. All details of scale less than $\sigma$ +will be considered to be noise. +\begin{figure} + \centering + \begin{subfigure}[t]{0.30\textwidth} + \centering + \includegraphics[width=\textwidth]{fig/gradlow.png} + \caption{ + Low smoothing. + } + \end{subfigure} + ~ + \begin{subfigure}[t]{0.30\textwidth} + \centering + \includegraphics[width=\textwidth]{fig/gradnscale.png} + \caption{ + Higher noise scale. + } + \label{fig:scale_comp_high} + \end{subfigure} + ~ + \begin{subfigure}[t]{0.30\textwidth} + \centering + \includegraphics[width=\textwidth]{fig/gradiscale.png} + \caption{ + Low noise scale, but high integration scale. + } + \label{fig:scale_comp_int} + \end{subfigure} + \caption{ + Funny caption. Parameters. + } + \label{fig:scale_comp} +\end{figure} + +Figure \ref{fig:scale_comp} shows a constructed zebra pattern of +increasing width. The anisotropy should in theory help reduce contrast +loss in this situation, by reducing the regularization done in the +$x$-direction, but there is the question of at which scale it considers +the lines to be detail instead of noise. + +In Figure \ref{fig:scale_comp_high} the noise scale is increased and the +tensor no longer consider the left-most part of the image to be details, +but rather noise. + +The \emph{integration scale} $\rho$ of \eqref{eq:s_def} represents the +size of the structures we want to affect our anisotropy tensor. Although +all edges and details larger than the noise scale will affect the edge +detector $\nabla \tilde{f}_\sigma$, but the smoothing after of scale +$\rho$ may ignore them depending on their size. In Figure +\ref{fig:scale_comp_int} a high value for $\rho$ means that the +structure found in the inner square is almost completely ignored in +favour of the larger, more coherent structure around. + +\begin{figure} + \centering + \begin{subfigure}[t]{0.30\textwidth} + \centering + \includegraphics[width=\textwidth]{fig/lenaedge.png} + \caption{ + Largest structure tensor eigenvalue. + } + \label{fig:lena_process_edge} + \end{subfigure} + ~ + \begin{subfigure}[t]{0.30\textwidth} + \centering + \includegraphics[width=\textwidth]{fig/lenatensor.png} + \caption{ + The anisotropy tensor eigenvector and eigenvalues. + } + \label{fig:lena_process_tensor} + \end{subfigure} + ~ + \begin{subfigure}[t]{0.30\textwidth} + \centering + \includegraphics[width=\textwidth]{fig/lenarest.png} + \caption{ + Restored Lena. } + \label{fig:lena_process_restored} \end{subfigure} \caption{ Funny caption. Parameters. } + \label{fig:lena_process} \end{figure} +It is often useful to look at intermediate results to better understand +what happens and how the parameters affect our end result. In Figure +\ref{fig:lena_process} we show three stages of our image restoration +algorithm. Figure \ref{fig:lena_process_edge} shows the larges +eigenvalue of our structure tensor, and is thus an indicator of where +the edge structures are. + +Figure \ref{fig:lena_process_tensor} is a depiction of the anisotropy +tensor in some of the points in the image, shown as eigenvectors with +their corresponding eigenvalues as their length. We see that across +edges, \fixme{what!?} + +Finally, Figure \ref{fig:lena_process_restored} shows the final restored +image, and we see that heavy modifications have been made. + \begin{figure} \centering \begin{subfigure}[t]{0.30\textwidth} @@ -52,6 +182,7 @@ slice through a noisy fingerprint image. \caption{ Restored without much anisotropy. } + \label{fig:finger_contrast_tv} \end{subfigure} ~ \begin{subfigure}[t]{0.30\textwidth} @@ -60,24 +191,130 @@ slice through a noisy fingerprint image. \caption{ Restored with much anisotropy. } + \label{fig:finger_contrast_atv} \end{subfigure} \caption{ Funny caption. Parameters. } + \label{fig:finger_contrast} \end{figure} +We have claimed that the anisotropic total variation will reduce some of +the contrast loss one can encounter with regular total variation +regularization. An example of this can be seen in Figure +\ref{fig:finger_contrast} where a portion of a fingerprint with +added Gaussian noise has been restored in two different ways. We see +that when the anisotropy is increased, more of the contrast between dark +and light portions of the fingerprint is retained. This can also be seen +in Figure \ref{fig:contrast_plot} where a one-dimensional slice has been +taken through Figure \ref{fig:finger_contrast_tv} and +\ref{fig:finger_contrast_atv}. Although much of the same structure is +found for this particular regularization parameter $\beta$, the peaks +are much higher for the anisotropic total variation. + \begin{figure} \centering \input{fig/contrast_plot} \caption{Showing some contrast loss.} + \label{fig:contrast_plot} \end{figure} +So far we have just inspected the restored image visually to judge the +results of the method. Depending on the application, we might have +different wishes for the results. In many cases we just want to remove the +noise $\delta$ in \fixme{ref} where the captured image $f$ is assumed to +consist of an actual image $u$ and an additional noise term $\delta$ +such that $f = u + \delta$. The noise removed by the restoration method, +$\hat{\delta} = f - u^*$ is called the method noise. Any assumptions of +properties we have on $\delta$, we optimally want $\hat{\delta}$ to +fulfill as well. Thus if we assumed independently distributed Gaussian +noise, we want to remove that kind of noise. An indication of problems +can in that case be if the method noise contains a lot of the details of +the image. + +Figure \ref{fig:lena_method_noise} shows the results after restoring the +noisy Lena picture in Figure \fixme{noisylena}, with different +parameters, and their method noise. We note that the method noise of the +regular total variation method shows and outline of Lena, which +indicates some detail loss. Further, we see that the method noise of the +anisotropically restored image, has less details. + +\begin{figure} + \centering + \begin{subfigure}[t]{0.30\textwidth} + \centering + \includegraphics[width=\textwidth]{fig/lena_tv.png} + \end{subfigure} + ~ + \begin{subfigure}[t]{0.30\textwidth} + \centering + \includegraphics[width=\textwidth]{fig/lena_atv.png} + \end{subfigure} + ~ + \begin{subfigure}[t]{0.30\textwidth} + \centering + \includegraphics[width=\textwidth]{fig/lena_atv72.png} + \end{subfigure} + + \centering + \begin{subfigure}[t]{0.30\textwidth} + \centering + \includegraphics[width=\textwidth]{fig/lena_method_tv.png} + \caption{ + Regular total variation. + } + \end{subfigure} + ~ + \begin{subfigure}[t]{0.30\textwidth} + \centering + \includegraphics[width=\textwidth]{fig/lena_method_atv.png} + \caption{ + Anisotropic total variation. + } + \end{subfigure} + ~ + \begin{subfigure}[t]{0.30\textwidth} + \centering + \includegraphics[width=\textwidth]{fig/lena_method_atv72.png} + \caption{ + Size 72 neighborhood. + } + \end{subfigure} + \caption{ + Funny caption. Parameters. + } + \label{fig:lena_method_noise} +\end{figure} + +\begin{figure} + \centering + \input{fig/factory/lena_gamma_seq/corr.tex} + \caption{ + The correlation between the method noise and the noisy image for + different anisotropy parameters $\gamma$. + } +\end{figure} + \section{Neighborhood} We show how the different neighborhoods work. Here we might make some nice, very contrived examples, maybe. To show that both too small and too big is bad. +The neighborhoods were introduced as a way to describe the discrete set +of lines $\mathcal{L}_D$ in the discretization of the regularization +term in Section \ref{sec:disc_regularization}. And as discussed, we want +the stencil to have many short edges, such that the angular +differences $\Delta \phi$, the inter-line distances $\Delta \rho$ and the +edge lengths $e$ are ``small.'' + +Figure \ref{fig:circle_arti} shows a circle that has been strongly +regularized using a 8-point stencil. The circle has clearly been +deformed to look more like an octagon. This is due to the fact that the +8-point stencil measures horizontal, vertical and 45\textdegree{} lines +exactly in the Cauhcy--Crofton formula, while the length of other lines +overestimated as the sum of their three components. + \begin{figure} \centering \begin{subfigure}[b]{0.40\textwidth} @@ -98,11 +335,6 @@ too big is bad. \caption{ Not so funny caption. Include some parameters. } + \label{fig:circle_arti} \end{figure} -\section{Comparison} - -Maybe? Compare with the regular total variation method, and anisotropic -diffusion. Question is, where do we get our anisotropic diffusion -results from? Code our own? Or use some popular implementation? - diff --git a/theory.tex b/theory.tex index 6700d76..cf51eb0 100644 --- a/theory.tex +++ b/theory.tex @@ -1117,6 +1117,7 @@ our image takes values in $\mathcal{L} = \{0, \hdots, L-1\}$, the thresholded image $u^{L-1}$ is equal to zero everywhere. \subsection{Regularization term} +\label{sec:disc_regularization} Discretizing the regularization term is more challenging. We introduce the discrete levels to get