-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotHistMatch.m
More file actions
71 lines (54 loc) · 2.19 KB
/
Copy pathplotHistMatch.m
File metadata and controls
71 lines (54 loc) · 2.19 KB
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
function plotHistMatch(cdf_ref, cdf, images_ref, images, band)
%=========================================================================
%% Remotion of the black borders
%=========================================================================
show = 0;
images_ref(1).(band) = remove_borders(images_ref(1).(band), show);
images_ref(2).(band) = remove_borders(images_ref(2).(band), show);
images(1).(band) = remove_borders(images(1).(band), show);
images(2).(band) = remove_borders(images(2).(band), show);
% plot the CDF function of the reference
figure
subplot(1,2,1)
plot(cdf_ref.(band))
title('CDF of reference')
xlabel('Graylevel values')
ylabel('CDF')
% plot the CDF function of the image to be equalized
subplot(1,2,2)
plot(cdf.(band))
title(['CDF of the image to be matched of the band ', band])
xlabel('Graylevel values')
ylabel('CDF')
% Display equalized image
figure
subplot(1,2,1)
H = imshow(images_ref(1).(band), 'InitialMagnification', 10000);
set(H, 'AlphaData', ~isnan(images_ref(1).(band)))
axis equal tight
xlabel('col')
ylabel('row')
title(['Band ', band, ' of reference'])
subplot(1,2,2)
H = imshow(images(2).(band), 'InitialMagnification', 10000);
set(H, 'AlphaData', ~isnan(images(2).(band)))
axis equal tight
xlabel('col')
ylabel('row')
title([' Band ', band, ' after histogram matching '])
figure
subplot(1,2,1)
H = imshow(images_ref(2).(band), 'InitialMagnification', 10000);
set(H, 'AlphaData', ~isnan(images_ref(2).(band)))
axis equal tight
xlabel('col')
ylabel('row')
title([' Band ', band, ' before histogram matching '])
subplot(1,2,2)
H = imshow(images(2).(band), 'InitialMagnification', 10000);
set(H, 'AlphaData', ~isnan(images(1).(band)));
axis equal tight
xlabel('col')
ylabel('row')
title([' Band ', band, ' after histogram matching '])
end