<< radon SIP - Scilab Image Processing Toolbox hsv2ntsc >>

SIP - Scilab Image Processing Toolbox >> SIP - Scilab Image Processing Toolbox > rgb2hsv

rgb2hsv

Converts from RGB to HSV colorspace.

Calling Sequence

HSV = rgb2hsv(RGB)
HSVMAP = rgb2hsv(RGBMAP)

Parameters

RGB
A RGB image (M x N x 3) in 0-1 range or a RGB colormap (M x 3) in 0-1 range
HSV
A HSV image (M x N x 3) in 0-1 range or a HSV colormap (M x 3) in 0-1 range

Description

rgb2hsv(RGB) converts an RGB image or colormap to the HSV colorspace. The HSV model separates Hue (color) Saturation (ammount of color) and Value (intensity). It is much more useful for manipulation than the RGB space and also for segmenting images by color.

Examples

rgb = imread(SIPDIR + 'images/tru.jpg'):
clf;
imshow(rgb);

hsv = rgb2hsv(rgb);
clf;
imshow(hsv(:,:,3))  // intensity
imshow(hsv(:,:,1))  // hue (color component)

hsv(:,:,2) = 1      // saturate the image

rgb = hsv2rgb(hsv);
clf;
imshow(rgb);

// You may also convert a single triplet:

rgb2hsv([1 1 0])

Authors

Availability

The latest version of SIP can be found at

http://siptoolbox.sf.net

See Also


<< radon SIP - Scilab Image Processing Toolbox hsv2ntsc >>