From: Bjørn Rustad Date: Fri, 9 May 2014 12:04:29 +0000 (+0200) Subject: New level set figure X-Git-Url: http://git.rustad.me/?a=commitdiff_plain;h=679b9b2cece7d68e8ee65e8e9c97e47a372238d7;p=prosjektoppgave New level set figure --- diff --git a/fig/img_decomp.tex b/fig/img_decomp.tex new file mode 100644 index 0000000..27a56ec --- /dev/null +++ b/fig/img_decomp.tex @@ -0,0 +1,136 @@ +\centering +\begin{subfigure}[t]{0.4\textwidth} + \centering + \begin{tikzpicture}[scale=1,every node/.style={minimum size=1cm},on grid] + + % Note the numbers here are reversed! + \def\mylist{ + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 1, 1, 2, 2, 2, 1, 0, 1, 0}, + {0, 1, 2, 2, 3, 2, 1, 1, 1, 0}, + {0, 1, 2, 3, 3, 2, 1, 0, 1, 0}, + {0, 1, 2, 3, 3, 2, 1, 0, 1, 0}, + {0, 1, 2, 2, 2, 2, 1, 1, 1, 0}, + {0, 1, 1, 1, 1, 1, 1, 1, 0, 0}, + {0, 0, 1, 0, 0, 1, 1, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + } + + \fill[white,fill opacity=.7] (0,0) rectangle (5,5); + \draw[black,very thick] (0,0) rectangle (5,5); + \foreach[count=\i] \row in \mylist + \foreach[count=\j] \pix in \row { + \ifnum\pix=1\fill[black!33,fill opacity=.9] (\i*.5-.5,\j*.5-.5) rectangle + (\i*.5,\j*.5);\fi + \ifnum\pix=2\fill[black!66,fill opacity=.9] (\i*.5-.5,\j*.5-.5) rectangle + (\i*.5,\j*.5);\fi + \ifnum\pix=3\fill[black,fill opacity=.9] (\i*.5-.5,\j*.5-.5) rectangle + (\i*.5,\j*.5);\fi + } + \draw[step=5mm, black] (0,0) grid (5,5); + \draw (2.25, 0.25) node {$3$}; + \draw (2.25, 0.75) node {$2$}; + \draw (2.25, 1.25) node {$1$}; + \draw (2.25, 1.75) node[white] {$0$}; + \end{tikzpicture} + \caption{An example gray-scale image with four different levels.} +\end{subfigure} +~ +\begin{subfigure}[t]{0.4\textwidth} + \centering + + \begin{tikzpicture}[scale=.5,every node/.style={minimum size=1cm},on grid] + + \def\mylist{ + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 1, 1, 1, 1, 1, 0, 0, 0}, + {0, 1, 1, 2, 2, 2, 1, 0, 1, 0}, + {0, 1, 2, 2, 3, 2, 1, 1, 1, 0}, + {0, 1, 2, 3, 3, 2, 1, 0, 1, 0}, + {0, 1, 2, 3, 3, 2, 1, 0, 1, 0}, + {0, 1, 2, 2, 2, 2, 1, 1, 1, 0}, + {0, 1, 1, 1, 1, 1, 1, 1, 0, 0}, + {0, 0, 1, 0, 0, 1, 1, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + } + + + \begin{scope}[ + yshift=0,every node/.append style={ + yslant=0.5,xslant=-1},yslant=0.5,xslant=-1 + ] + \fill[white,fill opacity=.7] (0,0) rectangle (5,5); + \draw[black,very thick] (0,0) rectangle (5,5); + + \fill[black,fill opacity=.9] (0,0) rectangle (5,5); + + \draw[step=5mm, black] (0,0) grid (5,5); + \end{scope} + + \begin{scope}[ + yshift=50,every node/.append style={ + yslant=0.5,xslant=-1},yslant=0.5,xslant=-1 + ] + \fill[white,fill opacity=.7] (0,0) rectangle (5,5); + \draw[black,very thick] (0,0) rectangle (5,5); + + \foreach[count=\i] \row in \mylist + \foreach[count=\j] \pix in \row { + \ifnum\pix<1\else\fill[black,fill opacity=.9] (\i*.5-.5,\j*.5-.5) rectangle + (\i*.5,\j*.5);\fi + } + + \draw[step=5mm, black] (0,0) grid (5,5); + \end{scope} + + \begin{scope}[ + yshift=100,every node/.append style={ + yslant=0.5,xslant=-1},yslant=0.5,xslant=-1 + ] + \fill[white,fill opacity=.7] (0,0) rectangle (5,5); + \draw[black,very thick] (0,0) rectangle (5,5); + + \foreach[count=\i] \row in \mylist + \foreach[count=\j] \pix in \row { + \ifnum\pix<2\else\fill[black,fill opacity=.9] (\i*.5-.5,\j*.5-.5) rectangle + (\i*.5,\j*.5);\fi + } + + \draw[step=5mm, black] (0,0) grid (5,5); + \end{scope} + + \begin{scope}[ + yshift=150,every node/.append style={ + yslant=0.5,xslant=-1},yslant=0.5,xslant=-1 + ] + \fill[white,fill opacity=.7] (0,0) rectangle (5,5); + \draw[black,very thick] (0,0) rectangle (5,5); + + \foreach[count=\i] \row in \mylist + \foreach[count=\j] \pix in \row { + \ifnum\pix=3\fill[black,fill opacity=.9] (\i*.5-.5,\j*.5-.5) rectangle + (\i*.5,\j*.5);\fi + } + + \draw[step=5mm, black] (0,0) grid (5,5); + \end{scope} + + \tikzstyle{blopp} = [ + rectangle,anchor=west, text width=1.8cm + ] + + \draw[-latex,thick] (5.2,1.5) node[blopp] + {$u^3 = \idfun_{u \leq 3}$} to[out=180,in=-50] (4,2); + \draw[-latex,thick] (5.2,3.25) node[blopp]{$u^2$} + to[out=180,in=-50] (4,3.75); + \draw[-latex,thick] (5.2,5) node[blopp]{$u^1$} + to[out=180,in=-50] (4,5.5); + \draw[-latex,thick] (5.2,6.75) node[blopp]{$u^0$} + to[out=180,in=-50] (4,7.25); + + \end{tikzpicture} + \caption{The thresholded images, which are in + $\{0,1\}^{\abs{\Omega}}$.} +\end{subfigure} + diff --git a/fig/level_sets_tab.tex b/fig/level_sets_tab.tex new file mode 100644 index 0000000..137c844 --- /dev/null +++ b/fig/level_sets_tab.tex @@ -0,0 +1,27 @@ +\centering +\begin{tikzpicture}[ + baseline=(M.center), + bg1/.style={fill=black!10}, + bg2/.style={fill=black!25}, + bg3/.style={fill=black!40}, + bg4/.style={fill=black!55}, + bg5/.style={fill=black!70}, + ] + \matrix (M) [ + matrix of nodes, + %column sep={6pt,between origins}, + %row sep={6pt,between origins} + ] + { + \node (A) {}; & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ + & 1 & 1 & 1 & 1 & 1 & 1 & 1 & & 1 & 1 & 1 & 1 \\ + & 1 & 1 & & 1 & 1 & 1 & & & & 1 & 1 & 1 \\ + & 1 & & & & 1 & 1 & & & & & 1 & 1 \\ + \node (L) {$\mathcal{L}$}; & 1 & & & & & & & & & & & 1 \\ + & |[bg5]| 5 & |[bg3]| 3 & |[bg2]| 2 & |[bg3]| 3 & |[bg4]| 4 & |[bg4]| 4 & |[bg2]| 2 & |[bg1]| 1 & |[bg2]| 2 & |[bg3]| 3 & |[bg4]| 4 & |[bg5]| 5 \\ + }; + + \draw[->] (L) -- (A); +\end{tikzpicture} +\caption{The level sets of a one-dimensional image.} +\label{fig:level_sets} diff --git a/total.tex b/total.tex index cf95388..42be4f5 100644 --- a/total.tex +++ b/total.tex @@ -250,33 +250,7 @@ it does not decompose into a sum over the levels of the image, which we need for our graph composition. \begin{figure} - \centering - \begin{tikzpicture}[ - baseline=(M.center), - bg1/.style={fill=black!10}, - bg2/.style={fill=black!25}, - bg3/.style={fill=black!40}, - bg4/.style={fill=black!55}, - bg5/.style={fill=black!70}, - ] - \matrix (M) [ - matrix of nodes, - %column sep={6pt,between origins}, - %row sep={6pt,between origins} - ] -{ - \node (A) {}; & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \\ - & 1 & 1 & 1 & 1 & 1 & 1 & 1 & & 1 & 1 & 1 & 1 \\ - & 1 & 1 & & 1 & 1 & 1 & & & & 1 & 1 & 1 \\ - & 1 & & & & 1 & 1 & & & & & 1 & 1 \\ - \node (L) {$\mathcal{L}$}; & 1 & & & & & & & & & & & 1 \\ - & |[bg5]| 5 & |[bg3]| 3 & |[bg2]| 2 & |[bg3]| 3 & |[bg4]| 4 & |[bg4]| 4 & |[bg2]| 2 & |[bg1]| 1 & |[bg2]| 2 & |[bg3]| 3 & |[bg4]| 4 & |[bg5]| 5 \\ -}; - -\draw[->] (L) -- (A); -\end{tikzpicture} -\caption{The level sets of a one-dimensional image.} -\label{fig:level_sets} + \input{fig/img_decomp} \end{figure} Following the notation used in \cite{darbon2006image}, we let $u_x$ @@ -459,6 +433,8 @@ Since $\mathbbm{1}_{\lambda < u_x} = (1 - u^\lambda_x)$ we rewrite \fixme{$E_\lambda^x$} \subsubsection{Total energy} +\label{sec:total_energy} + We have now discretized the energy function and decomposed it into a sum over all the levels $\lambda$. Ignoring the constant term $N_x(0)$ we are left with