### Convert

Category

Transformation

Function

Converts between RGB and HSV color spaces.

Syntax

    Output = Convert(data, incolorspace, outcolorspace, addpoints);

Inputs

Name | Type | Default | Description
--- | --- | --- | ---
`data` | vector list or field | none | input colors or color map
`incolorspace` | string | "hsv" | color space of input
`outcolorspace` | string | "rgb" | color space of output
`addpoints` | integer | input dependent | add positions to ensure valid color transformations

Outputs

Name | Type | Description
--- | --- | ---
output | vector list or field | output colors or color map

Functional Details

`data` | specifies the value(s) to be converted. If the parameter value is a vector or list of vectors, the output is a vector or list of vectors. These must be of 3-vectors, representing hue, saturation, and value (HSV) or red, green, and blue (RGB). If the parameter value is a field, the module converts the "data" component of that field (which must consist of 3-vectors) from one color space to the other. The range of hues is 0 (red) to 1 (red); 0.3333 = green and 0.6666 = blue. Values outside this range simply "wrap." That is, a hue of 0 = a hue of 1 = a hue of 2, and so on. The range of saturation is 0 (white) to 1 (pure color). The range of value is 0 (black) to 1 (full intensity).
`incolorspace` | is the color space of the input (`data`) and must be "rgb" or "hsv."
`outcolorspace` | is the color space of the output and must be "rgb" or "hsv."
`addpoints` | specifies whether points are to be added to the resulting output: If `data` is a color map (i.e., if it has 1-D positions and 3-D data), the default value (1) specifies that points will be added to the "positions" component of the map so that the conversion between color spaces (which is nonlinear) remains valid. A parameter value of 0 (zero) specifies that no points are to be added. A parameter value of 1 (one) is valid only if the input is a color map. If the input object is not a color map (i.e., if it has positions of dimensionality greater than 1), the default value is 0 (zero) and the "data" component is converted as specified by `incolorspace` and `outcolorspace` in one-to-one fashion.

Components

Modifies the "data" component and may modify the "positions" component. All other input components are propagated to the output.

Example Visual Programs

    AlternateVisualizations.net
    UsingCompute.net

See Also

Color

[ OpenDX Home at IBM | OpenDX.org ]