-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHistogramsOfColorImages.m
74 lines (56 loc) · 1.05 KB
/
HistogramsOfColorImages.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
73
74
clc;
clear;
i=1;
figure(i);
x=2;
y=2;
z=1;
subplot(y,x,z);
lena_RGB=imread('lenaRGB.bmp');
imshow(lena_RGB);
z=z+1;
subplot(y,x,z);
lena_R=lena_RGB(:,:,1);
imshow(lena_R);
title("RED");
z=z+1;
subplot(y,x,z);
lena_G=lena_RGB(:,:,2);
imshow(lena_G);
title("GREEN");
z=z+1;
subplot(y,x,z);
lena_B=lena_RGB(:,:,3);
imshow(lena_B);
title("BLUE");
equ_R=histeq(lena_R,256);
equ_G=histeq(lena_G,256);
equ_B=histeq(lena_B,256);
lena_color_equ=lena_RGB;
lena_color_equ(:,:,1)=equ_R;
lena_color_equ(:,:,2)=equ_G;
lena_color_equ(:,:,3)=equ_B;
i=i+1;
figure(i);
subplot(1,2,1);
imshow(lena_RGB);
title("Orginal");
subplot(1,2,2);
imshow(lena_color_equ);
title("Every Color Equalized");
%%
lena_HSV=rgb2hsv(lena_RGB);
lena_HSV_V=lena_HSV(:,:,3);
equ_brightnes=histeq(lena_HSV_V);
lena_HSV_Equ=lena_HSV;
lena_HSV_Equ(:,:,3)=equ_brightnes;
lena_RGB_from_HSV=hsv2rgb(lena_HSV_Equ);
subplot(1,3,1);
imshow(lena_RGB);
title("Orginal");
subplot(1,3,2);
imshow(lena_color_equ);
title("Every Color equalized");
subplot(1,3,3);
imshow(lena_RGB_from_HSV);
title("HSV-V equalized");