RETRO commands


PROGRAM NAME

vcmtrans - Linear Color Space Conversion with Specified 3x3 Matrix (K1)

DESCRIPTION

vcmtrans will take a multi-spectral input image and output an image of color space model GENERIC by applying a user specified color space conversion matrix.

The input image must be of data storage type FLOAT, and contain three data bands. The color space model for the input image can be set to any type. The input image will be normalized by the value specified by the -n option. The default is 255.

The second input image specifies the transformation matrix. This image must be of data storage type float and must be a 3x3 image. The format of this image must be:

   { 11, 12, 13 }
   { 21, 22, 23 }
   { 31, 32, 33 }

This image can be imported using kasc2val. It is important to remember that the input image will be normalized by the normalization option. The default is 255.0. The conversion is performed as follows:

\(bu Band 1 of the input image is updated by:
pixel = matrix[0][0]*(t1) + matrix[0][1]*(t2) + matrix[0][2]*(t3)

\(bu Band 2 of the input image is updated by:
pixel = matrix[1][0]*(t1) + matrix[1][1]*(t2) + matrix[1][2]*(t3)

\(bu Band 3 of the input image is updated by:

pixel = matrix[2][0]*(t1) + matrix[2][1]*(t2) + matrix[2][2]*(t3)
where t1 = pixel from band 1
where t2 = pixel from band 2
where t3 = pixel from band 3

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?

REQUIRED ARGUMENTS

-i1
type: infile
desc: input image
-i2
type: infile
desc: input transformation matrix
-o
type: outfile
desc: output resulting image

OPTIONAL ARGUMENTS

-n
type: float
desc: specifies normalization factor
default: 255
bounds: value > 0.0

EXAMPLES

SEE ALSO

RESTRICTIONS

The input image must be of data storage type FLOAT. The user specified matrix image must have a data storage type for float.

REFERENCES

COPYRIGHT

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