-
Notifications
You must be signed in to change notification settings - Fork 0
/
hsv.m
21 lines (20 loc) · 877 Bytes
/
hsv.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
I = imread('football.jpg');
Ihsv = rgb2hsv(I);
IErH = edge(Ihsv(:,:,1),'roberts');
IErS = edge(Ihsv(:,:,2),'roberts');
IErV = edge(Ihsv(:,:,3),'roberts');
subplot(3,3,1), imshow(I);title('Origin');
subplot(3,3,4), imshow(IErH);title('Roberts-Hue');
subplot(3,3,5), imshow(IErS);title('Roberts-Saturation');
subplot(3,3,6), imshow(IErV);title('Roberts-Value');
IEsH = edge(Ihsv(:,:,1),'sobel');
IEsS = edge(Ihsv(:,:,2),'sobel');
IEsV = edge(Ihsv(:,:,3),'sobel');
subplot(3,3,1), imshow(I);title('Origin');
subplot(3,3,7), imshow(IEsH);title('Sobel-Hue');
subplot(3,3,8), imshow(IEsS);title('Sobel-Saturation');
subplot(3,3,9), imshow(IEsV);title('Sobel-Value');
Ihsv(:,:,3) = IErV; Irrgb = hsv2rgb(Ihsv);
subplot(3,3,2), imshow(Irrgb);title('Robert-Color');
Ihsv(:,:,3) = IEsV; Isrgb = hsv2rgb(Ihsv);
subplot(3,3,3), imshow(Isrgb);title('Sobel-Color');