Color Model Conversion function

Converts the color model of an image from either the hue, saturation, and value (HSV) to red, green, and blue (RGB) or vice versa.

The inputs for this function are the following:

The RGB color model

RGB is a color model based on additive primary colors. On a cathode ray tube (CRT) screen, each pixel (picture element) consists of a triad of phosphor colors: red, green, and blue. Light is emitted and displayed by the intensity at which these colors are projected by electron guns. An equal triad of fully saturated colors (255 255 255) will illuminate white, and conversely, 0 values will illuminate nothing, or black. Colors can be viewed spatially by using the RGB cube below.

Color Models RGB

In the RGB color model, pure gray shades are obtained by combining equal quantities of all three color values: red, green and blue. If all three values are set to 255, the total presence of color will illuminate white and, conversely, if all three color values are set to 0, the absence of color will illuminate black. This leaves 1 through 254 available indices for shades of gray. Approximately 20 shades of gray are discernible by the human eye.

The HSV color model

The HSV color model is based on a color system in which the color space is represented by a single cone. The three components of the cone are the hue, saturation, and value.

Color Models HSV

Related Topics