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

about the third colour

parent aa305147
......@@ -152,13 +152,58 @@ We therefore did not deconvolve with the actual colours (absorptions) in the fla
\end{figure}
\section{Two colour flag analysis}
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 colour, or as a colour to be deconvolved (in yellow and green).
However, since colour deconvolution in RGB \textsl{has} to be done with \textsl{three} `input colours' (matrix $\mat{K}$ needs to be 3 by 3), we'll have come up with an alternative third `colour'.
\subsection{Adding a third `perpendicular' absorption column}
Our calculations are done with the $\mat{K}$ matrix with (normalised) absorption columns. For computational reasons it is best when the angles between the three absorption columns in that matrix are all 90\,\degree .
To find the angle between two columns, you can take the inverse cosine of `the inner dot product' of the two columns (equation \ref{angledot}). So the absorption angle between the flags yellow dye and green dye is
\begin{align}
\varphi_{yg} & = \acos \left(\colt{\hat{k}}_y \cdot \col{\hat{k}}_g\right) \notag \\
& = \acos \left(k_{y_1} \cdot k_{g_1} + k_{y_2} \cdot k_{g_2} + k_{y_3} \cdot k_{g_3} \right) \notag \\
& = \acos \left( 0.0007\cdot 0.9631 + 0.0357\cdot 0.0860 + 0.9994 \cdot 0.2549\right) \notag \\
& = \acos\left(0.2585\right) \notag \\
& = 75\,\degree
\end{align}
Similarly, we can find for the absorption angle between the flags yellow dye and black dye, and between the flags green dye and black dye:
\begin{align}
\varphi_{yb} & = 53\,\degree\\
\varphi_{gb} & = 41\,\degree
\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 .
\section{Two colour flag analysis}
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.
\subsection{Deconvolution}
\subsection{Reconstruction}
\subsection{Adding a third `Ruifrok' absorption column}
\begin{equation}
\col{\hat{A}}_c = \begin{bmatrix} \sqrt{1 - k_{y_1}^2 - k_{g_1}^2} \\[1em] \sqrt{1 - k_{y_2}^2 - k_{g_2}^2} \\[1em] \sqrt{1 - k_{y_3}^2 - k_{g_3}^2}\end{bmatrix},\, \col{\hat{A}}_c \leq 0
\end{equation}
\subsection{Deconvolution}
\subsection{Reconstruction}
\section{Two blending flag colours analysis}
\section{Two blending flag colours analysis}
\ No newline at end of file
\nocite{Haub2015}
\ No newline at end of file
......@@ -4,8 +4,7 @@ clear all; close all;
im = imread('pics/Flag_of_Jamaica.png');
% image colours
dyes = [254 209 0; % yellow
0 155 58 % green
0 0 0]'; % black
0 155 58]'; % green
% do the deconvolve
[amounts, P, Q, R, RGB, A, K, iOD] = cld_decon(dyes, im, 'rgb');
......
clear all; close all;
% read image
im = imread('pics/Flag_of_Jamaica.png');
% image colours
dyes = [254 209 0; % yellow
0 155 58 % green
0 0 0]'; % black
% do the deconvolve
[amounts, P, Q, R, RGB, A, K, iOD] = cld_decon(dyes, im(1, 1, :), 'rgb');
% do the deconvolve
[amounts, P, Q, R, RGB, A, K2, iOD] = cld_decon(dyes(:, 1:2), im(1, 1, :), 'rgb');
K(:, 4) = K2(:, 3);
dyes(:, 4) = 255/300*256*exp(-2*K(:, 4)) - 1;
figure
hold on
for c = 1:4
quiver3(0, 0, 0, K(1, c), K(2, c), K(3, c), 'linewidth', 2, 'color', dyes(:, c)/255)
end
R = eye(3);
for c = 1:3
quiver3(0, 0, 0, R(1, c), R(2, c), R(3, c), 'linewidth', 1, 'color', R(:, c))
end
grid on
axis equal
xlabel('R')
ylabel('G')
zlabel('B')
set(gca, 'view', [34 37])
% do the deconvolve
[amounts, P, Q, R, RGB, A, K, iOD] = cld_decon(eye(3), im(1, 1, :), 'rgb');
R = eye(3);
figure
hold on
for c = 1:3
quiver3(0, 0, 0, K(1, c), K(2, c), K(3, c), 'linewidth', 2, 'color', R(:, c))
end
for c = 1:3
quiver3(0, 0, 0, R(1, c), R(2, c), R(3, c), 'linewidth', 1, 'color', R(:, c))
end
grid on
axis equal
xlabel('R')
ylabel('G')
zlabel('B')
set(gca, 'view', [34 37])
svgprint(1, 'pics/arrowsflag')
svgprint(2, 'pics/arrowsRGB')
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