-
Notifications
You must be signed in to change notification settings - Fork 0
/
explore_colorspaces.m
72 lines (58 loc) · 1.42 KB
/
explore_colorspaces.m
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
function Explore_colorspaces( digital_im )
%Explore_colorspaces Exploration of the image in 9 different channels in 3
% color spaces
%
% The channels explored here are respective channels in RGB, HSV, L*a*b
% This function assumes that the initial image is in RGB colorspace.
d_im = digital_im;
figure;
plot_cntr = 1;
subplot(3,3,plot_cntr);
imshow(d_im(:,:,1));
axis image;
title("(RGB) Red channel")
plot_cntr = plot_cntr + 1;
subplot(3,3,plot_cntr);
imshow(d_im(:,:,2));
axis image;
title("(RGB) Green channel")
plot_cntr = plot_cntr + 1;
subplot(3,3,plot_cntr);
imshow(d_im(:,:,3));
axis image;
title("(RGB) Blue channel")
plot_cntr = plot_cntr + 1;
% Convertion: RGB to HSV
hsv_im = rgb2hsv(d_im);
subplot(3,3,plot_cntr);
imshow(hsv_im(:,:,1));
axis image;
title("(HSV) Hue channel")
plot_cntr = plot_cntr + 1;
subplot(3,3,plot_cntr);
imshow(hsv_im(:,:,2));
axis image;
title("(HSV) Saturation channel")
plot_cntr = plot_cntr + 1;
subplot(3,3,plot_cntr);
imshow(hsv_im(:,:,3));
axis image;
title("(HSV) Value channel")
plot_cntr = plot_cntr + 1;
% Convertion: RGB to LAB
lab_img = rgb2lab(d_im);
subplot(3,3,plot_cntr);
imshow(lab_img(:,:,1));
axis image;
title("(LAB) Lightness channel")
plot_cntr = plot_cntr + 1;
subplot(3,3,plot_cntr);
imshow(lab_img(:,:,2));
axis image;
title("(LAB) Red/Green channel")
plot_cntr = plot_cntr + 1;
subplot(3,3,plot_cntr);
imshow(lab_img(:,:,3));
axis image;
title("(LAB) Blue/Yellow channel")
end