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

finish (?) third perpendicular colour, third Ruifrok colour requires new processing/figures

parent 84462f03
......@@ -54,9 +54,9 @@
\lineheight{1}%
\setlength\tabcolsep{0pt}%
\put(0,0){\includegraphics[width=\unitlength,page=1]{flagJA2pac.pdf}}%
\put(0.9396323,0.00103078){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}0\end{tabular}}}}%
\put(0.9396323,0.19934344){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}0.5\end{tabular}}}}%
\put(0.9396323,0.3976561){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}1\end{tabular}}}}%
\put(0.9596323,0.00103078){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}0\end{tabular}}}}%
% \put(0.9396323,0.19934344){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}0.5\end{tabular}}}}%
\put(0.9596323,0.3976561){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$\abs{\col{\hat{A}}_c}$\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=2]{flagJA2pac.pdf}}%
\end{picture}%
\endgroup%
......@@ -54,9 +54,9 @@
\lineheight{1}%
\setlength\tabcolsep{0pt}%
\put(0,0){\includegraphics[width=\unitlength,page=1]{flagJA2pag.pdf}}%
\put(0.9396323,0.00103078){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}0\end{tabular}}}}%
\put(0.9396323,0.19934344){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}0.5\end{tabular}}}}%
\put(0.9396323,0.3976561){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}1\end{tabular}}}}%
\put(0.9596323,0.00103078){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}0\end{tabular}}}}%
% \put(0.9396323,0.19934344){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}0.5\end{tabular}}}}%
\put(0.9596323,0.3976561){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$\abs{\col{\hat{A}}_g}$\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=2]{flagJA2pag.pdf}}%
\end{picture}%
\endgroup%
......@@ -54,9 +54,9 @@
\lineheight{1}%
\setlength\tabcolsep{0pt}%
\put(0,0){\includegraphics[width=\unitlength,page=1]{flagJA2pay.pdf}}%
\put(0.9396323,0.00103078){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}0\end{tabular}}}}%
\put(0.9396323,0.19934344){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}0.5\end{tabular}}}}%
\put(0.9396323,0.3976561){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}1\end{tabular}}}}%
\put(0.9596323,0.00103078){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}0\end{tabular}}}}%
%\put(0.9396323,0.19934344){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}0.5\end{tabular}}}}%
\put(0.9596323,0.3976561){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$\abs{\col{\hat{A}}_y}$\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=2]{flagJA2pay.pdf}}%
\end{picture}%
\endgroup%
......@@ -54,9 +54,9 @@
\lineheight{1}%
\setlength\tabcolsep{0pt}%
\put(0,0){\includegraphics[width=\unitlength,page=1]{flagJA2paygc.pdf}}%
\put(0.9396323,0.00103078){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}0\end{tabular}}}}%
\put(0.9396323,0.19934344){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}0.5\end{tabular}}}}%
\put(0.9396323,0.3976561){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}1\end{tabular}}}}%
\put(0.9596323,0.00103078){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}0\end{tabular}}}}%
%\put(0.9396323,0.19934344){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}0.5\end{tabular}}}}%
\put(0.9596323,0.3976561){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}16\end{tabular}}}}%
\put(0,0){\includegraphics[width=\unitlength,page=2]{flagJA2paygc.pdf}}%
\end{picture}%
\endgroup%
documentation/pics/flagJA2pc.png

2.43 KB | W: | H:

documentation/pics/flagJA2pc.png

2.43 KB | W: | H:

documentation/pics/flagJA2pc.png
documentation/pics/flagJA2pc.png
documentation/pics/flagJA2pc.png
documentation/pics/flagJA2pc.png
  • 2-up
  • Swipe
  • Onion skin
documentation/pics/flagJA2pg.png

3.45 KB | W: | H:

documentation/pics/flagJA2pg.png

3.45 KB | W: | H:

documentation/pics/flagJA2pg.png
documentation/pics/flagJA2pg.png
documentation/pics/flagJA2pg.png
documentation/pics/flagJA2pg.png
  • 2-up
  • Swipe
  • Onion skin
documentation/pics/flagJA2py.png

2.21 KB | W: | H:

documentation/pics/flagJA2py.png

2.21 KB | W: | H:

documentation/pics/flagJA2py.png
documentation/pics/flagJA2py.png
documentation/pics/flagJA2py.png
documentation/pics/flagJA2py.png
  • 2-up
  • Swipe
  • Onion skin
documentation/pics/flagJA2pygc.png

3.26 KB | W: | H:

documentation/pics/flagJA2pygc.png

3.26 KB | W: | H:

documentation/pics/flagJA2pygc.png
documentation/pics/flagJA2pygc.png
documentation/pics/flagJA2pygc.png
documentation/pics/flagJA2pygc.png
  • 2-up
  • Swipe
  • Onion skin
documentation/pics/flagJA2rc.png

2.42 KB | W: | H:

documentation/pics/flagJA2rc.png

2.75 KB | W: | H:

documentation/pics/flagJA2rc.png
documentation/pics/flagJA2rc.png
documentation/pics/flagJA2rc.png
documentation/pics/flagJA2rc.png
  • 2-up
  • Swipe
  • Onion skin
documentation/pics/flagJA2rg.png

3.43 KB | W: | H:

documentation/pics/flagJA2rg.png

3.29 KB | W: | H:

documentation/pics/flagJA2rg.png
documentation/pics/flagJA2rg.png
documentation/pics/flagJA2rg.png
documentation/pics/flagJA2rg.png
  • 2-up
  • Swipe
  • Onion skin
documentation/pics/flagJA2ry.png

2.2 KB | W: | H:

documentation/pics/flagJA2ry.png

2.2 KB | W: | H:

documentation/pics/flagJA2ry.png
documentation/pics/flagJA2ry.png
documentation/pics/flagJA2ry.png
documentation/pics/flagJA2ry.png
  • 2-up
  • Swipe
  • Onion skin
documentation/pics/flagJA2rygc.png

3.26 KB | W: | H:

documentation/pics/flagJA2rygc.png

3.26 KB | W: | H:

documentation/pics/flagJA2rygc.png
documentation/pics/flagJA2rygc.png
documentation/pics/flagJA2rygc.png
documentation/pics/flagJA2rygc.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -64,7 +64,7 @@ For each pixel in the original image (figure \ref{flagJA}) we now first calculat
\end{equation}
and next calculate the column with (estimated) dye contributions for this pixel with (equation \ref{sumdyesinv}):
\begin{equation}
\col{\hat{a}}_p = \mat{K}^{-1} \col{A}_p = \begin{bmatrix} \hat{a}_y\\ \hat{a}_g \\ \hat{a}_b\end{bmatrix}
\col{\hat{a}}_p = \mat{K}^{-1} \col{A}_p = \begin{bmatrix} \hat{a}_y\\ \hat{a}_g \\ \hat{a}_b\end{bmatrix} \label{solveap}
\end{equation}
And for this simple pure colour flag, this works like a charm: we find either zero for the amount of dye or a constant value for the amount of dye, in the expected and appropriate places (figure \ref{flagJAas}).
......@@ -79,7 +79,7 @@ The actual (non-zero) value for `the amount of dye' that we find is precisely th
\def\svgwidth{0.47\linewidth}\includesvg{pics/flagJAab}}\hfill
\subfloat[\label{flagJAaygb}]{%
\def\svgwidth{0.47\linewidth}\includesvg{pics/flagJAaygb}}\\
\caption{Deconvolved (pure) dye amounts for the three colour flag. For each dye we find a binary image with dye amounts of either zero (black) or the length of the dye's absorption column $\abs{{\hat{A}}}$ before normalisation to ${\hat{k}}$ (white). With \textbf{(a)} the amount of yellow is either zero or $\hat{a}_y = 5.5487$ (equation \ref{flagJAabsy}); \textbf{(b)} the amount of green is either zero or $\hat{a}_g = 5.7575$ (equation \ref{flagJAabsg}); \textbf{(c)} the amount of yellow is either zero or $\hat{a}_b = 9.6045$ (equation \ref{flagJAabsb}); and \textbf{(d)} a combined image with absolute absorption values. \label{flagJAas}}
\caption{Deconvolved (pure) dye amounts for the three colour flag. For each dye we find a binary image with dye amounts of either zero (black) or the length of the dye's absorption column $\abs{{\hat{A}}}$ before normalisation to ${\hat{k}}$ (white). With \textbf{(a)} the amount of yellow is either zero or $\hat{a}_y = 5.5487$ (equation \ref{flagJAabsy}); \textbf{(b)} the amount of green is either zero or $\hat{a}_g = 5.7575$ (equation \ref{flagJAabsg}); \textbf{(c)} the amount of black is either zero or $\hat{a}_b = 9.6045$ (equation \ref{flagJAabsb}); and \textbf{(d)} a combined image with absolute absorption values. \label{flagJAas}}
\end{figure}
......@@ -95,12 +95,12 @@ The actual (non-zero) value for `the amount of dye' that we find is precisely th
\includegraphics[width=0.47\linewidth]{pics/flagJAb.png}}\hfill
\subfloat[\label{flagJAygb}]{%
\includegraphics[width=0.47\linewidth]{pics/flagJAygb.png}}\\
\caption{Reconstructed RGB images from estimated dye amounts and normalised dye absorption columns. With: \textbf{(a)} RGB image with contributions of only the yellow dye (equation \ref{flagJARy}); \textbf{(b)} RGB image with contributions of only the green dye (equation \ref{flagJARg}); \textbf{(c)} RGB image with contributions of only the black dye (equation \ref{flagJARy}); and \textbf{(d)} RGB image with contributions of all three dyes together (equation \ref{flagJARygb}). \label{flagJArecon}}
\caption{Reconstructed RGB images from estimated dye amounts and normalised dye absorption columns. With: \textbf{(a)} RGB image with contributions of only the yellow dye (equation \ref{flagJARy}); \textbf{(b)} RGB image with contributions of only the green dye (equation \ref{flagJARg}); \textbf{(c)} RGB image with contributions of only the black dye (equation \ref{flagJARb}); and \textbf{(d)} RGB image with contributions of all three dyes together (equation \ref{flagJARygb}). \label{flagJArecon}}
\end{figure}
We can reconstruct an RGB image for each pixel $p$ and for each dye $n$ with only the (absorption) contribution of that dye $n$ with (equations \ref{Apixela}--\ref{Ipixela}):
\begin{equation}
\col{\hat{R}}_{p, n} = \left(I_\mathrm{max} + 1\right)\mathrm{e}^{-\col{\hat{k}}_n\hat{a}_{p, n}} - 1
\col{\hat{R}}_{p, n} = \left(I_\mathrm{max} + 1\right)\mathrm{e}^{-\col{\hat{k}}_n\hat{a}_{p, n}} - 1 \label{hatRpn}
\end{equation}
So the reconstructed yellow pixels will have RGB values\footnote{Note that these values are rounded to integers, RGB doesn't know fractions.} (figure \ref{flagJAy}):
......@@ -179,18 +179,7 @@ Similarly, we can find for the absorption angle between the flags yellow dye and
\end{align}
For our current purposes, we cannot help the suboptimal angle between the flags yellow dye and green dye: that is a given. But since we now get to pick our third `complementary' dye $c$ ourselves, we can make both angles $\varphi_{yc}$ and $\varphi_{yc}$ equal to 90\,\degree .
To do so, we need to calculate the normalised cross product of the normalised yellow dye and green dye absorption columns (equation \ref{anglecross}):
\begin{align}
\col{\hat{A}}_c & = \col{\hat{k}}_y \times \col{\hat{k}}_g = \begin{bmatrix*}[r] -0.0769 \\ 0.9623 \\ -0.0343\end{bmatrix*}\\
\col{\hat{k}}_c & = \frac{\col{\hat{A}}_c }{\abs{\col{\hat{A}}_c }} = \begin{bmatrix*}[r] -0.0796 \\ 0.9962\\ -0.0355\end{bmatrix*}
\end{align}
Note the negative absorption coefficients: this column represents `a dye' that produces, instead of absorbs, red and blue. As a result the `RGB' values for this dye (normalised amount of 1) come out as:
\begin{equation}
\col{\hat{R}}_c = 256\cdot \mathrm{e}^{\begin{bmatrix*}[r] 0.0796 \\ -0.9962\\ 0.0355\end{bmatrix*} \cdot 1} - 1 = \begin{bmatrix} 277\\ 95 \\ 265 \end{bmatrix}
\end{equation}
In other words: this third `dye colour' is not a real `colour' and cannot be (properly) represented in RGB space. It is a column that (precisely) covers the part of the 3D absorption space that is not covered by the other two columns, it is `the remainder' for use in deconvolution.
\begin{figure}[h]
\begin{figure}[h!]
\subfloat[\label{arrowsflag}]{%
\def\svgwidth{0.47\linewidth}\includesvg{pics/arrowsflag}}\hfill
\subfloat[\label{arrowsRGB}]{%
......@@ -198,10 +187,31 @@ In other words: this third `dye colour' is not a real `colour' and cannot be (pr
\caption{Absorption columns in 3D space. With \textbf{(a)} the yellow, green, black and complementary absorption columns (bold) and the (mutually perpendicular) `R', `G' and `B' columns: the three flag dyes (yellow, green, black) are not perpendicular in absorption and the complementary `dye' (magenta) is perpendicular in absorption to the yellow and green dyes; and \textbf{(b)} another example of the non-linear relationship between transmission (RGB) and absorption (dyes): dyes/colours that are perfectly perpendicular in RGB (i.e.\ red, green and blue) only have a mutual angle of about 6\,\degree\ in absorption. \label{arrowsfig}}
\end{figure}
To do so, we need to calculate the normalised cross product of the normalised yellow dye and green dye absorption columns (equation \ref{anglecross}):
\begin{align}
\col{\hat{A}}_c & = \col{\hat{k}}_y \times \col{\hat{k}}_g = \begin{bmatrix*}[r] -0.0769 \\ 0.9623 \\ -0.0343\end{bmatrix*} \label{Apcross}\\
\col{\hat{k}}_c & = \frac{\col{\hat{A}}_c }{\abs{\col{\hat{A}}_c }} = \begin{bmatrix*}[r] -0.0796 \\ 0.9962\\ -0.0355\end{bmatrix*}
\end{align}
Note the negative absorption coefficients: this column represents `a dye' that produces, instead of absorbs, red and blue. As a result the `RGB' values for this dye (normalised amount of 1) come out as:
\begin{equation}
\col{\hat{R}}_c = 256\cdot \mathrm{e}^{\begin{bmatrix*}[r] 0.0796 \\ -0.9962\\ 0.0355\end{bmatrix*} \cdot 1} - 1 = \begin{bmatrix*}[r] 277\\ 95 \\ 265 \end{bmatrix*} \label{flagJA2pRc}
\end{equation}
In other words: this third `dye colour' is not a real `colour' and cannot be (properly) represented in RGB space. It is a column that (precisely) covers the part of the 3D absorption space that is not covered by the other two columns, it is `the (absorption) remainder' for use in deconvolution.
\subsection{Deconvolution}
\begin{figure}[h]
We replace the third column in our $\mat{K}$ matrix with the complementary absorption column and calculate the new inverse:
\begin{align}
\mat{K} & = \begin{bmatrix*}[r] 0.0007 & 0.9631 & -0.0796\\
0.0357 & 0.0860 & 0.9962\\
0.9994 & 0.2549 & -0.0355 \end{bmatrix*} \label{JA2pK}\\
\mat{K}^{-1}& = \begin{bmatrix*}[r] -0.2660 & 0.0144 & 1.0003\\
1.0319 & 0.0823 & -0.0037\\
-0.0796 & 0.9962 & -0.0355\end{bmatrix*} \label{JA2pinvK}
\end{align}
And solve again for the amounts of dye in the flag (equation \ref{solveap}).
\begin{figure}[h!]
\tiny
\subfloat[\label{flagJA2pay}]{%
\def\svgwidth{0.47\linewidth}\includesvg{pics/flagJA2pay}}\hfill
......@@ -211,32 +221,60 @@ In other words: this third `dye colour' is not a real `colour' and cannot be (pr
\def\svgwidth{0.47\linewidth}\includesvg{pics/flagJA2pac}}\hfill
\subfloat[\label{flagJA2paygc}]{%
\def\svgwidth{0.47\linewidth}\includesvg{pics/flagJA2paygc}}\\
\caption{Deconvolved (pure) dye amounts for the three colour flag. For each dye we find a binary image with dye amounts of either zero (black) or the length of the dye's absorption column $\abs{{\hat{A}}}$ before normalisation to ${\hat{k}}$ (white). With \textbf{(a)} the amount of yellow is either zero or $\hat{a}_y = 5.5487$ (equation \ref{flagJA2pabsy}); \textbf{(b)} the amount of green is either zero or $\hat{a}_g = 5.7575$ (equation \ref{flagJA2pabsg}); \textbf{(c)} the amount of yellow is either zero or $\hat{a}_b = 9.6045$ (equation \ref{flagJA2pabsb}); and \textbf{(d)} a combined image with absolute absorption values. \label{flagJA2pas}}
\caption{Deconvolved (pure) dye amounts with the yellow and green from the flag and a perpendicular third absorption column. The results are the same as for the three colour deconvolution for yellow and green parts in the flag. The black in the flag is now composed of all three colours: yellow, green and complementary. With \textbf{(a)} the amount of yellow ($\max \hat{a}_y = 5.5487$, equation \ref{flagJAabsy}); \textbf{(b)} the amount of green ($\max \hat{a}_g = 5.7575$, equation \ref{flagJAabsg}); \textbf{(c)} the amount of complementary colour ($\max \hat{a}_c = 4.8858$, total absorption is 30.8); and \textbf{(d)} a combined image with absolute absorption values. \label{flagJA2pas}}
\end{figure}
\noindent The results for the yellow and green parts in the flag are the same as in the three colour deconvolution (figure \ref{flagJA2pas}): the yellow stripes have $\hat{a}_y = \abs{\col{\hat{A}}_y} = 5.5487$ of yellow and nothing else, and the green patches have $\hat{a}_g = \abs{\col{\hat{A}}_g} = 5.7575$ of green and nothing else.
The black patches our now made up of a combination of all three dyes: yellow, green and our third complementary `dye'. According to the deconvolution, `black' is the result of a combination of 75\,\% of the flags yellow dye (figure \ref{flagJA2pay}), 100\,\% of the flags green dye (figure \ref{flagJA2pag}), and 16\,\% of our third `perpendicular dye'.\\
\noindent Note that the `total absorption' (length) of our complementary perpendicular column is large (30-ish) compared to those of
the yellow and green (5.5-ish). That is because this column was calculated from the yellow and green absorption columns \textsl{before} normalisation. When calculated from the normalised columns (as in equations \ref{anglecross} and \ref{Apcross}), the length is $\abs{\col{\hat{A}}_c} = 0.9660$. Calculated from the columns before normalisation, $\frac{\abs{\col{\hat{A}}_c}}{\abs{\col{\hat{A}}_y}\cdot\abs{\col{\hat{A}}_g}} = 0.9660$.
\subsection{Reconstruction}
\begin{figure}[h]
It is instructive to reconstruct the single dye and combined dye RGB images as before (equations \ref{hatRpn} and \ref{flagJARb}, figure \ref{flagJArecon}).
\begin{figure}[h!]
\subfloat[RGB = 252, 207, 0\label{flagJA2py}]{%
\includegraphics[width=0.47\linewidth]{pics/flagJA2py.png}}\hfill
\subfloat[RGB = 0, 154, 58\label{flagJA2pg}]{%
\includegraphics[width=0.47\linewidth]{pics/flagJA2pg.png}}\\
\subfloat[RGB = 0, 0, 0\label{flagJA2pc}]{%
\subfloat[RGB = 277, 95, 265 \label{flagJA2pc}]{%
\includegraphics[width=0.47\linewidth]{pics/flagJA2pc.png}}\hfill
\subfloat[\label{flagJA2pygc}]{%
\includegraphics[width=0.47\linewidth]{pics/flagJA2pygc.png}}\\
\caption{Reconstructed RGB images from estimated dye amounts and normalised dye absorption columns. With: \textbf{(a)} RGB image with contributions of only the yellow dye (equation \ref{flagJA2pRy}); \textbf{(b)} RGB image with contributions of only the green dye (equation \ref{flagJA2pRg}); \textbf{(c)} RGB image with contributions of only the black dye (equation \ref{flagJA2pRy}); and \textbf{(d)} RGB image with contributions of all three dyes together (equation \ref{flagJA2pRygb}). \label{flagJA2precon}}
\caption{Reconstructed RGB images from estimated dye amounts and normalised dye absorption columns for yellow, green and a perpendicular complementary colour. With: \textbf{(a)} RGB image with contributions of only the yellow dye); \textbf{(b)} RGB image with contributions of only the green dye; \textbf{(c)} RGB image with contributions of only the complementary `perpendicular' dye; and \textbf{(d)} RGB image with contributions of all three dyes together (equation \ref{flagJARygb}). \label{flagJA2precon}}
\end{figure}
The black patches in the flag has 75\,\% of the yellow dye of the stripes (figure \ref{flagJA2pay}). Less dye means less absorption, so the yellow for the black patches in the flag comes out `lighter' (figure \ref{flagJA2py}, RGB = 252, 281, 3).
The black in the flag patches are `as green' as the green patches (figures \ref{flagJA2pag}, \ref{flagJA2pg}), and they contain a certain amount of our complementary `perpendicular' dye (figures \ref{flagJA2pac}, \ref{flagJA2pc}). Note that these RGB values have been scaled to make them representable in RGB, the actual RGB colour for this image does not exist.
Also note, finally, that the combination of 75\,\% yellow, 100\,\% green and 16\,\% of our third dye, \textsl{does} result in `proper black'. And it should be obvious from figure \ref{flagJA2precon} that to add the effects of (absorbing) dyes, you cannot `add RGB values'.
\subsection{Adding a third `Ruifrok' absorption column}
The Java code by Ruifrok that was adapted by Landini for the `colour deconvolution' ImageJ plugin \cite{Landini2004,Landini2020,Landini2020a} contained an alternative (otherwise undocumented) method to obtain a third complementary colour.
This third method attempts to normalise total absorption of all three dyes for each of the R, G and B channels and sets channel absorption to 0 when this is not possible:
\begin{equation}
\hat{A}_{c_n} = \begin{cases} \sqrt{1 - k_{y_n}^2 - k_{g_n}^2} & \text{~for~} k_{y_n}^2 + k_{g_n}^2 \leq 1 \\
0 & \text{~for~} k_{y_n}^2 + k_{g_n}^2 > 1\end{cases}
\end{equation}
For our example, this would make the complementary third absorption column:
\begin{equation}
\col{\hat{A}}_c = \begin{bmatrix*}[r] 0 \\ \sqrt{1-0.1981^2- 0.4953^2}\\0\end{bmatrix*} = \begin{bmatrix*}[r] 0 \\ 0.8458\\0\end{bmatrix*}
\end{equation}
Length and normalisation are trivial in this case:
\begin{align}
\abs{\col{\hat{A}}_c } & = 0.8458\\
\col{k}_c & = \begin{bmatrix} 0 \\ 1 0\end{bmatrix}
\end{align}
Note that with this method total absorption per channel across the three dyes is `normalised' \textsl{before} the absorption column of the third
\subsection{Deconvolution}
......@@ -251,13 +289,13 @@ In other words: this third `dye colour' is not a real `colour' and cannot be (pr
\def\svgwidth{0.47\linewidth}\includesvg{pics/flagJA2rac}}\hfill
\subfloat[\label{flagJA2raygc}]{%
\def\svgwidth{0.47\linewidth}\includesvg{pics/flagJA2raygc}}\\
\caption{Deconvolved (pure) dye amounts for the three colour flag. For each dye we find a binary image with dye amounts of either zero (black) or the length of the dye's absorption column $\abs{{\hat{A}}}$ before normalisation to ${\hat{k}}$ (white). With \textbf{(a)} the amount of yellow is either zero or $\hat{a}_y = 5.5487$ (equation \ref{flagJA2pabsy}); \textbf{(b)} the amount of green is either zero or $\hat{a}_g = 5.7575$ (equation \ref{flagJA2pabsg}); \textbf{(c)} the amount of yellow is either zero or $\hat{a}_b = 9.6045$ (equation \ref{flagJA2pabsb}); and \textbf{(d)} a combined image with absolute absorption values. \label{flagJA2pas}}
\caption{Deconvolved (pure) dye amounts with the yellow and green from the flag and a `Ruifrok' third absorption column. The results are the same as for the three colour deconvolution for yellow and green parts in the flag. The black in the flag is now composed of all three colours: yellow, green and complementary. With \textbf{(a)} the amount of yellow ($\max \hat{a}_y = 5.5487$, equation \ref{flagJAabsy}); \textbf{(b)} the amount of green ($\max \hat{a}_g = 5.7575$, equation \ref{flagJAabsg}); \textbf{(c)} the amount of complementary colour ($\max \hat{a}_c = 4.8858$, total absorption is 30.8); and \textbf{(d)} a combined image with absolute absorption values. \label{flagJA2pas}}
\end{figure}
\subsection{Reconstruction}
\begin{figure}[h]
\begin{figure}[p]
\subfloat[RGB = 252, 207, 0\label{flagJA2ry}]{%
\includegraphics[width=0.47\linewidth]{pics/flagJA2ry.png}}\hfill
\subfloat[RGB = 0, 154, 58\label{flagJA2rg}]{%
......@@ -266,7 +304,7 @@ In other words: this third `dye colour' is not a real `colour' and cannot be (pr
\includegraphics[width=0.47\linewidth]{pics/flagJA2rc.png}}\hfill
\subfloat[\label{flagJA2rygc}]{%
\includegraphics[width=0.47\linewidth]{pics/flagJA2rygc.png}}\\
\caption{Reconstructed RGB images from estimated dye amounts and normalised dye absorption columns. With: \textbf{(a)} RGB image with contributions of only the yellow dye (equation \ref{flagJA2pRy}); \textbf{(b)} RGB image with contributions of only the green dye (equation \ref{flagJA2pRg}); \textbf{(c)} RGB image with contributions of only the black dye (equation \ref{flagJA2pRy}); and \textbf{(d)} RGB image with contributions of all three dyes together (equation \ref{flagJA2pRygb}). \label{flagJA2precon}}
\caption{Reconstructed RGB images from estimated dye amounts and normalised dye absorption columns for yellow, green and a perpendicular complementary colour. With: \textbf{(a)} RGB image with contributions of only the yellow dye); \textbf{(b)} RGB image with contributions of only the green dye; \textbf{(c)} RGB image with contributions of only the complementary `perpendicular' dye; and \textbf{(d)} RGB image with contributions of all three dyes together (equation \ref{flagJA2pRygb}). \label{flagJA2precon}}
\end{figure}
\section{Two blending flag colours analysis}
......
clear all; close all;
% read image
im = imread('pics/Flag_of_Jamaica.png');
% image colours
dyes = [254 209 0; % yellow
0 155 58]'; % green
% do the deconvolve
[amounts, P, Q, R, RGB, A, K] = cld_decon(dyes, im, 'rgb');
dyes(:, 3) = 256*exp(-K(:, 3))-1
K = K
iK = inv(K)
% show image
figure
imshow(im)
for d = 1:3
figure
imshow(amounts(:, :, d)/norm(A(:, d)))
colormap(gray)
colorbar
end
figure
imshow(sum(amounts, 3)/16)
colormap(gray)
colorbar
figure
imshow(uint8(round(P)))
imwrite(uint8(P), 'pics/flagJA2py.png', 'PNG')
figure
imshow(uint8(round(Q)))
imwrite(uint8(Q), 'pics/flagJA2pg.png', 'PNG')
figure
imshow(uint8(round(R)))
imwrite(uint8(R), 'pics/flagJA2pc.png', 'PNG')
figure
imshow(uint8(round(RGB)))
imwrite(uint8(RGB), 'pics/flagJA2pygc.png', 'PNG')
min(amounts(:))
max(amounts(:))
......@@ -7,55 +7,12 @@ dyes = [254 209 0; % yellow
0 155 58]'; % green
% do the deconvolve
[amounts, P, Q, R, RGB, A, K] = cld_decon(dyes, im, 'rgb');
dyes(:, 3) = 256*exp(-K(:, 3))-1
K = K
iK = inv(K)
% show image
figure
imshow(im)
for d = 1:3
figure
imshow(amounts(:, :, d)/norm(A(:, d)))
colormap(gray)
colorbar
end
figure
imshow(sum(amounts, 3)/16)
colormap(gray)
colorbar
figure
imshow(uint8(round(P)))
imwrite(uint8(P), 'pics/flagJA2py.png', 'PNG')
figure
imshow(uint8(round(Q)))
imwrite(uint8(Q), 'pics/flagJA2pg.png', 'PNG')
figure
imshow(uint8(round(R)))
imwrite(uint8(R), 'pics/flagJA2pc.png', 'PNG')
figure
imshow(uint8(round(RGB)))
imwrite(uint8(RGB), 'pics/flagJA2pygc.png', 'PNG')
min(amounts(:))
max(amounts(:))
[amounts, P, Q, R, RGB, A, K] = cld_decon(dyes, im(1, 1, :), 'rgb');
%%%% Ruifrok
As = A.^2;
As = K.^2;
for c = 1:3
if sum(As(c, 1:2)) < 1
A(c, 3) = sqrt(1 - sum(As(c, 1:2)));
......
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