]> git.rustad.me Git - master/commitdiff
FINISHING UP
authorBjørn Rustad <bjorn@rustad.me>
Mon, 26 Jan 2015 17:26:52 +0000 (18:26 +0100)
committerBjørn Rustad <bjorn@rustad.me>
Mon, 26 Jan 2015 17:26:52 +0000 (18:26 +0100)
bib.bib
fig/factory/contrast.m
introduction.tex
main.tex
results.tex
theory.tex

diff --git a/bib.bib b/bib.bib
index 7ea046894ff5a25628fe2f56bcb8445c72611242..07b195a560439454ba9b1ac3ed15df54e0836707 100644 (file)
--- a/bib.bib
+++ b/bib.bib
@@ -1,5 +1,75 @@
 <bibtex>\r
 \r
+@preamble{\r
+       "\def\cprime{$'$} "\r
+}\r
+@book{ziemer1989,\r
+       AUTHOR = {Ziemer, William P.},\r
+       TITLE = {Weakly differentiable functions},\r
+       SERIES = {Graduate Texts in Mathematics},\r
+       VOLUME = {120},\r
+       PUBLISHER = {Springer-Verlag, New York},\r
+       YEAR = {1989},\r
+       PAGES = {xvi+308},\r
+       ISBN = {0-387-97017-7},\r
+       MRCLASS = {46E35},\r
+       MRNUMBER = {1014685 (91e:46046)},\r
+       MRREVIEWER = {V. M. Gol{\cprime}dshte{\u\i}n},\r
+       DOI = {10.1007/978-1-4612-1015-3},\r
+       URL = {http://dx.doi.org/10.1007/978-1-4612-1015-3},\r
+}\r
+\r
+@article{acar1994analysis,\r
+       AUTHOR = {Acar, R. and Vogel, C. R.},\r
+       TITLE = {Analysis of bounded variation penalty methods for ill-posed\r
+               problems},\r
+       JOURNAL = {Inverse Problems},\r
+       FJOURNAL = {Inverse Problems. An International Journal on the Theory and\r
+               Practice of Inverse Problems, Inverse Methods and Computerized\r
+                       Inversion of Data},\r
+       VOLUME = {10},\r
+       YEAR = {1994},\r
+       NUMBER = {6},\r
+       PAGES = {1217--1229},\r
+       ISSN = {0266-5611},\r
+       CODEN = {INPEEY},\r
+       MRCLASS = {65J20 (47A50 49J45)},\r
+       MRNUMBER = {1306801 (95i:65092)},\r
+       URL = {http://stacks.iop.org/0266-5611/10/1217},\r
+}\r
+\r
+@article{weickert1999coherence,\r
+       title={Coherence-enhancing diffusion filtering},\r
+       author={Weickert, Joachim},\r
+       journal={International Journal of Computer Vision},\r
+       volume={31},\r
+       number={2-3},\r
+       pages={111--127},\r
+       year={1999},\r
+       publisher={Springer}\r
+}\r
+\r
+@book{jahne,\r
+       title={{D}igital {I}mage {P}rocessing},\r
+       author={J{\"a}hne, Bernd},\r
+       publisher={Springer-Verlag, Berlin Heidelberg},\r
+       year={2005}\r
+}\r
+\r
+@book {aubert2006proc,\r
+       AUTHOR = {Aubert, Gilles and Kornprobst, Pierre},\r
+       TITLE = {Mathematical problems in image processing},\r
+       SERIES = {Applied Mathematical Sciences},\r
+       VOLUME = {147},\r
+       EDITION = {Second},\r
+       PUBLISHER = {Springer, New York},\r
+       YEAR = {2006},\r
+       PAGES = {xxxii+377},\r
+       ISBN = {978-0387-32200-1; 0-387-32200-0},\r
+       MRCLASS = {94A08 (35B27 35J60 35L70 49J10 68T45)},\r
+       MRNUMBER = {2244145 (2007j:94004)},\r
+}\r
+\r
 @book{do1976differential,\r
        AUTHOR = {do Carmo, Manfredo P.},\r
        TITLE = {Differential geometry of curves and surfaces},\r
        doi={10.1007/978-0-387-92920-0_23},\r
        title={Total Variation in Imaging},\r
        url={http://dx.doi.org/10.1007/978-0-387-92920-0_23},\r
-       publisher={Springer New York},\r
+       publisher={Springer, New York},\r
        author={Caselles, V. and Chambolle, A. and Novaga, M.},\r
        pages={1016-1057}\r
 }\r
index 699603c8d2452ac517547fa20c1feb240c4ae60f..deb783b5c7364a8c9923b6a123de66caf443c732 100644 (file)
@@ -1,5 +1,5 @@
-tv  = imread('finger/r_p2_n32_b9000_g1000000000000_r10_s3.png');
-atv = imread('finger/r_p2_n32_b9000_g150_r10_s3.png');
+tv  = imread('finger/r_p2_n32_b9000_g1000000000000_r10_s3.pgm');
+atv = imread('finger/r_p2_n32_b9000_g150_r10_s3.pgm');
 
 hold on;
 plot(atv(100,:),'r');
index f7c2ac5a077392033aeea0beeb16ebf518dbd49d..fdb00cf9ad84284aa2aff31636b84c11476fa3d7 100644 (file)
@@ -66,9 +66,10 @@ the restoration performance.
 \fixme{Rating: 7/10}
 
 There are numerous methods in image restoration, and since we do not
-have time nor space to discuss them all, we will focus on the ones
+have time nor space to discuss them all, this short overview will focus on the ones
 related to the anisotropic total variation method considered later in
-this thesis. \fixme{Maybe refer to some overview book?}
+this thesis. See \cite{jahne} and \cite{aubert2006proc} for more
+background on image processing in general.
 
 In this chapter, and also in the rest of the thesis we will assume that
 we are given an image $f : \Omega \to \mathbb{R}$ where $\Omega$ is a
@@ -201,12 +202,9 @@ both location and direction dependent.
 \subsection{Anisotropic diffusion}
 \label{sec:anisotropic_diffusion}
 
-\fixme{Rating: 7/10, update figure, and refer to it. Maybe even a figure
-showing the structure and anisotropy tensors as ellipses along an edge?}
-
-The diffusivity is made directionally dependent by introducing a diffusion
-\emph{tensor} $A(u)$ such that the initial boundary value problem
-becomes
+The diffusivity is made directionally dependent by introducing a
+diffusion \emph{tensor} $A(u)$ such that the initial boundary value
+problem becomes
 \begin{equation}
     \left\{
         \begin{alignedat}{10}
@@ -396,9 +394,8 @@ restoration.
     \label{fig:grad_tv}
 \end{figure}
 
-\fixme{First time we mention level values.}
 Thin objects and corners may also suffer from contrast loss since
-bringing them closer to their surroundings in level value reduces the
+bringing them closer to their surroundings reduces the
 total variation. An example of this is shown in
 Figure~\ref{fig:tv_example}, where a not particularly noisy fingerprint
 image has been strongly regularized. The original black and white levels
@@ -503,5 +500,3 @@ And if in addition the cut is minimal, we know that the edges cut have
 minimal weight, and can prove that the $u^\lambda$ produced minimizes
 the functional in \eqref{eq:total_energy}.
 
-\fixme{Wow. Such handwavy.}
-
index 4d911f974cddb832f94d1b02f770ff7c7315a066..3e703751020b5a052500ae2f89ffc1da48e45aad 100644 (file)
--- a/main.tex
+++ b/main.tex
@@ -74,6 +74,7 @@
 \usepackage{algpseudocode}
 
 \newtheorem{theorem}{Theorem}
+\newtheorem{proposition}{Proposition}
 \newtheorem{lemma}{Lemma}
 \newtheorem{definition}{Definition}
                                  
@@ -122,7 +123,8 @@ Lololol.
 
 \section*{Preface}
 
-Bleep bloop. Acknowledements?
+Bleep bloop. Acknowledements? Takk til Henrik for sjokolademelka, og
+Kine for god muffins.
 
 % Romerske tall på alt før selve rapporten starter er pent.
 \pagenumbering{roman}
index f3b43fe027d15f0d85651a3cb65e6bef857c0e6a..708a90292b7962fdcfea9c4b5ab2b7be91293265 100644 (file)
@@ -466,11 +466,13 @@ circumference of circles of different radii. Note that the circumference
 approximated is that of an actual continuous circle $r = x^2 + y^2$ and
 not a discrete representation.
 
+\section{Restoration}
+
 \begin{figure}
     \centering
     \begin{subfigure}[t]{0.30\textwidth}
         \centering
-        \includegraphics[width=\textwidth]{fig/fingern.png}
+        \includegraphics[width=\textwidth]{fig/factory/finger/n_q300.png}
         \caption{%
             Noisy fingerprint.
         }
@@ -478,46 +480,52 @@ not a discrete representation.
     ~
     \begin{subfigure}[t]{0.30\textwidth}
         \centering
-        \includegraphics[width=\textwidth]{fig/fingertv.png}
+        \includegraphics[width=\textwidth]{fig/factory/finger/r_p2_n32_b9000_g1000000000000_r10_s3.png}
         \caption{%
-            Restored without much anisotropy.
+            Restored without anisotropy.
         }
         \label{fig:finger_contrast_tv}
     \end{subfigure}
     ~
     \begin{subfigure}[t]{0.30\textwidth}
         \centering
-        \includegraphics[width=\textwidth]{fig/fingera.png}
+        \includegraphics[width=\textwidth]{fig/factory/finger/r_p2_n32_b9000_g150_r10_s3.png}
         \caption{%
             Restored with much anisotropy.
         }
         \label{fig:finger_contrast_atv}
     \end{subfigure}
     \caption{%
-        The different stages in the restoration of a part of the Lena
-        test image.
+        A noisy fingerprint restored using both isotropic and
+        anisotropic total variation. All parameters are kept constant
+        except for $\omega$, the anisotropy parameter.
     }
     \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 $\omega$ 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
+regularization. In Figure~\ref{fig:finger_contrast} a fingerprint with
+additional Gaussian noise has been restored with two different
+anisotropy parameters. There is an obvious contrast difference in the
+contrast of the two restored images, which 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}. Please note that this can be seen as
-cheating. The anisotropy tensor, with one eigenvalue equal to 1, and the
-other less or equal to 1, means that when all else being equal, the
-amount of restoration will be reduced.
+and~\ref{fig:finger_contrast_atv}. It is however not obvious what this
+tells us about the quality of the anisotropic algorithm. As previously
+mentioned, increasing the anisotropy (decreasing $\omega$) means
+decreasing the amount of regularization done. And less contrast loss is
+an expected outcome of decreasing the regularization, disregarding the
+anisotropy.
 
 \begin{figure}
     \centering
     \input{fig/factory/contrast}
-    \caption{Showing some contrast loss.}
+    \caption{%
+        A one-dimensional slice through the restored fingerprint images
+        of Figure~\ref{fig:finger_contrast}, showing a difference in the
+        contrast.
+    }
     \label{fig:contrast_plot}
 \end{figure} 
 
index 1b2023040457390fa1f3c41f5043c18c1a6355e3..f50425933818ccbfee8b28e0112b4ad4f858588d 100644 (file)
@@ -103,15 +103,6 @@ affects our numerical solution method.
 
 \fixme{Rating: 6/10}
 
-\fixme{%
-    We also discuss whether to use the noisy image (yes, probably),
-    or the smoothed image (implicitly, complicated, possible
-    iteratively) in the structure tensor.
-}
-
-\fixme{Using $\abs{v}$ for vector length has apparently spread from the
-initial total variation $\abs{\nabla u}$.}
-
 There are many possible choices for the anisotropy tensor $A(x)$. Our
 constraints are that we have assumed it to be continuous and symmetric
 positive definite, and we have some wishes for its properties. We would
@@ -232,36 +223,35 @@ In smooth areas, $\sigma_1 \approx 1$ and
 $A(x)$ will be close to the identity matrix, while $A(x)$ will reduce
 the effect of $\nabla u$ across edges.
 
-The parameter $\omega$ controls the amount of anisotropy in the method,
-such that if it is very large we are left with the identity matrix.
-
 Around corners $A(x)$ will be close to the identity matrix, which gives
 regularization similar to smooth areas. This is one possible down-side
 of this tensor choice.
 
+The parameter $\omega$ controls the amount of anisotropy in the method,
+such that if it is very large we are left with the identity matrix. Note
+that changing the parameter $\omega$ implicitly affects how much
+restoration is done. For an image $u$, decreasing $\omega$ will, all
+else being equal, decrease the lowest eigenvalue of $A(x)$ and in turn
+decrease the anisotropic total variation $\TVA(u)$.
+
 For the case where $\lambda_1 = \lambda_2$, the $U(x)$ in our
 decomposition is not well-defined. This is not a problem though, since
 $\Sigma(x)$ will be the identity matrix, so any orthogonal matrix will
 suffice for $U(x)$.
 
-\fixme{%
-    Discuss $\omega$. Discuss other tensor choices, the coherency thing
-    from Weickert. Discuss that this is not optimal in corners.
-}
+See \cite{weickert1999coherence} for a different tensor construction,
+made to enhance flow structures in the image, relevant in for example
+fingerprint analysis.
+
+\fixme{argue that $A$ is continuous?}
 
 \begin{figure}
     \input{fig/tensor_viz}
 \end{figure}
 
-\fixme{%
-    The numerical problems should be discussed somewhere but maybe not
-    here.
-}
-
 \section{Well-posedness}
 
-\fixme{Rating: 7/10, can give more references maybe, and be more
-specific on the ``problems.''}
+\fixme{Rating: 7/10}
 
 The theory of existence and uniqueness for these kinds of variational
 methods is a minefield of more or less subtle problems. Even if we
@@ -275,11 +265,21 @@ The basic things we ask of our functional
 \begin{equation}
     F(u) = \int_\Omega (u - f)^2 + \beta \, \TVA(u)
 \end{equation}
-are lower semicontinuity
-and coercivity for existence, and convexity for uniqueness. We restrict
+to have a \emph{well-posed} problem are lower semicontinuity
+and coercivity for existence, convexity for uniqueness and stability. We restrict
 ourself to $L^2(\Omega)$ which makes sense with our fidelity term,
 assuming that $f \in L^2(\Omega)$ initially.
 
+We consider the weak topology, as it will allow us to arrive at an
+existence result relatively easily.
+We say that a sequence $f_n$ in $L^2(\Omega)$ converges weakly to $f$ if
+\begin{equation}
+    \lim_{n \to \infty} \int_\Omega f_n \, \xi \, dx = \int_\Omega f \,
+    \xi \, dx
+\end{equation}
+for all $\xi \in L^2(\Omega)$ and we write $f_n \rightharpoonup f$. A
+weakly convergent sequence is a sequence that converges in the weak topology. 
+
 \subsection{Convexity}
 
 We start with convexity as it is the easiest to show. Being quadratic,
@@ -311,13 +311,20 @@ given the existence of a minimizer, implies uniqueness.
 
 \subsection{Coercivity}
 
-\fixme{Sequential coercivity?}
-
 Coercivity relates to how the functional behaves when the norm of the
-image $u$ tends to infinity.
+image $u$ tends to infinity. What we need in order to conclude with existence
+is sequential coercivity. Thus we need all level sets $F^\alpha = \{ u \in
+L^2(\Omega) : F(u) \leq \alpha \}$ to be \emph{sequentially
+pre-compact}, meaning that all sequences in the set contain a
+subsequence converging to an element of the closure of the set.
+
 It is obvious from the fidelity term that for some fixed $f \in
 L^2(\Omega)$, if $\lnorm{u}_{L^2} \to \infty$ then $F(u) \to \infty$.
-This tells us something about the locality of potential minimizers.
+This implies that all the level sets $F^\alpha$ are bounded.
+Since $L^2(\Omega)$ is a Hilbert space, all bounded sequences contain a
+weakly convergent subsequence. Thus all the level sets $F^\alpha$ are
+weakly sequentially pre-compact, since all sequences in these sets have
+a subsequence weakly converging to a point in the closure of the set.
 
 \begin{figure}
     \input{fig/lower_semicont}
@@ -325,8 +332,6 @@ This tells us something about the locality of potential minimizers.
 
 \subsection{Lower semi-continuity}
 
-\fixme{Find something else than $f$ for the example.}
-
 The lower semicontinuity is the most tricky part, and this is where we
 will take some shortcuts. Lower semicontinuity for a functional $F$ at a
 point $u$ means that at points $u_\epsilon$ close to $u$, the functional
@@ -350,19 +355,7 @@ further reading on the theory of sequential versus topological
 continuity see for example Megginson's book on Banach space theory
 \cite{megginson}.
 
-\fixme{We consider the weak topology. Because it is convenient? No,
-apparently to get the existence proof to work, but it does not say
-anything about weakness in the book? We do however have sequential
-coercivity in the assumptions of the Theorem, which might be a problem.}
-
-We say that a sequence $f_n$ in $L^2(\Omega)$ converges weakly to $f$ if
-\begin{equation}
-    \lim_{n \to \infty} \int_\Omega f_n \, \xi \, dx = \int_\Omega f \,
-    \xi \, dx
-\end{equation}
-for all $\xi \in L^2(\Omega)$ and we write $f_n \rightharpoonup f$. An
-important property is that all weakly convergent
-sequences also converge in the weak topology. Also, the mapping $u
+The mapping $u
 \mapsto \int_\Omega u \, \xi \, dx$ is weakly continuous for all $\xi
 \in L^2(\Omega)$. Note that when we write weakly continuous it is not a
 weaker version of continuity, but rather continuity in the weak
@@ -441,9 +434,85 @@ semi-continuous functional since
 and thus our functional is sequentially weakly lower semi-continuous.
 
 The usual ways of going from coercivity and lower semicontinuity to
-existence do not work in infinite dimensions. But with our coercivity
-and sequential lower semi-continuity we can apply \fixme{Theorem 5.1 in
-\cite{scherzer2008variational}} to conclude that we have existence.
+existence do not work in infinite dimensions. But with sequential
+coercivity and sequential lower semi-continuity in the weak topology we
+can conclude that we have existence from \cite[Theorem
+5.1]{scherzer2008variational}.
+
+\subsection{Stability}
+
+The last property normally required for well-posedness is stability.
+Thus the question is how the solutions behave when we perturb the
+problem. We stick to $L^2(\Omega)$ and adopt a proof given by Acar and
+Vogel in \cite{acar1994analysis}.
+
+\begin{proposition}
+    Consider a sequence of perturbed problems
+    \begin{equation}
+        \min_{u \in L^2(\Omega)} F_n(u).
+    \end{equation}
+    Assume that each of the functionals $F_n$ is weakly sequentially
+    lower-semicontinuous, has a unique minimizer $u_n$, and in addition that they are
+    uniformly coercive in the sense that for any sequence $v_n \in
+    L^2(\Omega)$
+    \begin{equation}
+        \lim_{n \to \infty} F_n(v_n) = \infty \quad \text{whenever } \, \lim_{n \to
+        \infty} \norm{v_n}_{L^2} = \infty.
+        \label{eq:fn_coercive}
+    \end{equation}
+    Assume also that the problems are consistent in the sense that $F_n \to
+    F$ uniformly, i.e.\ given an $R > 0$ and $\epsilon > 0$ there exists an
+    $N$ such that
+    \begin{equation}
+        \abs{F_n(u) - F(u)} < \epsilon \quad \text{whenever } \, n \geq N \text{ and
+        } \norm{u}_{L^2} \leq R.
+        \label{eq:fn_concistent}
+    \end{equation}
+    The problem is then stable with respect to the perturbations $F_n$ in
+    the sense that if $u^*$ is a minimizer of $F$ we have
+    \begin{equation}
+        u_n \rightharpoonup u^*.
+        \label{eq:un_u_weak}
+    \end{equation}
+\end{proposition}
+\begin{proof}
+    As $u_n$ is a minimizer of $F_n$ we have
+    \begin{equation}
+        F_n(u_n) \leq F_n(u^*)
+    \end{equation}
+    and using \eqref{eq:fn_concistent} we get
+    \begin{equation}
+        %\lim F_n(u_n) \leq \limsup F_n(u_n) \leq \limsup F_n(u^*)
+        %= F(u^*) < \infty.
+        \lim_{n \to \infty} F_n(u_n) \leq \lim_{n \to \infty} F_n(u^*) =
+        F(u^*) < \infty.
+    \end{equation}
+    From the coercivity in \eqref{eq:fn_coercive} we obtain that
+    the sequence $u_n$ is bounded in $L^2(\Omega)$ and thus contains a
+    weakly convergent subsequence.
+
+    Assume that the convergence in \eqref{eq:un_u_weak} does not hold,
+    and denote the weakly convergent subsequence by $u_{n_j}
+    \rightharpoonup \bar{u} \neq u^*$. By the weak sequential lower
+    semicontinuity we have
+    \begin{equation}
+        \begin{aligned}
+            F(\bar{u}) &\leq \liminf_{j \to \infty} F\left(u_{n_j}\right) \\
+                       &= \liminf_{j \to \infty} \left(F\left(u_{n_j}\right) -
+        F_{n_j}\left(u_{n_j}\right)\right) + \liminf_{j \to \infty}
+            F_{n_j}\left(u_{n_j}\right) \\
+            &= \liminf_{j \to \infty} F_{n_j}\left(u_{n_j}\right) \\
+            &\leq F(u^*)
+        \end{aligned}
+    \end{equation}
+    which contradicts the uniqueness of $u^*$ and thus we can conclude
+    that the solutions of the perturbed problems converge $u_n
+    \rightharpoonup \bar{u} = u^*$.
+\end{proof}
+
+Note that these are properties of the continuous problem, and that the
+discretizations and numerical methods used for approximating a solution
+can have its own issues with consistency, convergence and stability.
 
 \section{Anisotropic coarea formula}
 
@@ -452,9 +521,11 @@ work.}
 
 \fixme{More flow between the sections. Somehow.}
 
-The anisotropic coarea formula we will present here allows us, as in the
-Euclidean case \fixme{we removed the Euclidean one}, to write the
-anisotropic total variation as an integral over the levels of the image.
+The anisotropic coarea formula we will present here allows us to write
+the anisotropic 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}.
+
 First we define the thresholded image at level $s$.
 \begin{definition}[Thresholded image]
     The thresholded image at level $s$ is the function
@@ -509,11 +580,11 @@ result from measure theory.
 \end{theorem}
 For a proof and further background on measure theory and Lebesgue
 integration theory see for example \cite{bartle1995elements}.
-\begin{proof}[Proof of anisotropic coarea formula.]
+\begin{proof}[Proof of the anisotropic coarea formula.]
     Assume that $u \in C^1(\Omega) \cap \BV(\Omega)$. The extension to
-    all functions $u \in \BV(\Omega)$ can be made by approximation
-    arguments but will not be considered here \fixme{theorem 5.3.3 in
-    ziemer}.
+    all functions $u \in \BV(\Omega)$ will not be considered here, but
+    for the case of regular total variation see \cite[Theorem
+    5.3.3]{ziemer1989}.
 
     %\paragraph{First we prove that $\TVA(u) \leq \int_{-\infty}^\infty
     %\TVA(u^s) \, ds$.}
@@ -586,6 +657,7 @@ integration theory see for example \cite{bartle1995elements}.
     \begin{equation}
         m(t) = \int_{\{ x \in \Omega : u(x) \leq t\}} \norm{\nabla u}_A
         \, dx,
+        \label{eq:mdef}
     \end{equation}
     and note that $m(\infty) = \TVA(u)$ and $m(-\infty) = 0$. Since
     $m(t)$ is non-decreasing with $t$, we can apply the existence
@@ -603,9 +675,9 @@ integration theory see for example \cite{bartle1995elements}.
             \eta_r(t) = \begin{cases}
                 0 & \text{if } t < s, \\
                 (t - s)/r & \text{if } s \leq t < s + r, \\
-                1 & \text{if } t > s + r,
+                1 & \text{if } t \geq s + r,
             \end{cases}
-            & \qquad
+            & \quad
             \eta_r\prime(t) = \begin{cases}
                 0 & \text{if } t < s, \\
                 1 & \text{if } s < t < s + r, \\
@@ -620,14 +692,17 @@ integration theory see for example \cite{bartle1995elements}.
     \begin{equation}
         \int_\Omega - \eta_r(u) \diver \xi \, dx
         = \int_\Omega \eta_r\prime(u) \nabla u\cdot \xi \, dx
-        = \frac{1}{r} \int_{\{ s < u \leq s + r \}} \nabla u\cdot \xi
+        = \frac{1}{r} \int_{\{ s < u < s + r \}} \nabla u\cdot \xi
         \, dx,
+        \label{eq:eta_greens}
     \end{equation}
     for all vector fields $\xi \in C_c^\infty(\Omega, \mathbb{R}^2)$.
-    The measure of $\{ x : u(x) = s \text{ and } \nabla u(x) \neq
-    0\}$ is zero for all $s$ following from \cite[Corollary \rom{1},
-    Section 3.1.2]{evans1991measure}, and thus no problems arise there.
-    Assuming that $\norm{\xi}_A^* \leq 1$ we have
+    The measure of $\{ x : u(x) = \lambda \text{ and } \nabla u(x) \neq
+    0\}$ is zero for all $\lambda$ following from \cite[Corollary \rom{1},
+    Section 3.1.2]{evans1991measure}. Thus we can ignore the sets $\{ u
+    = s\}$ and $\{ u = s + r \}$.
+    Assuming that $\norm{\xi}_A^* \leq 1$ we obtain from \eqref{eq:mdef}
+    and \eqref{eq:eta_greens} that
     \begin{equation}
         \begin{aligned}
             \frac{m(s+r) - m(s)}{r}
@@ -640,17 +715,23 @@ integration theory see for example \cite{bartle1995elements}.
         \label{eq:m_ineq_sr}
     \end{equation}
     As the limit when $r \to 0$ of the left-hand side exists almost
-    everywhere, suppose it exists at $s \in \mathbb{R}$. We apply
-    Lebesgue's dominated convergence theorem on the right-hand side in
-    \eqref{eq:m_ineq_sr}, using that $\abs{\eta_r(u) \diver \xi} \leq
-    \abs{u^s \diver \xi}$. As $\xi \in C^\infty_c(\Omega,
-    \mathbb{R}^2)$, it is bounded by the extreme value theorem, and thus
-    $\abs{u^s \diver \xi}$ is integrable. From \eqref{eq:m_ineq_sr} we
-    then obtain
+    everywhere, suppose it exists at $s \in \mathbb{R}$. The integrand
+    on the right-hand side $-\eta_r(u) \diver \xi$ approaches $-u^s
+    \diver \xi$ pointwise almost everywhere. We apply
+    Lebesgue's dominated convergence theorem 
+    using that $\abs{\eta_r(u) \diver \xi} \leq
+    \abs{u^s \diver \xi}$ and that $\xi \in C^\infty_c(\Omega,
+    \mathbb{R}^2)$ is bounded by the extreme value theorem. Thus
+    $\abs{u^s \diver \xi}$ is integrable and
+    \begin{equation}
+        \int_\Omega -\eta_r(u)
+        \diver \xi \, dx \to \int_\Omega -u^s \diver \xi \, dx
+    \end{equation}
+    From \eqref{eq:m_ineq_sr} we then obtain
     \begin{equation}
-        m\prime(s) \geq - \int_\Omega u^s \diver \xi \, dx
+        m\prime(s) \geq - \int_\Omega u^s \diver \xi \, dx.
     \end{equation}
-    since $\eta_r(u) \to u^s$ when $r \to 0$. As this holds for any
+    As this holds for any
     $\norm{\xi}_A^* \leq 1$, we get from the extended total variation
     definition in \eqref{eq:extended_tv} that $m'(s) \geq \TVA(u_s)$
     almost everywhere and conclude using \eqref{eq:tva_geq_mder} that
@@ -670,7 +751,7 @@ function occurs at the boundary of the set. This is why we introduce
 the following definition of the anisotropic set perimeter.
 \begin{definition}[The anisotropic set perimeter]
     Given an anisotropy tensor $A$ the anisotropic perimeter of a set
-    $U$ is defined as
+    $U$ in $\Omega$ is defined as
     \begin{equation}
         \PerA(U;\Omega) = \TVA(\idfun_U).
     \end{equation}
@@ -678,8 +759,8 @@ the following definition of the anisotropic set perimeter.
 \nomenclature{$\PerA(u;\Omega)$}{Anisotropic perimeter of set $U$ using
 anisotropy tensor $A$.}%
 The anisotropic set perimeter is not like the regular set perimeter and
-does not measure the length of the boundary of the set, but it can be
-calculated in the following way
+does not measure the length of the boundary of the set, but it can for
+sufficiently nice level sets be calculated in the following way
 \begin{equation}
     \begin{aligned}
         \PerA(\{ u > s \}; \Omega) &= \TVA(u^s) \\ &= \sup_{\norm{\xi}_A^* \leq 1}
@@ -690,24 +771,20 @@ calculated in the following way
         \cdot \xi \, dt \\
         &= \sup_{\norm{\eta} \leq 1} \int_{\partial \{ u > s\} } \nu_s
         \cdot \Ahalf \eta \, dt \\
-        &= \int_{\partial \{ u > s\} } \Ahalf \nu_s
-        \cdot \frac{\Ahalf \nu_s}{\norm{\Ahalf \nu_s}} \, dt \\
         &= \int_{\partial \{ u > s\} } \sqrt{\nu_s A \nu_s} \, dt.
     \end{aligned}
     \label{eq:perimeter_calc}
 \end{equation}
-Here, $\nu_s$ is the unit normal of the level set $\{ u > s \}$ and by
-applying the divergence theorem we have assumed that the boundary is
-\fixme{piecewise smooth}, which holds for almost all level sets if $u$ is
-differentiable. A consideration of exterior normals and perimeters of
-level sets of any function $u \in \BV(\Omega)$ will not be considered
-here, but can be found in for example \fixme{ziemer 5.4.1 and 5.5.1, in
-the non-anisotropic case.}
+Here, $\nu_s$ is the unit exterior normal of the level set $\{ u > s \}$.
+Note that because of the compact support of $\xi$ in
+Definition~\ref{def:extended_tv}, the parts of the boundary of $U$ that
+overlap with the boundary of $\Omega$ will not be included in the
+perimeter.
 
-Further note that this is an integral of the anisotropic norm of the
-unit normal vector. The length of the boundary would normally be
-calculated by integrating the norm of the tangent vector. The connection
-will be made after the Cauchy--Crofton formulas have been introduced.
+Exterior normals and perimeters of
+level sets of any function $u \in \BV(\Omega)$ will not be considered
+here, but can for the isotropic case be found in for example
+\cite[Section 5.4 and 5.5]{ziemer1989}.
 
 The anisotropic coarea formula allows us to transform the anisotropic
 total variation such that we are left with minimizing the following
@@ -723,10 +800,7 @@ perimeter will be computed using a graph cut machinery.
 
 \section{Cauchy--Crofton formulas}
 
-\fixme{Rating: 6/10, comment in the beginning that we are actually going
-to introduce two formulas. The transition between the two can be
-smoother as well. And we should refer to maybe Do Carmo, or sketch a
-proof of the Euclidean one. The stuff after the proof could use some
+\fixme{Rating: 7/10, the stuff after the proof could use some
 work.}
 
 \begin{figure}
@@ -739,7 +813,8 @@ category often referred to as \emph{Cauchy--Crofton style formulas}, and
 give ways to measure geometric objects using the set of all lines in the
 plane. The formulas presented here will give a way to measure the length
 of a curve by counting the times it intersects line in the set of all
-lines.
+lines. The first formula will be for the isotropic case, and we will
+use this to prove the anisotropic formula following it.
 
 We write $\mathcal{L}$ for the set of all lines in the plane,
 and parametrize them as shown in Figure~\ref{fig:line_param}. A
@@ -1108,16 +1183,13 @@ If $P$ is a 90\textdegree{} rotation matrix we have
     \label{eq:per_to_length1}
 \end{equation}
 We simplify the equation by defining the metric tensor $M(x) = P A(x)
-P^T$ and letting $\gamma = \partial U$ be an arclength parametrization of
-the boundary of $U$ to obtain
+P^T$ and letting $\gamma = \partial U \cap \Omega$ be an arclength parametrization of
+the boundary of $U$ that does not overlap with the boundary of $\Omega$
 \begin{equation}
     \PerA(U; \Omega) = \int_\gamma \sqrt{\langle \dot{\gamma}, M(x) \,
-    \dot{\gamma} \rangle }.
+    \dot{\gamma} \rangle } \, dt.
     \label{eq:per_to_length2}
 \end{equation}
-Note that since $\Omega$ is open, we assume that $\gamma = \partial U
-\subset \Omega$ and thus $\gamma$ can not include parts of the boundary
-of $\Omega$. \fixme{rewrite}
 
 Now we make sure that all the assumptions of the Riemannian
 Cauchy--Crofton formula in Theorem~\ref{thm:riemannian_cauchy_crofton}
@@ -1160,7 +1232,7 @@ perimeter in \eqref{eq:per_to_length2} as
     {2 \left( \nu^T \cdot M(x) \cdot \nu \right)^{\sfrac{3}{2}}}
     \, d\mathcal{L}(\ell_{\nu, \rho}) \, ds,
 \end{equation}
-where $\gamma = \partial U$.
+where $\gamma = \partial U \cap \Omega$.
 Note that $P$ does not affect the determinant, i.e.\
 $\det A = \det PAP^T = \det M$, and from our decomposition in
 \eqref{eq:sigma_construction} we see that the transformation $PAP^T \to