Convert a RGB image to the equivalent HSV image.
HSV = rgb2hsv(RGB)
RGB
should be M x N x 3
.RGB
and type of double.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 otherwiseH =
(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.
RGB = imread('lena.png'); HSV = rgb2hsv(RGB); RGB = hsv2rgb(HSV); imshow(RGB); | ![]() | ![]() |
http://sivp.sf.net