... ... @@ -234,7 +234,7 @@ And since the total absorption' (length) of our third column is $\abs{\col{\hat 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}]{% \subfloat[RGB = 252, 207, 0 / 252, 218, 3\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}}\\ ... ... @@ -256,28 +256,39 @@ Also note, finally, that the combination of 75\,\% yellow, 100\,\% green and 5 u 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: This third method attempts to normalise total absorption of all three dyes across a channel 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: In other words, this method attempts to normalise the \textsl{rows} in the absoption matrix. Note that this row normalisation is undone' when we normalise this new third absorption \textsl{column} for the matrix$\mat{K}(as is wont and proper).\\ \noindent For our example, this would make the complementary third Ruifrok' absorption column: \begin{align} \abs{\col{\hat{A}}_c } & = 0.8458\\ \col{k}_c & = \begin{bmatrix} 0 \\ 1 0\end{bmatrix} \col{\hat{A}}_c = \begin{bmatrix*}[r] \sqrt{1 - 0.0007^2 - 0.9631^2} \\ \sqrt{1 - 0.0357^2 - 0.0860^2}\\0\end{bmatrix*} & = \begin{bmatrix*}[r] 0.2690 \\ 0.9957\\0\end{bmatrix*}\\ \col{\hat{k}}_c = \frac{\col{\hat{A}}_c }{\abs{\col{\hat{A}}_c }} & = \begin{bmatrix*}[r] 0.2609 \\ 0.9654 \\ 0\end{bmatrix*} \end{align} This is not an ideal perpendicular' column: the angles with yellow\varphi_{yc} = 88$\,\degree\ and green$\varphi_{yc} = 70$\,\degree\ are smaller than 90\,\degree . In return, however, this pure dye has a proper colour' in RGB with values: \begin{equation} \col{\hat{R}}_c = 256\cdot \mathrm{e}^{\begin{bmatrix*}[r] 0.2609 \\ 0.9654\\ 0\end{bmatrix*} \cdot 1} - 1 = \begin{bmatrix*}[r] 196\\ 96 \\ 255 \end{bmatrix*} \label{flagJA2rRc} \end{equation} 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} \subsection{Deconvolution and reconstruction} \begin{figure}[h] This makes the new$\mat{K}matrix and its inverse come out as: \begin{align} \mat{K} & = \begin{bmatrix*}[r] 0.0007 & 0.9631 & 0.2609\\ 0.0357 & 0.0860 & 0.9654\\ 0.9994 & 0.2549 & 0 \end{bmatrix*} \label{JA2rK}\\ \mat{K}^{-1}& = \begin{bmatrix*}[r] -0.2707 & 0.0732 & 0.9982\\ 1.0614 & -0.2868 & 0.0095\\ -0.0846 & 1.0587 & -0.0378\end{bmatrix*} \label{JA2rinvK} \end{align} So that solving for the amounts of dye in the flag (equation \ref{solveap}) comes out as figure \ref{flagJA2ras}, \begin{figure}[h!] \tiny \subfloat[\label{flagJA2ray}]{% \def\svgwidth{0.47\linewidth}\includesvg{pics/flagJA2ray}}\hfill ... ... @@ -285,24 +296,30 @@ Note that with this method total absorption per channel across the three dyes is \def\svgwidth{0.47\linewidth}\includesvg{pics/flagJA2rag}}\\ \subfloat[\label{flagJA2rac}]{% \def\svgwidth{0.47\linewidth}\includesvg{pics/flagJA2rac}}\\ \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}); and \textbf{(c)} the amount of complementary colour. \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}); and \textbf{(c)} the amount of complementary colour. \label{flagJA2ras}} \end{figure} \subsection{Reconstruction} \begin{figure}[p] \subfloat[RGB = 252, 207, 0\label{flagJA2ry}]{% and reconstruction of pure dye and combined dye RGB images comes out as figure \ref{flagJA2rrecon}. \begin{figure}[h!] \subfloat[RGB = 252, 207, 0 / 252, 216, 2\label{flagJA2ry}]{% \includegraphics[width=0.47\linewidth]{pics/flagJA2ry.png}}\hfill \subfloat[RGB = 0, 154, 58\label{flagJA2rg}]{% \subfloat[RGB = 0, 154, 58 / 3, 174, 83\label{flagJA2rg}]{% \includegraphics[width=0.47\linewidth]{pics/flagJA2rg.png}}\\ \subfloat[RGB = 0, 0, 0\label{flagJA2rc}]{% \subfloat[RGB = 65, 1, 253\label{flagJA2rc}]{% \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 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}} \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 Ruifrok' dye; and \textbf{(d)} RGB image with contributions of all three dyes together (equation \ref{flagJARygb}). \label{flagJA2rrecon}} \end{figure} The results for the yellow and green parts in the flag are still 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 now consist of 80\,\% of the flags yellow dye (figures \ref{flagJA2ray} and \ref{flagJA2ry}), 76\,\% of the flags green dye (figures \ref{flagJA2rag} and \ref{flagJA2rg}) and 5.2 units' of the third Ruifrok' dye (figures \ref{flagJA2rac} and \ref{flagJA2rc}). But this combination also, results in proper black' in the reconstructed flag (figure \ref{flagJA2rygc}). \section{Two blending flag colours analysis} \nocite{Haub2015} \ No newline at end of file