SIVP Toolbox
Last update : August, 2006

rgb2hsv - Convert a RGB image to the equivalent HSV image.

### Calling Sequence

  `HSV = rgb2hsv(RGB)`

### Parameters

- `RGB`: A RGB image (hypermat), the dimension of `RGB` should be `M x N x 3`.
- `HSV`: Output image, which has the same size as `RGB` and type of double.

### Description

`rgb2hsv` convert a RGB image to the equivalent HSV image using:

  `V = max(R,G,B)`
  `S = (V-min(R,G,B))/V` if V<>0, 0 otherwise
  `H =`
    `(G - B)/6/S`, if V=R;
    `1/2+(B - R)/6/S`, if V=G;
    `2/3+(R - G)/6/S`, if V=B.

Supported classes: INT8, UINT8, INT16, UINT16, INT32, DOUBLE. If `RGB` is not a double image, it will be converted to double image first in the procedure.

### Examples

        RGB = imread('lena.png');
        HSV = rgb2hsv(RGB);
        RGB = hsv2rgb(HSV);
        imshow(RGB);

### Authors

  Shiqi Yu <shiqi.yu[at]gmail.com>

### Availability

The latest version of SIVP can be found at

http://sivp.sourceforge.net

### See Also

`rgb2gray`, `mat2gray`, `hsv2rgb`, `rgb2ycbcr`, `ycbcr2rgb`, `rgb2ntsc`, `ntsc2rgb`,