hsv2rgb
Converts colors from hue-saturation-value to red-green-blue.
Category: Graphics > Formatting and Annotation
Syntax
rgb = hsv2rgb(hsv)
Converts an m-by-3 colormap or an image of size m-by-n-by-3 from HSV to RGB.
Description
Hue is measured as a fraction of the color wheel: 0 is red, 1/3 is green, 2/3 is blue and 1 wraps back to red. Saturation 0 gives a gray and value sets the brightness.
Each row of a matrix is one color. The inverse conversion is rgb2hsv.
Input arguments
hsv- Matrix or image whose last dimension holds hue, saturation and value, each between 0 and 1.
Output arguments
rgb- Array of the same size with red, green and blue values between 0 and 1.
Example
Red and cyan from hues
hsv2rgb([0 1 1; 0.5 1 1; 0 0 0.5])
Output
ans = 3×3
1.0000 0 0
0 1.0000 1.0000
0.5000 0.5000 0.5000