FUNCTION REFERENCE

rgb2hsv

Convert red, green and blue to hue, saturation and value.

Convert red, green and blue to hue, saturation and value.

Syntax

rgb2hsv(MAP); [H, S, V] = rgb2hsv(MAP); [H, S, V] = rgb2hsv(R, G, B)

A colormap is a double M-by-3 matrix. Hue and saturation are zero for black; hue is zero for gray. Three outputs return separate channels. MATLAB rejects uint8 colormaps. An M-by-N-by-3 RGB image may be double, single, uint8 or uint16 (integers scaled to [0, 1]); the HSV image is double (single for single input).

Example

rgb2hsv([1 0 0])   % [0 1 1]

Example

rgb2hsv(uint8(cat(3, 255, 0, 0)))   % 1x1x3 [0 1 1]

Differences from MATLAB: the three-input single-output form is not supported yet.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.