Functions > Image Processing > Image Color Tools > Converting Images or Colors - RGB and HLS/HSV
  
Converting Images or Colors - RGB and HLS/HSV
The following functions convert HLS and HSV images to RGB and vice versa. They take images or color vectors stored in one color representation as input, and return an image or color vector in a different color representation.
rgb_to_hls(RGB)—Returns single color vector or packed image matrix RGB in RGB color representation converted to HLS color representation.
rgb_to_hsv(RGB)—Returns single color vector or packed image matrix RGB in RGB color representation converted to HSV color representation.
hls_to_rgb(HLS)—Returns single color vector or packed image matrix HLS in HLS color representation converted to RGB color representation.
hsv_to_rgb(HSV)—Returns single color vector or packed image matrix HSV in HSV color representation converted to RGB color representation.
Arguments
RGB, HLS, HSV are 3 x 1 vectors (of scalars or matrices) or packed image matrices with real values between 0 and 255.
Alternatively, the functions described above can take three arguments, for example (R,G,B), where R, G, and B are scalars or matrices.