[vtkusers] Convert from RGBA values to the index in the VTK Lookup Table

Frederic Perez fredericpcx at yahoo.es
Wed Jan 26 04:19:41 EST 2005

Hi Kanghong Li,

 --- Kanghong Li <kli at issi-hsv.com> escribió: 
> Anyone knows a way to convert from RGB values (3 numbers + A if
> needed) to the scalar/index (a value between 0 and 1) in the default
> vtk lookup table? Thanks.
> For example, RGB (51,51,255), can I get a value between 0 and 1
> (index to the vtk lookup table) from that 3 numbers?

A possibility is to use the luminance.
A common expression is given by
 0.299*R + 0.587*G + 0.114*B
 A*(0.299*R + 0.587*G + 0.114*B).

Notice that if your values range between 0 and 255 you will have
to divide them by 255 (the R, G, B values of the previous ex-
pressions should lie in [0..1]).


Frederic Perez

Renovamos el Correo Yahoo!: ¡250 MB GRATIS! 
Nuevos servicios, más seguridad 

More information about the vtkusers mailing list