SIP Toolbox

rgb2hsv - Converts from RGB to HSV colorspace

Calling Sequence

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

Parameters

Description

rgb2hsv(RGB) converts an RGB image or colormap from 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'):
      xbasc();
      imshow(rgb);

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

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

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

      // You may also convert a single triplet:

      rgb2hsv([1 1 0])

   

Authors

Ricardo Fabbri <ricardofabbri (AT) users DOT sf DOT net>

Availability

The latest version of the Scilab Image Processing toolbox can be found at

http://siptoolbox.sourceforge.net

See Also

hsv2rgb,  rgb2ntsc,  im2gray,