testdeconJAyg.m 1.17 KB
Newer Older
Turnhout, M.C. van's avatar
Turnhout, M.C. van committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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, 'rgb');


% show image
figure
imshow(im)



% test image green/yellow
m = 3;
[ay, ag] = meshgrid(linspace(0, norm(A(:, 1)), 256), linspace(0, norm(A(:, 2)), 256));
tim = zeros([size(ag) 3]);
for r = 1:size(ag, 1)
    for c = 1:size(ag, 2)
        tim(r, c, :) = cld_OD2RGB(K, [ay(r, c), ag(r, c), 0]');
    end
end
figure
imshow(uint8(tim))

[tamounts, tP, tQ, tR, tRGB, tA, tK, tiOD] = cld_decon(dyes(:, 1:2), tim, 'rgb');

figure
imagesc(ay)
colorbar

figure
imagesc(squeeze(tamounts(:, :, 1)))
colorbar

p = ay(:);
q = squeeze(tamounts(:, :, 1)); q = q(:);
figure
plot(p, q, '.', [0 6], [0 6])


figure
imagesc(ag)
colorbar

figure
imagesc(squeeze(tamounts(:, :, 2)))
colorbar

p = ag(:);
q = squeeze(tamounts(:, :, 2)); q = q(:);
figure
plot(p, q, '.', [0 6], [0 6])


figure
imagesc(zeros(size(ay)))
colorbar

figure
imagesc(squeeze(tamounts(:, :, 3)))
colorbar

p = ay(:);
q = squeeze(tamounts(:, :, 3)); q = q(:);
figure
plot(p, q, '.', [0 6], [0 6])