RETRO commands


PROGRAM NAME

vcltrans - Convert Between Tristimulus Color Spaces

DESCRIPTION

vcltrans performs the linear transformations between YIQ, XYZ, CMY, UVW and RGB color spaces. These transformations were taken from Pratt (Digital Image Processing, 1978). The values in the transformation matrices are based on NTSC RGB standard phosphors, as Pratt describes.

The following transformation matrices are used:

RGBtoYIQ = { { 0.299,  0.587,  0.114},
             { 0.596, -0.274, -0.322},
             { 0.211, -0.523,  0.312} };

RGBtoXYZ = { { 0.607, 0.174, 0.201}, { 0.299, 0.587, 0.114}, { 0.000, 0.066, 1.117} };

RGBtoUVW = { { 0.405, 0.116, 0.133}, { 0.299, 0.587, 0.114}, { 0.145, 0.827, 0.627} };

YIQtoRGB = { { 1.000, 0.956, 0.621}, { 1.000, -0.272, -0.647}, { 1.000, -1.106, 1.703} };

YIQtoXYZ = { { 0.967, 0.318, 0.594}, { 1.000, 0.000, 0.000}, { 1.173, -1.238, 1.870} };

YIQtoUVW = { { 0.653, 0.208, 0.403}, { 1.000, 0.000, 0.000}, { 1.599, -0.780, 0.623} };

XYZtoRGB = { { 1.910, -0.533, -0.288}, {-0.985, 2.000, -0.028}, { 0.058, -0.118, 0.896} };

XYZtoYIQ = { { 0.000, 1.000, 0.000}, { 1.407, -0.842, -0.451}, { 0.932, 1.189, 0.233} };

XYZtoUVW = { { 0.667, 0.000, 0.000}, { 0.000, 1.000, 0.000}, {-0.500, 1.500, 0.500} };

UVWtoRGB = { { 2.432, 0.332, -0.576}, {-1.519, 2.083, -0.057}, { 1.440, -2.823, 1.803} };

UVWtoYIQ = { { 0.000, 1.000, 0.000}, { 1.403, 0.534, -0.907}, { 1.757, -1.898, 0.470} };

UVWtoXYZ = { { 1.500, 0.000, 0.000}, { 0.000, 1.000, 0.000}, { 1.500, -3.000, 2.000} };

The input image must be of type FLOAT, and of color space model ntscYIQ, cieXYZ, ntscCMY, cieUVW, ntscRGB or genericRGB. If the image is not in float format, it will be converted automatically, if the conversion is an upward conversion. The input image will be normalized by the value specified by the -n option. The default is 255.

When converting between the different color spaces, care must be taken in regards to the normalization factor. If the image had been scaled by using kscale, then the scale factor used in kscale should be the normalization factor used in this routine. The resulting image should not be normalized by using knormal, if the inverse transformation is desired. The data will be corrupted. NOTE: The output values of some of the transformations will be negative, and some values will be greater than 1. If conversion to BYTE is desired, then a possible solution is:

1. use vbandspt3 to obtain 3 grey level images

2. use kadd to offset the image by the maximum negative value. The offset value will most likely be different for each of the three images.

3. use kstats to get the maximum pixel value in the image and divide that by the maximum desired pixel value. This gives the scale factor. (EX. 3.2/255 = scale factor).

4. now use kconvert to scale (NOT NORMALIZE) by the computed scale factor and convert to BYTE.

5. kinset can be used to create a multi-spectral image.

The reverse of the steps above may be followed to obtain the original image (scale by the inverse of the scale factor).

We really do not know what it means to manipulate this data as explained above, except to make it displayable?

If converting from YIQ, UWV, or XYZ to CMY the routine first converts to RGB then converts to CMY because CMY = 1 - RGB.

REQUIRED ARGUMENTS

-i
type: infile
desc: input image
-o
type: outfile
desc: output resulting image

OPTIONAL ARGUMENTS

-n
type: float
desc: specifies normalization factor
default: 255
bounds: value > 0.0
-t
type: integer toggle
desc: lets user chose color space model
default: 1
allowed values:

EXAMPLES

vcltrans -i ball.YIQ.xv -o ball.RGB.xv -t 2 -n 255.0

This will convert the input image, which has a color space model of YIQ, to a color space model of genericRGB. The normalization factor used is 255.

vcltrans -i ball.RGB.xv -o ball.UVW.xv -t 6

This will convert the input image, which has a color space model of RGB, to an image with a color space model of cieUVW. The default normalization factor of 255 is used.

SEE ALSO

RESTRICTIONS

The input image must be of one of the color space models listed above. The data type of the input must be VFF_TYP_FLOAT.

REFERENCES

COPYRIGHT

Copyright (C) 1993 - 1997, Khoral Research, Inc. ("KRI") All rights reserved.