Commit f484fb65 authored by Turnhout, M.C. van's avatar Turnhout, M.C. van
Browse files

add RGB surface figure

parent 9372812d
%% Creator: Inkscape inkscape 0.92.5, www.inkscape.org
%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010
%% Accompanies image file 'sim1ygRGB.pdf' (pdf, eps, ps)
%%
%% To include the image in your LaTeX document, write
%% \input{<filename>.pdf_tex}
%% instead of
%% \includegraphics{<filename>.pdf}
%% To scale the image, write
%% \def\svgwidth{<desired width>}
%% \input{<filename>.pdf_tex}
%% instead of
%% \includegraphics[width=<desired width>]{<filename>.pdf}
%%
%% Images with a different path to the parent latex file can
%% be accessed with the `import' package (which may need to be
%% installed) using
%% \usepackage{import}
%% in the preamble, and then including the image with
%% \import{<path to file>}{<filename>.pdf_tex}
%% Alternatively, one can specify
%% \graphicspath{{<path to file>/}}
%%
%% For more information, please see info/svg-inkscape on CTAN:
%% http://tug.ctan.org/tex-archive/info/svg-inkscape
%%
\begingroup%
\makeatletter%
\providecommand\color[2][]{%
\errmessage{(Inkscape) Color is used for the text in Inkscape, but the package 'color.sty' is not loaded}%
\renewcommand\color[2][]{}%
}%
\providecommand\transparent[1]{%
\errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package 'transparent.sty' is not loaded}%
\renewcommand\transparent[1]{}%
}%
\providecommand\rotatebox[2]{#2}%
\newcommand*\fsize{\dimexpr\f@size pt\relax}%
\newcommand*\lineheight[1]{\fontsize{\fsize}{#1\fsize}\selectfont}%
\ifx\svgwidth\undefined%
\setlength{\unitlength}{356.27750135bp}%
\ifx\svgscale\undefined%
\relax%
\else%
\setlength{\unitlength}{\unitlength * \real{\svgscale}}%
\fi%
\else%
\setlength{\unitlength}{\svgwidth}%
\fi%
\global\let\svgwidth\undefined%
\global\let\svgscale\undefined%
\makeatother%
\begin{picture}(1,0.73389568)%
\lineheight{1}%
\setlength\tabcolsep{0pt}%
\put(0,0){\includegraphics[width=\unitlength,page=1]{sim1ygRGB.pdf}}%
\put(0.0237736,0.36754707){\color[rgb]{0.14901961,0.14901961,0.14901961}\rotatebox{90}{\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}$R$\end{tabular}}}}}%
\put(0.4196462,0.00673071){\color[rgb]{0.14901961,0.14901961,0.14901961}\makebox(0,0)[rt]{\lineheight{1.25}\smash{\begin{tabular}[t]{r}$\frac{a_g}{\abs{\hat{A}_g}}$\,[-]\end{tabular}}}}%
\put(0.80658054,0.0206749){\color[rgb]{0.14901961,0.14901961,0.14901961}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$\frac{a_y}{\abs{\hat{A}_y}}$\,[-]\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=2]{sim1ygRGB.pdf}}%
\put(0.99357242,0.17686284){\color[rgb]{0.14901961,0.14901961,0.14901961}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}0\end{tabular}}}}%
\put(0.9276954,0.14712619){\color[rgb]{0.14901961,0.14901961,0.14901961}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}0.2\end{tabular}}}}%
\put(0.86181838,0.11738953){\color[rgb]{0.14901961,0.14901961,0.14901961}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}0.4\end{tabular}}}}%
\put(0.79594136,0.08765288){\color[rgb]{0.14901961,0.14901961,0.14901961}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}0.6\end{tabular}}}}%
\put(0.73006434,0.05791623){\color[rgb]{0.14901961,0.14901961,0.14901961}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}0.8\end{tabular}}}}%
\put(0.66418732,0.02817958){\color[rgb]{0.14901961,0.14901961,0.14901961}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}1\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=3]{sim1ygRGB.pdf}}%
\put(0.09423343,0.11829894){\color[rgb]{0.14901961,0.14901961,0.14901961}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}0\end{tabular}}}}%
\put(0.19965897,0.09971721){\color[rgb]{0.14901961,0.14901961,0.14901961}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}0.2\end{tabular}}}}%
\put(0.30508452,0.08113549){\color[rgb]{0.14901961,0.14901961,0.14901961}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}0.4\end{tabular}}}}%
\put(0.41051006,0.06255377){\color[rgb]{0.14901961,0.14901961,0.14901961}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}0.6\end{tabular}}}}%
\put(0.51593561,0.04397204){\color[rgb]{0.14901961,0.14901961,0.14901961}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}0.8\end{tabular}}}}%
\put(0.62136116,0.02539032){\color[rgb]{0.14901961,0.14901961,0.14901961}\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}1\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=4]{sim1ygRGB.pdf}}%
\put(0.08434788,0.14574524){\color[rgb]{0.14901961,0.14901961,0.14901961}\makebox(0,0)[rt]{\lineheight{1.25}\smash{\begin{tabular}[t]{r}0\end{tabular}}}}%
\put(0.08434788,0.23083341){\color[rgb]{0.14901961,0.14901961,0.14901961}\makebox(0,0)[rt]{\lineheight{1.25}\smash{\begin{tabular}[t]{r}50\end{tabular}}}}%
\put(0.08434788,0.31592158){\color[rgb]{0.14901961,0.14901961,0.14901961}\makebox(0,0)[rt]{\lineheight{1.25}\smash{\begin{tabular}[t]{r}100\end{tabular}}}}%
\put(0.08434788,0.40100764){\color[rgb]{0.14901961,0.14901961,0.14901961}\makebox(0,0)[rt]{\lineheight{1.25}\smash{\begin{tabular}[t]{r}150\end{tabular}}}}%
\put(0.08434788,0.48609581){\color[rgb]{0.14901961,0.14901961,0.14901961}\makebox(0,0)[rt]{\lineheight{1.25}\smash{\begin{tabular}[t]{r}200\end{tabular}}}}%
\put(0.08434788,0.57118398){\color[rgb]{0.14901961,0.14901961,0.14901961}\makebox(0,0)[rt]{\lineheight{1.25}\smash{\begin{tabular}[t]{r}250\end{tabular}}}}%
\end{picture}%
\endgroup%
This diff is collapsed.
......@@ -24,7 +24,7 @@ The flag is a 8\,bits RGB image, so
I_\mathrm{max} = 2^8 - 1 = 255
\end{equation}
\section{Three dye flag analysis}
\section{Three dye flag analysis}\label{flag3dye}
We will first see whether we can deconvolve and reconstruct this simple three colour flag with the algorithm in chapter \ref{algebra} and the actual (pure) `colours' in the flag (yellow, green, black).
......@@ -154,7 +154,7 @@ We therefore did not deconvolve with the actual colours (absorptions) in the fla
\end{figure}
\section{Two dye flag analysis}
\section{Two dye flag analysis}\label{flag2dye}
In this section, we are only interested in deconvolving the yellow and green from the flag (figure \ref{flagJA}) and we will not treat `black' as an input dye, or as a colour to be deconvolved (in yellow and green).
......@@ -330,18 +330,36 @@ If the colours in your image are truly the result of only \textsl{two} dyes, t
\section{Two blending flag dyes analysis}
\begin{figure}
In the current section, we will blend the flags yellow and green with known amounts for a `ideal' test image, and deconvolve that test image in order to benchmark the algorithm.
The test image consists of 500 by 500 pixels with pixel RGB values given by:
\begin{equation}
\col{R}_p = 256\cdot\mathrm{e}^{-\mat{K}\cdot \begin{bmatrix} a_y\\a_g\\0\end{bmatrix}} - 1
\end{equation}
with $a_y$ the actual amount of yellow dye used and $a_g$ the actual amount of green dye used. The amount of black dye (or of any complementary dye) is always zero in the test image (see also equation \ref{flagJARygb}).
\subsection{Mixing moderate amounts}
We will first use `moderate amounts of paint'. We could deconvolve the pure dyes with the amounts used for the flag, and we will now first mix yellow and green up to those amounts (figure \ref{sim1yginput}).\\
\noindent The amount of yellow dye in our image is $0 \leq a_y \leq \abs{\col{A}_y} = 5.5487$ (from left to right, figure \ref{sim1ayin}), and the amount of green dye in our image is $0 \leq a_g \leq \abs{\col{A}_g} = 5.7575$ (from top to bottom, figure \ref{sim1agin}).
So the test image (figure \ref{sim1yg}) has RGB values 255, 255, 255 for the upper left corner (no dyes), 252, 207, 0 for the upper right corner (the flags yellow, equation \ref{flagJARy}), and 0, 154, 58 for the bottom left corner (the flags green, equation \ref{flagJARg}). The bottom right corner with a mix of the flags yellow and green has RGB values 0, 127, 0 (figure \ref{sim1RGB}). \\
\begin{figure}[t!]
\tiny
\subfloat[\label{sim1ayin}]{%
\def\svgwidth{0.47\linewidth}\includesvg{pics/sim1ygayin}}\hfill
\subfloat[\label{sim1agin}]{%
\def\svgwidth{0.47\linewidth}\includesvg{pics/sim1ygagin}}\\
\subfloat[\label{sim1yg}]{%
\hspace{.75cm}\includegraphics[width=0.36\linewidth]{pics/sim1yg.png}}\\
\caption{Test image of 500 by 500 pixels with blends of yellow and green up to the amounts used in the flag. With \textbf{(a)} the amount of yellow dye increases from $a_y = 0$ to $a_y = 5.5487$ from left to right; \textbf{(b)} the amount of green dye increases from $a_g = 0$ to $a_g = 5.7575$ from top to bottom; and \textbf{(c)} the composed RGB input image used for deconvolution (mostly `green' to us). \label{sim1yginput}}
\hspace{.75cm}\includegraphics[width=0.36\linewidth]{pics/sim1yg.png}}\hfill
\subfloat[\label{sim1RGB}]{%
\def\svgwidth{0.47\linewidth}\includesvg{pics/sim1ygRGB}}\\
\caption{Test image of 500 by 500 pixels with blends of yellow and green up to the amounts used in the flag. With \textbf{(a)} the amount of yellow dye increases from $a_y = 0$ to $a_y = 5.5487$ from left to right; \textbf{(b)} the amount of green dye increases from $a_g = 0$ to $a_g = 5.7575$ from top to bottom; \textbf{(c)} the composed RGB input image used for deconvolution (mostly `green' to us); and \textbf{(d)} surface plot of the RGB values in the test image. \label{sim1yginput}}
\end{figure}
\begin{figure}
\begin{figure}[p]
\tiny
\subfloat[\label{sim1ayout}]{%
\def\svgwidth{0.47\linewidth}\includesvg{pics/sim1ygayout}}\hfill
......@@ -355,8 +373,15 @@ If the colours in your image are truly the result of only \textsl{two} dyes, t
\def\svgwidth{0.47\linewidth}\includesvg{pics/sim1ygabout}}\hfill
\subfloat[\label{sim1asb}]{%
\def\svgwidth{0.47\linewidth}\includesvg{pics/sim1ygasb}}\\
\caption{}
\caption{Deconvolution results for the test image in figure \ref{sim1yginput}. With \textbf{(a)} estimated amounts of yellow dye $\hat{a}_y$; \textbf{(b)} estimated amounts of yellow dye $\hat{a}_y$ versus actual amounts of yellow dye $a_y$;
\textbf{(c)} estimated amounts of green dye $\hat{a}_g$; \textbf{(d)} estimated amounts of green dye $\hat{a}_g$ versus actual amounts of yellow dye $a_g$;
\textbf{(e)} estimated amounts of black dye $\hat{a}_b$; \textbf{(d)} estimated amounts of black dye $\hat{a}_b$ versus actual amounts of yellow dye $a_y$. \label{sim1ygoutput} }
\end{figure}
\noindent Deconvolution of this test image with (all) three dyes (yellow, green, black, section \ref{flag3dye}) is perfect, up to a certain amount of yellow (figure \ref{sim1ygoutput}).
\nocite{Haub2015}
\ No newline at end of file
......@@ -95,4 +95,26 @@ plot(p(1:10:end), q(1:10:end), '.')
xlabel('$a_y$\,[-]')
ylabel('$\hat{a}_b$\,[-]')
axis([0 6 0 0.06])
% svgprint(9, 'pics/sim1ygasb')
\ No newline at end of file
% svgprint(9, 'pics/sim1ygasb')
np = 40;
figure
hold on
colormap(eye(3))
mesh(ay(1:np:end, 1:np:end)/max(ay(:)), ag(1:np:end, 1:np:end)/max(ag(:)), squeeze(tim(1:np:end, 1:np:end, 1)), zeros(size(ay(1:np:end, 1:np:end))), 'FaceAlpha','0.5')
mesh(ay(1:np:end, 1:np:end)/max(ay(:)), ag(1:np:end, 1:np:end)/max(ag(:)), squeeze(tim(1:np:end, 1:np:end, 2)), zeros(size(ay(1:np:end, 1:np:end))) + 1, 'FaceAlpha','0.5')
mesh(ay(1:np:end, 1:np:end)/max(ay(:)), ag(1:np:end, 1:np:end)/max(ag(:)), squeeze(tim(1:np:end, 1:np:end, 3)), zeros(size(ay(1:np:end, 1:np:end))) + 2, 'FaceAlpha','0.5')
axis([0 1 0 1 0 255])
grid on
xlabel('$a_y$')
ylabel('$a_g$')
zlabel('$R$')
set(gca, 'xtick', 0:0.2:1)
set(gca, 'ytick', 0:0.2:1)
set(gca, 'view', [122 22])
% svgprint(10, 'pics/sim1ygRGB')
da = ay - squeeze(tamounts(:, :, 1));
da(da > 0.01) = 1; da(da < 1) = 0;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment