Name

hsv2rgb — Convert a HSV image to the equivalent RGB image.

Calling Sequence

RGB = hsv2rgb(HSV)

Parameters

HSV
A HSV image (hypermat). The dimension of HSV should be M x N x 3, the type should be double and the element value range should be [0,1].
RGB
Output image, which has the same size as HSV and type of double.

Description

hsv2rgb convert a HSV image to the equivalent RGB image. The relationship between RGB and HSV described as follows:

  • 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 classe: DOUBLE.

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.sf.net

See Also

rgb2gray , mat2gray , rgb2hsv , rgb2ycbcr , ycbcr2rgb , rgb2ntsc , ntsc2rgb