PANDORE Version 6 GREYC-IMAGE

prgb2hsl



Converts RGB color image to HSL color image.



Synopsis

prgb2hsl [-m mask] [im_in|-] [im_out|-]

Description

prgb2hsl converts color image from the color space RGB (Red, Green, Blue) to the color space HSL (Hue, Saturation, Lightness).

A hue refers to the gradation of color within the visible spectrum, or optical spectrum, of light. It is expressed in degree unit [0..360].

Saturation or purity is the intensity of a specific hue: a highly saturated hue has a vivid, intense color, while a less saturated hue appears more muted and gray. With no saturation at all, the hue becomes a shade of gray. It is expressed as percentage [0..100].

Lightness is the amount of light in a color. It is expressed in gray level unit [0..255].

The output image is a float image.

The transformation from RGB to HSL is:

  let max = MAX(R,G,B) and min = MIN(R,G,B)

   |- 0				  if max = min
   |	     (G-B) 
H= |- (60 *  ----- + 360) mod 360 if max = R
   |	    (max-min)
   |	    (B-R) 
   |- (60 * -----  + 120) + 210	  if max = V
   |	    (max-min)
   |	     (R-G)
   |- (60 * -----  + 240)	  if max = B
   |       (max-min)


     (max+min)
L=   --------
         2

    |- 0		 if max = min
    |
    |	    max-min
    |- 100 *-------      if l<=1/2
S = |       max+min 
    |
    |         max-min
    |- 100 * ----------- if l>1/2
    |        2-(max+min) 

Inputs

Outputs

Result

Returns SUCCESS or FAILURE.

Examples

Converts parrot.pan from rgb to hsl and conversely.

   prgb2hsl parrot.pan a.pan
   phsltorgb a.pan b.pan

See also

Color, phsl2rgb

C++ prototype

Errc PRGB2HSL( const Imc2duc &im_in, Imc2dsf &im_out );

Author: Régis Clouard