
Color Processing 381
A color image Red component Green component Blue component
FIGURE 13.8: SEE COLOR INSERT An RGB color image and its components
MATLAB/Octave
>> xh = rgb2hsv(x);
>> for i = 1:3, figure(i+1),imshow(xh(:,:,i)),end
Python
In : xh = sk.color.rgb2hsv(x)
In : for i in range(3):
...: plt.figure(i); io.imshow(xh[:,:,i])
...:
and these are shown in Figure 13.9. We can do precisely the same thing for the YIQ color
Hue Saturation Value
FIGURE 13.9: The HSV components
space:
MATLAB/Octave
>> xyiq = rgb2ntsc(x);
>> for i = 1:3, figure(i+1),imshow(xyiq(:,:,i)),end
In Python, the function to use is rgb
_
to
_
yiq, which is part of the colorsys module and
whic ...