HSL2RGB_CVIP
hsl2rgb_cvip() - Converts Hue-Saturation-Lightness Color value to Red-Green-Blue Color value
Contents
SYNTAX
OutputImage = hsl2rgb_cvip(InputImage, type)
Input parameters include :
- InputImage - HSL Color value image
- type - output image preference (0,1) (0 = Forward non normalized output) (1 = gives normalized output)
Output parameter includes :
- OutputImage - Resultant RGB output.
DESCRIPTION
This function converts HSL (Hue-Saturation-Lightness) Color value to RGB Color value. The RGB color model is an additive color model in which red, green and blue light are added together in various ways to reproduce a broad array of colors. RGB color values are found from HSL color values as follows:
C = (1-|2L-1|) * S H' = H/60 X = C * (1-|H' mod 2 - 1|)
(0,0,0) (C,X,0) (X,C,0) R1,G1,B1 = (0,C,X) (0,X,C) (X,0,C) (C,0,X)
m = L - 0.5*C
(R,G,B) = (R1+m, G1+m, B1+m)
To view the 8-bit image of type double, divide by 255. To view the 16-bit image of type double, divide by 65535.
REFERENCE
1. Scott E Umbaugh. DIGITAL IMAGE PROCESSING AND ANALYSIS: Applications with MATLAB and CVIPtools, 3rd Edition.
EXAMPLE
% Read image X = imread('Car.bmp'); % Call function S1 = rgb2hsl_cvip(X); S2 = hsl2rgb_cvip(S1); % Display input image figure;imshow(X);title('Input image'); % Display output images figure;imshow(remap_cvip(S1),[]);title('Output image from rgb2hsl'); figure;imshow(remap_cvip(S2),[]);title('Output image from hsl2rgb');
CREDITS
Author: Deependra Mishra, March 2017
Copyright © 2017-2018 Scott
E Umbaugh
For updates visit CVIP Toolbox Website