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

prepare for figures

parent 68eb32ce
......@@ -4,12 +4,13 @@ clear all; close all;
im = imread('pics/Flag_of_Jamaica.png');
% image colours
dyes = [254 209 0; % yellow
0 155 58;
0 0 0]'; % green
0 155 58]'; % green
% do the deconvolve
[amounts, P, Q, R, RGB, A, K, iOD] = cld_decon(dyes, im, 'rgb');
[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
......@@ -26,64 +27,87 @@ for d = 1:3
end
figure
imshow(sum(amounts, 3)/10)
imshow(sum(amounts, 3)/16)
colormap(gray)
colorbar
figure
imshow(uint8(round(P)))
% imwrite(uint8(P), 'pics/flagJAy.png', 'PNG')
imwrite(uint8(P), 'pics/flagJA2py.png', 'PNG')
figure
imshow(uint8(round(Q)))
% imwrite(uint8(Q), 'pics/flagJAg.png', 'PNG')
imwrite(uint8(Q), 'pics/flagJA2pg.png', 'PNG')
figure
imshow(uint8(round(R)))
% imwrite(uint8(R), 'pics/flagJAb.png', 'PNG')
imwrite(uint8(R), 'pics/flagJA2pb.png', 'PNG')
figure
imshow(uint8(round(RGB)))
% imwrite(uint8(RGB), 'pics/flagJAygb.png', 'PNG')
imwrite(uint8(RGB), 'pics/flagJA2pygb.png', 'PNG')
min(amounts(:))
max(amounts(:))
% normalised deconvolution colours
p = 0; done = -1; Imax = 255;
for r = 1:size(im, 1)
for c = 1:size(im, 2)
p = p + 1; % update pixel count
if round(100*p/(numel(im)/3)) > done
% update feedback
done = round(100*p/(numel(im)/3));
fprintf('\b\b\b\b\b\b\b\b\b%3i%% done', done)
end
%%%% Ruifrok
pam = squeeze(amounts(r, c, :));
pam = pam/max(pam);
% reconstruct pixels RGB contributions
[RGB(r, c, :), PQR] = cld_od2rgb(K, pam, Imax);
P(r, c, :) = PQR(:, 1);
Q(r, c, :) = PQR(:, 2);
R(r, c, :) = PQR(:, 3);
As = A.^2;
for c = 1:3
if sum(As(c, 1:2)) < 1
A(c, 3) = sqrt(1 - sum(As(c, 1:2)));
else
A(c, 3) = 0;
end
end
% do the deconvolve
[amounts, P, Q, R, RGB, A, K] = cld_decon(A, im, 'od');
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/flagJAyn.png', 'PNG')
imwrite(uint8(P), 'pics/flagJA2ry.png', 'PNG')
figure
imshow(uint8(round(Q)))
% imwrite(uint8(Q), 'pics/flagJAgn.png', 'PNG')
imwrite(uint8(Q), 'pics/flagJA2rg.png', 'PNG')
figure
imshow(uint8(round(R)))
% imwrite(uint8(R), 'pics/flagJAbn.png', 'PNG')
imwrite(uint8(R), 'pics/flagJA2rb.png', 'PNG')
figure
imshow(uint8(round(RGB)))
% imwrite(uint8(RGB), 'pics/flagJAygbn.png', 'PNG')
imwrite(uint8(RGB), 'pics/flagJA2pygb.png', 'PNG')
min(amounts(:))
max(amounts(:))
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