ColorModelConverter¶
-
MLModule
¶ genre LUT
author MeVis Medical Solutions AG
package MeVisLab/Standard
dll MLColor
definition mlColor.def see also ColorTable
,ColorMatrix
keywords rgb
,hsv
,hsi
,cmyk
,lab
,cmy
,yiq
,yuv
,xyz
Purpose¶
The module ColorModelConverter
converts the color model of an image to another color model.
Usage¶
Either set the module to Automatically convert to RGB
to automatically detect the input image’s color model and to convert to RGB or chose a specific conversion if the source color model is known.
If the number of input channels does not match to the chosen conversion mode, then an error is written to the log file and the output is set to invalid.
Details¶
RGB¶
This color model is based on the human perception of the light. Every color can be fragmented into the base colors red, green and blue in almost the same manner as by the receptors of the human eye.
RGB is a additive color mix. All gray values are lying on the black - white diagonal. This color model is used when the eye perceives the color directly without reflection.
HSV¶
Based on segmentation of the color into hue, saturation and value. It is possible to display this color model in form of a cylinder or a cone.
Value is displayed on the Z - axis. Saturation is the distance from the cylinder axis and hue is the degree at the color circle (blue 240 degrees, green 120 degrees and red 0 degrees).
HLS¶
Established 1979 from the Core committee (Graphics Standards Planning Committee).
H stands for Hue, L for Lightness and S for Saturation.
It is similar to the HSV color model. Hue is the angle of the color circle, Lightness is the gray value on the L - axis and Saturation is the distance from the L - axis.
CMY¶
Is mostly used if the eyes perceive reflection of objects.
CMY is subtractive color model and based on the fundamental colors cyan, magenta and yellow. Those fundamental colors are complementary to the fundamental colors of RGB.
CMYK¶
Like CMY, but with an extra black part. Its useful in printing colors, because black is not exactly presentable (in printing) with the CMY model.
k(someK) = min(c,m,y)
YIQ¶
Defined by the American NTSC - standard (NTSC = National Television System Committee).
YIQ is downward compatible to black and white tv, when only Y is used.
Y stand for luminance and is the primary parameter; I is the red weight and Q is the blue weight to the luminance.
Y = Luminance
I = Red - Y
Q = Blue - Y
Conversion from YIQ to RGB:
YUV¶
Defined by the European PAL standard (PAL = Phase Alternation Line). Same principle as YIQ.
Y = Luminance
I = 0.493 * (B-Y)
Q = 0.877 * (B-Y)
Conversion from YUV to RGB:
XYZ¶
The XYZ colorspace was defined 1931 by the CIE (CIE = Comission Internationale d´Éclairage).
XYZ are standardized primary colors. Y is equivalent to the luminance and X and Z contain color information.
The XYZ colorspace contains all colors - not only the visible ones. This model is machine-independent.
Conversion from XYZ to RGB:
var_X = X / 100 //Where X = 0 ... 95.047
var_Y = Y / 100 //Where Y = 0 ... 100.000
var_Z = Z / 100 //Where Z = 0 ... 108.883
var_R = var_X * 3.2406 + var_Y * -1.5372 + var_Z * -0.4986
var_G = var_X * -0.9689 + var_Y * 1.8758 + var_Z * 0.0415
var_B = var_X * 0.0557 + var_Y * -0.2040 + var_Z * 1.0570
if ( var_R > 0.0031308 ) var_R = 1.055 * ( var_R ^ ( 1 / 2.4 ) ) - 0.055
else var_R = 12.92 * var_R
if ( var_G > 0.0031308 ) var_G = 1.055 * ( var_G ^ ( 1 / 2.4 ) ) - 0.055
else var_G = 12.92 * var_G
if ( var_B > 0.0031308 ) var_B = 1.055 * ( var_B ^ ( 1 / 2.4 ) ) - 0.055
else var_B = 12.92 * var_B
R = var_R * 255
G = var_G * 255
B = var_B * 255
Conversion from RGB to XYZ:
var_R = ( R / 255 ) //Where R = 0 ... 255
var_G = ( G / 255 ) //Where G = 0 ... 255
var_B = ( B / 255 ) //Where B = 0 ... 255
if ( var_R > 0.04045 ) var_R = ( ( var_R + 0.055 ) / 1.055 ) ^ 2.4
else var_R = var_R / 12.92
if ( var_G > 0.04045 ) var_G = ( ( var_G + 0.055 ) / 1.055 ) ^ 2.4
else var_G = var_G / 12.92
if ( var_B > 0.04045 ) var_B = ( ( var_B + 0.055 ) / 1.055 ) ^ 2.4
else var_B = var_B / 12.92
var_R = var_R * 100
var_G = var_G * 100
var_B = var_B * 100
X = var_R * 0.4124 + var_G * 0.3576 + var_B * 0.1805
Y = var_R * 0.2126 + var_G * 0.7152 + var_B * 0.0722
Z = var_R * 0.0193 + var_G * 0.1192 + var_B * 0.9505
CIE LAB¶
CIE L*a*b* (CIELAB) is the most complete color model used conventionally to describe all the colors visible to the human eye. It was developed for this specific purpose by the International Commission on Illumination (Commission Internationale d’Eclairage).
The three basic coordinates represent the lightness of the color (L*, L* = 0 yields black and L* = 100 indicates white), its position between red/magenta and green (a*, negative values indicate green while positive values indicate magenta) and its position between yellow and blue (b*, negative values indicate blue and positive values indicate yellow). The L*a*b* color model has been created to serve as a device independent model to be used as a reference. Therefore it is crucial to realize that the visual representations of the full gamut of colors in this model are never accurate. They are there just to help in understanding the concept, but they are inherently inaccurate.
Uniform changes of components in the L*a*b* color model aim to correspond to uniform changes in perceived color. So the relative perceptual differences between any two colors in L*a*b* can be approximated by treating each color as a point in a three dimensional space (with three components: L*, a*, b*) and taking the Euclidean distance between them.
Parameter Fields¶
Visible Fields¶
Direction Select¶
-
name:
directionSelect
, type:
Enum
, default:
Identity
¶ Defines a specific conversion.
Values:
Title | Name | Deprecated Name |
---|---|---|
Identity | Identity | RGB to RGB |
RGB to HSV | RGB to HSV | |
HSV to RGB | HSV to RGB | |
RGB to CMY | RGB to CMY | |
CMY to RGB | CMY to RGB | |
CMY to CMYK | CMY to CMYK | |
CMYK to CMY | CMYK to CMY | |
CMYK to RGB | CMYK to RGB | |
RGB to CMYK | RGB to CMYK | |
RGB to HLS | RGB to HLS | |
HLS to RGB | HLS to RGB | |
RGB to YIQ | RGB to YIQ | |
YIQ to RGB | YIQ to RGB | |
RGB to YUV | RGB to YUV | |
YUV to RGB | YUV to RGB | |
RGB to XYZ | RGB to XYZ | |
XYZ to RGB | XYZ to RGB | |
RGB to LAB | RGB to LAB | |
LAB to RGB | LAB to RGB | |
XYZ to LAB | XYZ to LAB | |
LAB to XYZ | LAB to XYZ | |
RGB to Gray | RGB to Gray | |
Gray to RGB | Gray to RGB |