[][src]Function arrayfire::color_space

pub fn color_space<T>(
    input: &Array<T>,
    tospace: ColorSpace,
    fromspace: ColorSpace
) -> Array<T> where
    T: HasAfEnum + RealNumber

Color space conversion

Following are the supported conversions

  • RGB => GRAY
  • GRAY => RGB
  • RGB => HSV
  • HSV => RGB
  • YCbCr => RGB
  • RGB => YCbCr

RGB (Red, Green, Blue) is the most common format used in computer imaging. RGB stores individual values for red, green and blue, and hence the 3 values per pixel. A combination of these three values produces the gamut of unique colors.

HSV (Hue, Saturation, Value), also known as HSB (hue, saturation, brightness), is often used by artists because it is more natural to think about a color in terms of hue and saturation than in terms of additive or subtractive color components (as in RGB). HSV is a transformation of RGB colorspace; its components and colorimetry are relative to the RGB colorspace from which it was derived. Like RGB, HSV also uses 3 values per pixel.

GRAY is a single channel color space where pixel value ranges from 0 to 1. Zero represents black, one represent white and any value between zero & one is a gray value

Parameters

  • input is the input image
  • tospace is the target color space. Takes values of ColorSpace
  • fromspace is the source image color space. Takes values of ColorSpace

Return Values

An Array with input image values in target color space