vcrgbhsv(1)

PROGRAM
vcrgbhsv - Conversion between NTSC RGB and HSV color spaces.

SYNTAX

vcrgbhsv

-i  input image filename

-o  output image filename

[-n]
    normalization factor

[-h]
    Convert (RGB to HSV) [True] or (HSV to RGB) [False]

[-V]
    Gives the version for vcrgbhsv

[-U]
    Gives the usage for vcrgbhsv

[-P]
    Prompts for command line options

[-A [file1]]
    Creates the answer file called vcrgbhsv.ans or file1

[-a [file1]]
    Uses vcrgbhsv.ans or file1 as the answer file

DESCRIPTION
vcrgbhsv converts between NTSC RGB or generic RGB and HSV color spaces. Color images are displayed and manipulated using the NTSC receiver primary color system. Either genericRGB or ntscRGB are valid models. This routine needs to work with an image normalized between 0 and 1.

The routine sets the zero degree hue to be red, with green and blue following in counter clockwise direction. When converting from RGB to HSV, any time that the saturation is 0 (grey level), hue is undefined and is therefore set to 0 (red). This may degrade the image. When converting from HSV to RGB, any time a saturation of zero is encountered, the R,G, and B data are all assigned the value of L (result is a gray level).

The algorithm which transforms from RGB to HSV and HSV to RGB was taken from Foley & VanDam (Fundamentals of Interactive Computer Graphics). The routine was slightly modified because the hue is not in degrees.

The -h option specifies which conversion will be done. If -h = 1 (YES, default), the conversion is from RGB to HSV. If -h = 0 (NO), the conversion is from HSV to RGB.

The -n option specifies the normalization factor. The default value is 255.

This routine will not touch the data map; therefore, the map may be invalid after running this routine. The map be be deleted from the image or a new map may be inserted.

REQUIRED ARGUMENTS

-i  type: infile
    desc: input image filename

-o  type: outfile
    desc: output image filename

OPTIONAL ARGUMENTS

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

-h  type: boolean
    desc: Convert (RGB to HSV) [True] or (HSV to RGB) [False]
    default: true

EXAMPLES
vcrgbhls -i image1 -o image2 -h 1
this will convert image1 (RGB) to image2 (HSV) using normalization factor = 255. Normalization factor = 255 is used because an 8 color plane machine (256 colors) is being used.

vcrgbhls -i image1 -o image2 -h 2 -n 15
this will convert image1 (HSV) to image2 (RGB) using normalization factor = 15. Normalization factor = 15 is used because a 4 color plane machine (16 colors) is being used.

SEE ALSO
intro(1), verror(3), vgparms(3), vutils(3), lvcrgbhsv(3)

RESTRICTIONS
vcrgbhsv must have an input image of data storage type FLOAT and the input image color map model must be of type ntscRGB, genericRGB or HSV.

COPYRIGHT
Copyright 1991, University of New Mexico. All rights reserved.