From: Bjørn Rustad Date: Wed, 28 Jan 2015 18:24:48 +0000 (+0100) Subject: Figure texts etc X-Git-Url: http://git.rustad.me/?a=commitdiff_plain;h=cba852870e3706b333370a4bb99efc3585a2160b;p=master Figure texts etc --- diff --git a/fig/area_proof.tex b/fig/area_proof.tex index 9822aef..d19c6e1 100644 --- a/fig/area_proof.tex +++ b/fig/area_proof.tex @@ -59,7 +59,7 @@ \path (1,3) [edge,-,red] -- ($(2,2)!(1,3)!(0,3)$); \end{tikzpicture} -\caption{ +\caption[A visual argument for $\delta^2 = \Delta \rho \norm{e}$]{ A visual argument showing that $\delta^2 = \Delta \rho \norm{e}$. If extended to the whole plane, there will be the same amount of blue squares as red rectangles, so their areas must be equal. diff --git a/fig/aug_flow.tex b/fig/aug_flow.tex index 458818a..7b9325b 100644 --- a/fig/aug_flow.tex +++ b/fig/aug_flow.tex @@ -14,7 +14,7 @@ \path[edge] (u) -- node[weight] {0/5} (t); \path[edge] (v) -- node[weight] {5/5} (t); \end{tikzpicture} -\caption{A graph with the flow and capacity of each edge shown as +\caption[Augmenting flow example graph]{A graph with the flow and capacity of each edge shown as flow/capacity. The marked path is a valid augmenting path from $s$ to $t$, and by increasing the flow along it, we will push flow back from $v$ to $u$. diff --git a/fig/big_graph.tex b/fig/big_graph.tex index d905378..d3819c8 100644 --- a/fig/big_graph.tex +++ b/fig/big_graph.tex @@ -32,7 +32,7 @@ } } \end{tikzpicture} -\caption{ +\caption[The structure of the final graph construction]{ A visualization of the final graph, with edges between neighboring pixels, and edges connecting the source and sink to the rest of the graph. The edge capacities are not visualized, and of course some diff --git a/fig/bk_norm_subgraph.tex b/fig/bk_norm_subgraph.tex index 864b589..3f7a050 100644 --- a/fig/bk_norm_subgraph.tex +++ b/fig/bk_norm_subgraph.tex @@ -4,8 +4,8 @@ \node[vertex] (u) at (0, -1) {$u^\lambda_x$}; \node[vertex] (t) at (0, -2) {t}; - \path[edge] (s) -- node[weight noslope] {$\max\{E_{L-1}^x(1), 0\}$} (u); - \path[edge] (u) -- node[weight noslope] {$\max\{E_{L-1}^x(1), 0\} - E_\lambda^x(1)$} (t); + \path[edge] (s) -- node[weight noslope] {$\max\{F_{L-1}^x(1), 0\}$} (u); + \path[edge] (u) -- node[weight noslope] {$\max\{F_{L-1}^x(1), 0\} - F_\lambda^x(1)$} (t); \end{tikzpicture} \caption{% \fixme{boop} diff --git a/fig/circ_rule.tex b/fig/circ_rule.tex index db1df7c..2c01ca7 100644 --- a/fig/circ_rule.tex +++ b/fig/circ_rule.tex @@ -32,7 +32,8 @@ } \end{tikzpicture} -\caption{% +\caption[Consistency argument for the angle discretization]{% + \fixme{noooo} We showed that the angular difference between subsequent angle parameters goes to zero. The discretization in the $\phi$ dimension can be viewed as a rectangle approximation rule of the integral, as diff --git a/fig/curve_edge.tex b/fig/curve_edge.tex index 5446e8e..e1f4d8c 100644 --- a/fig/curve_edge.tex +++ b/fig/curve_edge.tex @@ -48,9 +48,11 @@ %\path[edge] (a) -- (i); \end{tikzpicture} -\caption{ +\caption[Visualization of the approximation error relating to long +edges]{% Here our intersection approximation would not be correct, as only - the intersection with edge $b$ is counted in \fixme{ref}, even + the intersection with edge $b$ is counted in + \eqref{eq:final_discretization}, even though the curve intersects edge $a$ twice. } \label{fig:curve_edge} diff --git a/fig/eta_r.tex b/fig/eta_r.tex index 280b187..dcffa84 100644 --- a/fig/eta_r.tex +++ b/fig/eta_r.tex @@ -58,7 +58,7 @@ \caption{$\eta_r'(t)$} \label{fig:eta_r_diff} \end{subfigure} -\caption{ +\caption[The cut-off function $\eta_r(t)$ and its derivative]{% Visualization of the cut-off function $\eta_r(t)$ and its derivative. } \label{fig:eta_r_both} diff --git a/fig/factory/contrast.m b/fig/factory/contrast.m index edb785e..5f56138 100644 --- a/fig/factory/contrast.m +++ b/fig/factory/contrast.m @@ -4,6 +4,20 @@ atv2 = imread('finger/r_p2_n32_b21450_g150_r10_s3.pgm'); close all; hold on; +printf("tv: "); +double(max(tv(:)) - min(tv(:)))/double(max(tv(:)) + min(tv(:))) + +dtv = im2double(tv); +ref = mean(dtv(:)) * ones(size(dtv)); +sq = (dtv - ref) .^ 2; +msqe = mean(sq(:)); +rms = sqrt((1.0/(size(dtv)(1) * size(dtv)(2))) * msqe) + +printf("atv1: "); +double(max(atv1(:)) - min(atv1(:)))/double(max(atv1(:)) + min(atv1(:))) +printf("atv2: "); +double(max(atv2(:)) - min(atv2(:)))/double(max(atv2(:)) + min(atv2(:))) + plot(atv1(100,:), 'r'); plot(atv2(100,:), 'g'); plot(tv(100,:), 'b'); diff --git a/fig/factory/contrast.tex b/fig/factory/contrast.tex index a543af9..97f20bb 100644 --- a/fig/factory/contrast.tex +++ b/fig/factory/contrast.tex @@ -1,7 +1,7 @@ % Title: glps_renderer figure % Creator: GL2PS 1.3.8, (C) 1999-2012 C. Geuzaine % For: Octave -% CreationDate: Wed Jan 28 15:31:23 2015 +% CreationDate: Wed Jan 28 18:12:01 2015 \begin{pgfpicture} \pgfsetlinewidth{0.01pt} \color[rgb]{1.000000,1.000000,1.000000} diff --git a/fig/line_disc.tex b/fig/line_disc.tex index ec5b865..6358bbb 100644 --- a/fig/line_disc.tex +++ b/fig/line_disc.tex @@ -109,7 +109,7 @@ \caption{One family of lines having the same $\phi$ parameter.} \label{fig:line_family} \end{subfigure} -\caption{ +\caption[The discrete set of lines $\mathcal{L}_D$]{% The set of lines $\mathcal{L}$ is discretized to $\mathcal{L}_D$ where each line belongs to a family given by $\phi$, the angle parameter. diff --git a/fig/line_midpoint.tex b/fig/line_midpoint.tex index 6472187..995a483 100644 --- a/fig/line_midpoint.tex +++ b/fig/line_midpoint.tex @@ -67,7 +67,7 @@ %\path[edge] (a) -- (i); \end{tikzpicture} -\caption{ +\caption[Consistency argument for the line distance $\rho$]{ The discretization in the $\rho$ dimension can be regarded as a midpoint rule approximation of the integral, since the difference $\Delta \rho$ the same for all lines in one line family. diff --git a/fig/line_param.tex b/fig/line_param.tex index 05e94f8..703d85d 100644 --- a/fig/line_param.tex +++ b/fig/line_param.tex @@ -25,7 +25,7 @@ \path (0,0) +(25:1.3cm) node {$\phi$}; \end{tikzpicture} -\caption{ +\caption[Line parametrization by angle and distance]{% The blue line is parametrized by the angle $\phi$ and the distance from the origin to the line $\rho$, or alternatively, the pair $(\nu, \rho)$. diff --git a/fig/lower_semicont.tex b/fig/lower_semicont.tex index 32850ee..2e36761 100644 --- a/fig/lower_semicont.tex +++ b/fig/lower_semicont.tex @@ -22,7 +22,7 @@ ] (s) at (3, 2.19) {}; \end{tikzpicture} -\caption{ +\caption[Lower semicontinuous function $f$]{ A lower semicontinuous 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/fig/neigh_subgraph.tex b/fig/neigh_subgraph.tex index 54935b4..c659884 100644 --- a/fig/neigh_subgraph.tex +++ b/fig/neigh_subgraph.tex @@ -11,7 +11,7 @@ \path[edge] (u) -- node[weight] {$2w_{xy}$} (v); \path[edge] (v) -- node[weight] {$w_{xy}$} (t); \end{tikzpicture} - \caption{Representing $E^{x,y}(u^\lambda_x, u^\lambda_y)$ with a + \caption{Representing $F^{x,y}(u^\lambda_x, u^\lambda_y)$ with a constant term of $w_{xy}$.} \label{fig:neigh_subgraph_alt1} \end{subfigure} @@ -31,14 +31,15 @@ {$w_{xy}$} ([yshift=-1.5pt]u.east); \end{tikzpicture} - \caption{Representing $E^{x,y}(u^\lambda_x, u^\lambda_y)$ with a + \caption{Representing $F^{x,y}(u^\lambda_x, u^\lambda_y)$ with a constant term of 0.} \label{fig:neigh_subgraph_alt2} \end{subfigure} -\caption{Two alternative ways of constructing a graph representing - the energy term $E^{x,y}(u^\lambda_x, u^\lambda_y)$. See Table - \ref{tab:neigh_energy} for an overview of the different possible - configurations of $(u^\lambda_x, u^\lambda_y)$ and how they +\caption[Graph construction for the regularization term $F^{x,y}$]{% + Two alternative ways of constructing a graph representing + the energy term $F^{x,y}(u^\lambda_x, u^\lambda_y)$. See + Table~\ref{tab:neigh_energy} for an overview of the different + possible configurations of $(u^\lambda_x, u^\lambda_y)$ and how they correspond to cuts through the graph. } \label{fig:neigh_subgraph} diff --git a/fig/norm_evolution.tex b/fig/norm_evolution.tex index 8373460..7a20014 100644 --- a/fig/norm_evolution.tex +++ b/fig/norm_evolution.tex @@ -3,7 +3,7 @@ \centering \begin{tikzpicture} \draw[->] (0,0) -- (4,0) node[right] {$\lambda$}; - \draw[->] (0,-2) -- (0,2) node[above] {$E_\lambda^x(1)$}; + \draw[->] (0,-2) -- (0,2) node[above] {$F_\lambda^x(1)$}; \draw[line,domain=0:1] plot ({\x},{-1}); \draw[line,domain=1:2,dashed] plot ({\x},{2*\x-3}); \draw[line,domain=2:4] plot ({\x},{1}); @@ -12,13 +12,13 @@ font=\small, anchor=south ] - {$v_x-1$}; + {$f_x-1$}; \draw (2,2pt) -- (2,-2pt) node[ font=\small, anchor=north ] - {$v_x$}; + {$f_x$}; \end{tikzpicture} \caption{$L^1$ fidelity term.} @@ -29,26 +29,27 @@ \centering \begin{tikzpicture} \draw[->] (0,0) -- (4,0) node[right] {$\lambda$}; - \draw[->] (0,-2) -- (0,2) node[above] {$E_\lambda^x(1)$}; + \draw[->] (0,-2) -- (0,2) node[above] {$F_\lambda^x(1)$}; \draw[line,domain=0:4] plot ({\x},{.8*\x - 1.6}); \draw (2.5,2pt) -- (2.5,-2pt) node[ font=\small, anchor=north ] - {$v_x$}; + {$f_x$}; \draw (1.5,2pt) -- (1.5,-2pt) node[ font=\small, anchor=south ] - {$v_x-1$}; + {$f_x-1$}; \end{tikzpicture} \caption{$L^2$ fidelity term.} \label{fig:l2_norm_evolution} \end{subfigure} -\caption{Two figures showing how the fidelity energy term $E_\lambda^x(1)$ +\caption[Fidelity energy $F_\lambda^x(1)$ as a function of $\lambda$]{% + Two figures showing how the fidelity energy term $F_\lambda^x(1)$ in \eqref{eq:total_energy} increases monotonically with $\lambda$. } \label{fig:norm_evolution} diff --git a/fig/norm_subgraph.tex b/fig/norm_subgraph.tex index 7162104..dbb9461 100644 --- a/fig/norm_subgraph.tex +++ b/fig/norm_subgraph.tex @@ -6,10 +6,10 @@ \node[vertex] (u) at (0, -1) {$u^\lambda_x$}; \node[vertex] (t) at (0, -2) {t}; - \path[edge] (s) -- node[weight noslope] {$E_\lambda^x(1)$} (u); + \path[edge] (s) -- node[weight noslope] {$F_\lambda^x(1)$} (u); \end{tikzpicture} \caption{% - The graph when $E_\lambda^x(1) > 0$, with constant equal to 0. + The graph when $F_\lambda^x(1) > 0$, with constant equal to 0. } \label{fig:norm_subgraph_pos} \end{subfigure} @@ -21,15 +21,15 @@ \node[vertex] (u) at (0, -1) {$u^\lambda_x$}; \node[vertex] (t) at (0, -2) {t}; - \path[edge] (u) -- node[weight noslope] {$-E_\lambda^x(1)$} (t); + \path[edge] (u) -- node[weight noslope] {$-F_\lambda^x(1)$} (t); \end{tikzpicture} - \caption{Graph when $E_\lambda^x(1) < 0$, with constant equal to - $-E_\lambda^x(1)$. + \caption{Graph when $F_\lambda^x(1) < 0$, with constant equal to + $-F_\lambda^x(1)$. } \label{fig:norm_subgraph_neg} \end{subfigure} -\caption{% - The graph construction for the fidelity term $E_\lambda^x(u^\lambda_x)$. +\caption[Graph construction for the fidelity term $F_\lambda^x$]{% + The graph construction for the fidelity term $F_\lambda^x(u^\lambda_x)$. See Table~\ref{tab:fid_energy} for an overview of the different possible cuts, and on why this construction works. } diff --git a/fig/pixel_perimeter.tex b/fig/pixel_perimeter.tex index d0904f6..45abed7 100644 --- a/fig/pixel_perimeter.tex +++ b/fig/pixel_perimeter.tex @@ -33,7 +33,8 @@ \node[tiny vertex,draw] at (3, 3) {}; \end{tikzpicture} -\caption{% +\caption[Approximation error when calculating the perimeter of one +pixel]{% A selection of edges contributing to the wrong approximation of the length of a single pixel's perimeter. The edges cross the perimeter twice, but we count zero crossings in our approximation. This leads diff --git a/fig/square_cons.tex b/fig/square_cons.tex index 979a867..ebf5fbf 100644 --- a/fig/square_cons.tex +++ b/fig/square_cons.tex @@ -61,7 +61,7 @@ sep=1.7pt] {$\sqrt{\delta}$} (5.3, 5.6) {}; \end{tikzpicture} -\caption{ +\caption[Consistent neighborhood construction]{% To show that we have a consistent discretization of the Cauchy--Crofton integral formula, we construct a discrete set of lines $\mathcal{L}_D$ such that the length of the edges $\norm{e}$, diff --git a/fig/tensor_viz.tex b/fig/tensor_viz.tex index 57d7ae2..ee74351 100644 --- a/fig/tensor_viz.tex +++ b/fig/tensor_viz.tex @@ -37,8 +37,9 @@ } \end{subfigure} -\caption{% - An edge with the structure and anisotropy tensors visualized as +\caption[Eigenvectors and eigenvalues of the structure and anisotropy +tensors]{% + An edge with the structure and anisotropy tensors visualized using their eigenvectors and eigenvalues. } \label{fig:tensor_viz} diff --git a/results.tex b/results.tex index 708a902..10e5e93 100644 --- a/results.tex +++ b/results.tex @@ -4,7 +4,8 @@ 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 how it affects the performance of the restoration algorithm. +see how the introduction of the anisotropy affects the performance of +the restoration algorithm. \section{Tensor parameters} @@ -34,7 +35,7 @@ see how it affects the performance of the restoration algorithm. Normal tensor. } \end{subfigure} - \caption{% + \caption[Restoration using a uniform tensor]{% A noisy circle first restored using a uniform tensor, resulting mostly in smoothing in the $x$-direction. Then restored using the tensor described in Section~\ref{sec:anisotropy_tensor}. @@ -49,7 +50,7 @@ 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 f_\sigma$ in the $y$-direction, and thus regularization +size of $\nabla u$ in the $y$-direction, and thus regularization mostly in the $x$-direction. The results of this experiment can be seen in @@ -118,7 +119,8 @@ the $y$-direction. } \label{fig:lena_process_restored} \end{subfigure} - \caption{% + \caption[The different stages of the restoration algorithm + visualized]{% The different stages of the restoration algorithm, showing the original image, the smoothed image, the edge detector, two visualizations of the anisotropy tensor, and finally the @@ -137,8 +139,9 @@ $\sigma$, and the result is shown in Figure~\ref{fig:lena_process_blur}. The blurring is done so that the edge detector $\nabla f_\sigma$, which is shown squared and normalized in Figure~\ref{fig:lena_process_edge}, is not too sensitive to noise in the image. The structure tensor is then -constructed using $\nabla f_\sigma$, and further transformed into the -anisotropy tensor, which is visualized in +constructed using $\nabla f_\sigma$ and smoothed according to the +integration scale $\rho$. +The resulting anisotropy tensor is visualized in Figure~\ref{fig:lena_process_tensor}. In a selection of points, the tensor has been drawn as its two eigenvectors, with the corresponding eigenvalue as its length, and we clearly see that the eigenvalues are @@ -146,21 +149,22 @@ smaller across edges. Another way of visualizing the tensor, which makes it possible to see it in every point, is using the color wheel in Figure~\ref{fig:color_wheel}. The color is decided by the tensor angle, while the brightness, or the radius in the wheel, is set to $1 / -\lambda_2$, the inverse of the smallest eigenvalue. Thus the stronger -the anisotropy, the brighter the color, while for smooth areas we expect -black. +\lambda_2$, the inverse of the smallest eigenvalue of the metric tensor +$M(x)$. Thus the stronger the anisotropy, the brighter the color, while +we expect smooth areas in the original image to be black. \begin{figure} \centering \includegraphics[width=0.3\textwidth]{fig/wheel.png} - \caption{% - Color wheel. + \caption[Color wheel]{% + Color wheel used for tensor visualization. } \label{fig:color_wheel} \end{figure} Finally, Figure~\ref{fig:lena_process_restored} shows the restored -image, and we see that it has been heavily regularized. +image, and we see that it has been heavily regularized. How the +anisotropy affected the regularization is not obvious however. \begin{figure} \centering @@ -206,7 +210,8 @@ image, and we see that it has been heavily regularized. } \label{fig:scale_comp_int} \end{subfigure} - \caption{% + \caption[Effects of the $\sigma$ and $\rho$ parameters on + restoration]{% An example constructed to show the effects of the parameters $\sigma$ and $\rho$ in the anisotropy tensor. The noise scale $\sigma$ controls what is considered to be noise, while the @@ -221,8 +226,8 @@ construction we have a constructed a zebra pattern of increasing width as shown in Figure~\ref{fig:scale_comp}. The anisotropy introduced 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 how the different scales -affect the regularization. +$x$-direction across the edges. There is however the question of how the +different scales $\sigma$ and $\rho$ affect the regularization. In Figure~\ref{fig:scale_comp_high} the noise scale is increased such that the edge detector, and thus the anisotropy tensor, considers the @@ -239,15 +244,16 @@ favour of the larger, more coherent structure around it. \centering \begin{subfigure}[t]{0.30\textwidth} \centering - \includegraphics[width=\textwidth]{fig/factory/finger/n_q300.png} + \includegraphics[width=\textwidth]{fig/factory/finger/n_q200.png} \caption{% Noisy fingerprint. } + \label{fig:noisy_fingerprint} \end{subfigure} ~ \begin{subfigure}[t]{0.30\textwidth} \centering - \includegraphics[width=\textwidth]{fig/factory/finger/r_p2_n32_b9000_g80_r10_s3_color.png} + \includegraphics[width=\textwidth]{fig/factory/finger/r_p2_n32_b15000_g150_r10_s3_color.png} \caption{% $\rho = 10$ } @@ -255,12 +261,12 @@ favour of the larger, more coherent structure around it. ~ \begin{subfigure}[t]{0.30\textwidth} \centering - \includegraphics[width=\textwidth]{fig/factory/finger/r_p2_n32_b9000_g80_r20_s3_color.png} + \includegraphics[width=\textwidth]{fig/factory/finger/r_p2_n32_b15000_g150_r20_s3_color.png} \caption{% $\rho = 20$ } \end{subfigure} - \caption{% + \caption[Anisotropy tensor visualized for a fingerprint test image]{% A noisy fingerprint with the anisotropy tensor visualized for different integration scales $\rho$. } @@ -287,7 +293,7 @@ not point in one single direction. ~ \begin{subfigure}[t]{0.30\textwidth} \centering - \includegraphics[width=\textwidth]{fig/factory/circle_deform/r_p2_n8_b100000_g10000000000_r1_s1.png} + \includegraphics[width=\textwidth]{fig/factory/circle_deform/r_p2_n8_b200000_g10000000000_r1_s1.png} \caption{% $\abs{\mathcal{N}} = 8$. } @@ -296,7 +302,7 @@ not point in one single direction. ~ \begin{subfigure}[t]{0.30\textwidth} \centering - \includegraphics[width=\textwidth]{fig/factory/circle_deform/r_p2_n72_b100000_g10000000000_r1_s1.png} + \includegraphics[width=\textwidth]{fig/factory/circle_deform/r_p2_n72_b200000_g10000000000_r1_s1.png} \caption{% $\abs{\mathcal{N}} = 72$. } @@ -314,7 +320,7 @@ not point in one single direction. ~ \begin{subfigure}[t]{0.30\textwidth} \centering - \includegraphics[width=\textwidth]{fig/factory/octagon/r_p2_n8_b100000_g10000000000_r1_s1.png} + \includegraphics[width=\textwidth]{fig/factory/octagon/r_p2_n8_b200000_g10000000000_r1_s1.png} \caption{% $\abs{\mathcal{N}} = 8$. } @@ -323,7 +329,7 @@ not point in one single direction. ~ \begin{subfigure}[t]{0.30\textwidth} \centering - \includegraphics[width=\textwidth]{fig/factory/octagon/r_p2_n72_b100000_g10000000000_r1_s1.png} + \includegraphics[width=\textwidth]{fig/factory/octagon/r_p2_n72_b200000_g10000000000_r1_s1.png} \caption{% $\abs{\mathcal{N}} = 72$. } @@ -341,7 +347,7 @@ not point in one single direction. ~ \begin{subfigure}[t]{0.30\textwidth} \centering - \includegraphics[width=\textwidth]{fig/factory/rombus/r_p2_n4_b100000_g10000000000_r1_s1.png} + \includegraphics[width=\textwidth]{fig/factory/rombus/r_p2_n4_b200000_g10000000000_r1_s1.png} \caption{% $\abs{\mathcal{N}} = 4$. } @@ -350,13 +356,14 @@ not point in one single direction. ~ \begin{subfigure}[t]{0.30\textwidth} \centering - \includegraphics[width=\textwidth]{fig/factory/rombus/r_p2_n72_b100000_g10000000000_r1_s1.png} + \includegraphics[width=\textwidth]{fig/factory/rombus/r_p2_n72_b200000_g10000000000_r1_s1.png} \caption{% $\abs{\mathcal{N}} = 72$. } \label{fig:n_square_72} \end{subfigure} - \caption{% + \caption[Shapes restored to show artifacts introduced by + neighborhood choice]{% Different test images restored without anisotropy, different neighborhoods and a large restoration parameter $\beta$. We see how different neighborhood stencils introduce different @@ -377,26 +384,27 @@ edge lengths $e$ are ``small.'' Figure~\ref{fig:neigh_shapes} shows three images of different shapes that are heavily regularized using different neighborhood stencils. In these results we see some of the artifacts that may occur because of -this discretization method. It is clear that the size-8 stencil prefers -horizontal, vertical and 45\textdegree{} lines, such that the circle in +this particular discretization method. It is clear that the stencil of +size 8 prefers +horizontal, vertical and 45\textdegree{} perimeters, such that the circle in Figure~\ref{fig:n_circle} is shaped like an octagon when regularized in -Figure~\ref{fig:n_circle_8}. The neighborhood of size 72 manages to -keep the circular shape however. +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 size-8 stencil +Next, 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. -The tilted square in Figure~\ref{fig:n_square}, hints that a size-4 -neighborhood favors horizontal and vertical edges only. While the larger -size-72 neighborhood retains the square shape but smoothes the corners -some. +The tilted square in Figure~\ref{fig:n_square}, hints that a stencil of +size 4 neighborhood favors horizontal and vertical edges only. While the +larger stencil of size 72 retains the square shape but rounds the +corners some. \begin{figure} \centering \begin{subfigure}[t]{0.46\textwidth} \centering - \includegraphics[trim=240 170 110 180,clip=true,width=\textwidth]{fig/factory/lena_neigh/r_p2_n16_b2000_g80_r10_s5.png} + \includegraphics[trim=240 170 110 180,clip=true,width=\textwidth]{fig/factory/lena_neigh/r_p2_n16_b4000_g80_r10_s5.png} \caption{% $\abs{\mathcal{N}} = 16$ } @@ -404,12 +412,12 @@ some. ~ \begin{subfigure}[t]{0.46\textwidth} \centering - \includegraphics[trim=240 170 110 180,clip=true,width=\textwidth]{fig/factory/lena_neigh/r_p2_n72_b2000_g80_r10_s5.png} + \includegraphics[trim=240 170 110 180,clip=true,width=\textwidth]{fig/factory/lena_neigh/r_p2_n72_b4000_g80_r10_s5.png} \caption{% $\abs{\mathcal{N}} = 72$ } \end{subfigure} - \caption{% + \caption[Noisy Lena restored using different neighborhood stencils]{% Noisy Lena restored using different neighborhood stencils. Note how the large neighborhood introduces some pixel size artifacts. } @@ -421,9 +429,11 @@ some. \end{figure} \begin{table} - \caption{% + \caption[Circle circumferences estimated by the Cauchy--Crofton + formula]{% The circumference of circles of different radii $r$ measured by the - discretized Cauchy--Crofton formula in \eqref{ref}, using different + discretized Cauchy--Crofton formula in + \eqref{eq:final_discretization}, using different neighborhood stencils. } \centering @@ -451,20 +461,23 @@ $\abs{u^\lambda_a - u^\lambda_b}$, an approximation that becomes worse for long edges. Thus a larger neighborhood is not always better, even if it will reduce the artifacts discussed above. In Figure~\ref{fig:lena_neigh}, a noisy image of Lena -has been restored using two differently sized neighborhood stencils, and +has been restored using two neighborhood stencils, and there are obvious differences. For the stencil of size 72, the restored -image still contains some pixel-sized noise, seemingly very -different from their neighboring pixels. An explanation can be found in -Figure~\ref{fig:pixel_perimeter}. We see that the length of a -one-pixel curve is underestimated by the Cauchy--Crofton formula because -many edges cross the curve cross while $\abs{u^\lambda_a - u^\lambda_b} -= 0$, and thus these edges are ignored completely in our perimeter -approximation. An additional demonstration that this problem mostly relates +image still contains some pixel-sized noise. +An explanation can be found in +Figure~\ref{fig:pixel_perimeter}. We see why the length of a +one-pixel curve is underestimated by the Cauchy--Crofton formula when +some of the edges are long. Because +many edges $e_{ab}$ cross the curve cross while $\abs{u^\lambda_a - u^\lambda_b} += 0$, thus these edges are ignored completely in our perimeter +approximation. + +An additional demonstration that this problem mostly relates to small sized noise is shown in Table~\ref{tab:circumference}. The table shows how our discrete Cauchy--Crofton formula approximates the 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. +approximated is that of an actual continuous circle $u : \mathbb{R}^2 +\to \{0, 1\}$ and not a discrete representation. \section{Restoration} @@ -472,30 +485,35 @@ not a discrete representation. \centering \begin{subfigure}[t]{0.30\textwidth} \centering - \includegraphics[width=\textwidth]{fig/factory/finger/n_q300.png} + \includegraphics[width=\textwidth]{fig/factory/finger/r_p2_n32_b15000_g1000000000000_r10_s3.png} \caption{% - Noisy fingerprint. + Regular TV,\\ $\beta=15000$,\\ $\norm{u - f}_{L^1} = + 2886817$. } + \label{fig:finger_contrast_tv} \end{subfigure} ~ \begin{subfigure}[t]{0.30\textwidth} \centering - \includegraphics[width=\textwidth]{fig/factory/finger/r_p2_n32_b9000_g1000000000000_r10_s3.png} + \includegraphics[width=\textwidth]{fig/factory/finger/r_p2_n32_b15000_g150_r10_s3.png} \caption{% - Restored without anisotropy. + Anisotropic TV ($\gamma = 150$), $\beta=15000$, + $\norm{u - f}_{L^1} = 2558191$. } - \label{fig:finger_contrast_tv} + \label{fig:finger_contrast_atv1} \end{subfigure} ~ \begin{subfigure}[t]{0.30\textwidth} \centering - \includegraphics[width=\textwidth]{fig/factory/finger/r_p2_n32_b9000_g150_r10_s3.png} + \includegraphics[width=\textwidth]{fig/factory/finger/r_p2_n32_b21450_g150_r10_s3.png} \caption{% - Restored with much anisotropy. + Anisotropic TV ($\gamma = 150$), $\beta=21450$, + $\norm{u - f}_{L^1} = 2886529$. } - \label{fig:finger_contrast_atv} + \label{fig:finger_contrast_atv2} \end{subfigure} - \caption{% + \caption[Comparison contrast loss in regular an anisotropic restoration]{% + \fixme{nope} A noisy fingerprint restored using both isotropic and anisotropic total variation. All parameters are kept constant except for $\omega$, the anisotropy parameter. @@ -505,23 +523,44 @@ not a discrete representation. We have claimed that the anisotropic total variation will reduce some of the contrast loss one can encounter with regular total variation -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}. It is however not obvious what this +regularization. In Figure~\ref{fig:finger_contrast} the noisy +fingerprint from Figure~\ref{fig:noisy_fingerprint} +has been restored three times with different parameters. The first using +regular total variation and $\beta = 15000$, then the second with $\beta += 15000$ and anisotropy +$\omega = 150$. This gives an obvious contrast enhancement, +but 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 +decreasing the total amount of regularization done, and less contrast loss is an expected outcome of decreasing the regularization, disregarding the anisotropy. +Thus in the last +image we have also used $\omega = 150$ but the restoration +amount $\beta$ is increased such that the amount of noise removed +$\norm{u - f}_{L^1}$ is +approximately equal to the noise removed when using regular total +variation in Figure~\ref{fig:finger_contrast_tv}. By visual inspection, +the last image seems to have somewhat higher contrast. This can be +confirmed by calculating the standard deviation of the images, one of +many possible contrast measures, which gives 22.9, 37.9 and 26.6 +respectively. + +To further compare the three restored images, a single row has been +extracted from the three images and is shown agains eachother in +Figure~\ref{fig:contrast_plot}. Note that although the results in +Figure~\ref{fig:finger_contrast_atv2} look promising compared to +Figure~\ref{fig:finger_contrast_tv}, some details in the singularity in +the upper left is actually lost. The metric tensor is approximately the +identity matrix there, and thus an increased restoration parameter +$\beta$ leads to increased smoothing. + \begin{figure} \centering \input{fig/factory/contrast} - \caption{% + \caption[1D slice through restored fingerprints showing contrast + differences]{% A one-dimensional slice through the restored fingerprint images of Figure~\ref{fig:finger_contrast}, showing a difference in the contrast. diff --git a/theory.tex b/theory.tex index f504259..75b8ad1 100644 --- a/theory.tex +++ b/theory.tex @@ -1219,12 +1219,12 @@ from zero, as + \frac{(s_1 - s_2)^2}{\omega^2}\right)^{-1} \geq \left(1 + \frac{s_1^2}{\omega^2}\right)^{-1} \geq k > 0. \end{equation} -Hence, our metric tensor $M(x) = P A(x) P^T$ and curve length -calculation in -\eqref{eq:per_to_length2} fulfill all the assumptions of the anisotropic -Cauchy--Crofton formula in Theorem~\ref{thm:riemannian_cauchy_crofton}. -\fixme{did we argue for -continuous? and pos def?} Thus we can apply the formula to calculate the +Hence our metric tensor $M(x) = P A(x) P^T$ is continuous and positive +definite and thus the curve length calculation in +\eqref{eq:per_to_length2} fulfills all the assumptions of the +anisotropic Cauchy--Crofton formula in +Theorem~\ref{thm:riemannian_cauchy_crofton}. +Thus we can apply the formula to calculate the perimeter in \eqref{eq:per_to_length2} as \begin{equation} \PerA(U; \Omega) = \int_\mathcal{L} \sum_{x \in @@ -1253,11 +1253,11 @@ lines. We are then left with the functional where \begin{equation} \TVA(u) = \int_{-\infty}^\infty \int_{\mathcal{L}} \sum_{x \in - \ell_{\nu, \rho} \cap C_s} \frac{\det M(x)} + \ell_{\nu, \rho} \cap \gamma_s} \frac{\det M(x)} {2 \left( \nu^T \cdot M(x) \cdot \nu \right)^{\sfrac{3}{2}}} - \, d\mathcal{L}(\ell_{\nu, \rho}) \, ds. + \, d\mathcal{L}(\ell_{\nu, \rho}) \, ds, \end{equation} -\fixme{define $C_s$. $C_s$ vs $\gamma$.} +and $\gamma_s = \partial \{u > s\} \cap \Omega$. Within the restrictions that these theorems put on the tensor $M(x)$, we have chosen a construction where one eigenvalue is always 1, while the other varies from 1 in smooth areas towards 0 around edges, with the @@ -1558,6 +1558,7 @@ Thus we have arrived at our final discretization, which takes the form \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} \end{gather} Recall that $N_x(\lambda) = \abs{ \lambda - f_x }^2$. @@ -1717,18 +1718,21 @@ 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. -\subsubsection{Stability and convergence} - -\fixme{Boop.} - \section{Graph cut formulation} -Maybe this is more tightly connected with the previous section, but the -main point is that we describe how the edge weights are computed. +The discretization we arrived at in \eqref{eq:final_discretization} can +be minimized using graph cuts. For each level $\lambda$, a minimum graph +cut is found to produce the corresponding level set $\{ u > \lambda \}$. These +are then combined to form the final restored image $u$. + +In this section we will look at how these graphs are constructed such +that their minimum cuts correspond to the minimizers of the functional +$F^\lambda$. The description is taken from my project work +\cite{project}, and is included here for completeness. \subsection{Graphs} -\fixme{Maybe just call them graphs this time?} +\fixme{Maybe just call them graphs this time? from $E$ to $F$!} Using the notation of \cite{cormen2009introduction} we will denote a directed graph as $G = (V, E)$ where $V$ is a finite set of vertices, and @@ -1987,9 +1991,12 @@ carefully constructed graph can give us the thresholded image minimizing the energy function for one level value $\lambda$. We will in this and the next section see how such a minimum cut can be found by sending flow through the graph and trying to identify the -``bottleneck''. +``bottleneck''. This chapter, except for the description of the +Boykov--Kolmogorov algorithm is taken from my project work +\cite{project} and is included here for completeness. \section{Flow graphs} + We have already introduced capacities, and briefly mentioned the notion of flow as something limited by the capacity. In other words, flow is something we can send through our graph, but the capacity limits how