Inviwo  0.9.10.1
Inviwo documentation
inviwo::color Namespace Reference

Functions

IVW_CORE_API vec4 hex2rgba (std::string str)
 convert from hexadecimal html color code to RGBA More...
 
IVW_CORE_API std::string rgba2hex (const vec4 &rgba)
 convert from rgba to 8-digit hexadecimal html color code More...
 
IVW_CORE_API std::string rgb2hex (const vec3 &rgb)
 convert from rgb to 6-digit hexadecimal html color code More...
 
IVW_CORE_API vec3 getD65WhitePoint ()
 reference white point D65 in CIE XYZ color space More...
 
IVW_CORE_API vec3 hsv2rgb (vec3 hsv)
 Convert from HSV to RGB color. More...
 
IVW_CORE_API vec3 rgb2hsv (vec3 rgb)
 Convert from RGB to HSV color. More...
 
IVW_CORE_API vec3 XYZ2lab (vec3 xyz, vec3 whitePoint=getD65WhitePoint())
 Convert from XYZ to Lab color space See http://en.wikipedia.org/wiki/CIE_1931_color_space and http://www.brucelindbloom.com/. More...
 
IVW_CORE_API vec3 lab2XYZ (vec3 lab, const vec3 whitePoint=getD65WhitePoint())
 Convert from Lab to CIE XYZ color space See http://en.wikipedia.org/wiki/Lab_color_space and http://www.brucelindbloom.com/. More...
 
IVW_CORE_API vec3 rgb2XYZ (const vec3 rgb)
 Convert from sRGB color to XYZ using D65 white point See http://en.wikipedia.org/wiki/CIE_1931_color_space, http://www.brucelindbloom.com/ and http://en.wikipedia.org/wiki/RGB_color_model. More...
 
IVW_CORE_API vec3 XYZ2rgb (vec3 xyz)
 Convert from CIE XYZ color to sRGB using D65 white point. More...
 
IVW_CORE_API vec3 XYZ2xyY (vec3 xyz)
 Convert from CIE XYZ color space to normalized xyY, which is for example used in the chromaticity diagram. More...
 
IVW_CORE_API vec3 xyY2XYZ (vec3 xyY)
 Convert from xyY color space to XYZ. More...
 
IVW_CORE_API vec3 rgb2lab (vec3 rgb)
 Convert from sRGB color to Lab using D65 white point. More...
 
IVW_CORE_API vec3 lab2rgb (vec3 lab)
 Convert from Lab color to sRGB using D65 white point. More...
 
IVW_CORE_API vec3 rgb2ycbcr (const vec3 &rgb)
 Convert from sRGB color to YCbCr. More...
 
IVW_CORE_API vec3 ycbcr2rgb (const vec3 &ycbcr)
 Convert from YCbCr color to sRGB. More...
 
IVW_CORE_API vec3 LuvChromaticity2rgb (const vec3 &LuvChroma, bool clamp=false, vec3 whitePointXYZ=getD65WhitePoint())
 Convert from normalized chromaticity of CIE Luv, i.e. u' and v', to sRGB. More...
 
IVW_CORE_API vec3 rgb2LuvChromaticity (const vec3 &rgb, vec3 whitePointXYZ=getD65WhitePoint())
 Convert from sRGB to normalized chromaticity of CIE Luv, i.e. u' and v'. More...
 
IVW_CORE_API vec3 LuvChromaticity2XYZ (const vec3 &LuvChroma, vec3 whitePointXYZ=getD65WhitePoint())
 Convert from normalized chromaticity of CIE Luv, i.e. u' and v', to XYZ. More...
 
IVW_CORE_API vec3 XYZ2LuvChromaticity (const vec3 &XYZ, vec3 whitePointXYZ=getD65WhitePoint())
 Convert from CIE XYZ color space to normalized chromaticity of CIE Luv, i.e. u' and v'. More...
 
IVW_CORE_API vec3 XYZ2Luv (const vec3 &XYZ, vec3 whitePointXYZ=getD65WhitePoint())
 Convert from CIE XYZ to CIE Luv. More...
 
IVW_CORE_API vec3 Luv2XYZ (const vec3 &Luv, vec3 whitePointXYZ=getD65WhitePoint())
 Convert from CIE Luv to CIE XYZ. More...
 

Detailed Description

color

Function Documentation

◆ getD65WhitePoint()

vec3 inviwo::color::getD65WhitePoint ( )

reference white point D65 in CIE XYZ color space

The values are obtained by converting sRGB(1, 1, 1) to XYZ using rgb2XYZ() since sRGB assumes D65 as reference white. See rgb2XYZ, http://www.brucelindbloom.com

Returns
white D65 in XYZ coordinates

◆ hex2rgba()

vec4 inviwo::color::hex2rgba ( std::string  str)

convert from hexadecimal html color code to RGBA

A hexadecimal html color code is converted to RGBA. Supports both 3 and 6 digit hexcodes with a leading '#' and optional alpha value (single / double digit). In case of 3 respective 6 digits, alpha is implicitly set to 1.0.

Supports "#RGB", "#RGBA", "#RRGGBB", "#RRGGBBAA"

Parameters
strhtml color code in the form of "#10a0b0ff" or "#a0b0c0"
Returns
RGBA color in [0 1]^3 range
Exceptions
Exceptionif string is malformed

◆ hsv2rgb()

vec3 inviwo::color::hsv2rgb ( vec3  hsv)

Convert from HSV to RGB color.

See http://en.wikipedia.org/wiki/HSL_and_HSV and http://en.wikipedia.org/wiki/RGB_color_model for a detailed explanation of the color spaces.

Parameters
hsvColor in the [0 1]^3 range
Returns
RGB color in [0 1]^3 range

◆ lab2rgb()

vec3 inviwo::color::lab2rgb ( vec3  lab)

Convert from Lab color to sRGB using D65 white point.

See http://en.wikipedia.org/wiki/Lab_color_space http://www.brucelindbloom.com/ and http://en.wikipedia.org/wiki/RGB_color_model

Parameters
labcolor in Lab color space
Returns
rgb color in the [0 1]^3 range

◆ lab2XYZ()

vec3 inviwo::color::lab2XYZ ( vec3  lab,
const vec3  whitePoint = getD65WhitePoint() 
)

Convert from Lab to CIE XYZ color space See http://en.wikipedia.org/wiki/Lab_color_space and http://www.brucelindbloom.com/.

Parameters
labColor
whitePointNormalized white point. Default white point is D65.
Returns
CIE XYZ color (roughly in the [0 1]^3 range)

◆ Luv2XYZ()

vec3 inviwo::color::Luv2XYZ ( const vec3 &  Luv,
vec3  whitePointXYZ = getD65WhitePoint() 
)

Convert from CIE Luv to CIE XYZ.

The CIE Luv color value is converted to CIE XYZ color space using the reference white point.

See http://en.wikipedia.org/wiki/CIELUV, http://en.wikipedia.org/wiki/CIE_1931_color_space, and http://www.brucelindbloom.com/

Parameters
LuvCIE Luv color, L in [0, 100], u and v in [-100, +100] but values might exceed this range
whitePointXYZNormalized white point. Default white point is D65.
Returns
CIE XYZ color (roughly in the [0 1]^3 range)

◆ LuvChromaticity2rgb()

vec3 inviwo::color::LuvChromaticity2rgb ( const vec3 &  LuvChroma,
bool  clamp = false,
vec3  whitePointXYZ = getD65WhitePoint() 
)

Convert from normalized chromaticity of CIE Luv, i.e. u' and v', to sRGB.

The chromaticity of CIE Luv (luminance, u', v') is converted to sRGB via the CIE XYZ color space.

See http://en.wikipedia.org/wiki/CIELUV, http://www.brucelindbloom.com/

Parameters
LuvChromachromaticity, L in [0, 100], u' in [0.0, 1.0], v' in [0.0, 1.0]
clampclamp resulting rgb values to [0,1]^3
whitePointXYZNormalized white point. Default white point is D65.
Returns
rgb color, [0, 1]^3 if clamping is enabled

◆ LuvChromaticity2XYZ()

vec3 inviwo::color::LuvChromaticity2XYZ ( const vec3 &  LuvChroma,
vec3  whitePointXYZ = getD65WhitePoint() 
)

Convert from normalized chromaticity of CIE Luv, i.e. u' and v', to XYZ.

See http://en.wikipedia.org/wiki/CIELUV, http://www.brucelindbloom.com/

Parameters
LuvChromachromaticity, L in [0, 100], u' in [0.0, 1.0], v' in [0.0, 1.0]
whitePointXYZNormalized white point. Default white point is D65.
Returns
CIE XYZ color (roughly in the [0 1]^3 range)

◆ rgb2hex()

std::string inviwo::color::rgb2hex ( const vec3 &  rgb)

convert from rgb to 6-digit hexadecimal html color code

RGB is converted to a 6 digit hexadecimal html color code with leading '#'

Parameters
rgbRGB color in [0 1]^3 range
Returns
html color code in the form of "#RRGGBB"

◆ rgb2hsv()

vec3 inviwo::color::rgb2hsv ( vec3  rgb)

Convert from RGB to HSV color.

See http://en.wikipedia.org/wiki/HSL_and_HSV and http://en.wikipedia.org/wiki/RGB_color_model for a detailed explanation of the color spaces.

Parameters
rgbColor in the [0 1]^3 range
Returns
HSV color in the [0 1]^3 range

◆ rgb2lab()

vec3 inviwo::color::rgb2lab ( vec3  rgb)

Convert from sRGB color to Lab using D65 white point.

See http://en.wikipedia.org/wiki/Lab_color_space http://www.brucelindbloom.com/ and http://en.wikipedia.org/wiki/RGB_color_model

Parameters
rgbrgb color in the [0 1]^3 range
Returns
Lab color

◆ rgb2LuvChromaticity()

vec3 inviwo::color::rgb2LuvChromaticity ( const vec3 &  rgb,
vec3  whitePointXYZ = getD65WhitePoint() 
)

Convert from sRGB to normalized chromaticity of CIE Luv, i.e. u' and v'.

The sRGB color is converted to chromaticity of CIE Luv (luminance, u', v') via the CIE XYZ color space.

See http://en.wikipedia.org/wiki/CIELUV, http://www.brucelindbloom.com/

Parameters
rgbrgb color, [0, 1]^3
whitePointXYZNormalized white point. Default white point is D65.
Returns
LuvChroma chromaticity, L in [0, 100], u' in [0.0, 1.0], v' in [0.0, 1.0]

◆ rgb2XYZ()

vec3 inviwo::color::rgb2XYZ ( const vec3  rgb)

Convert from sRGB color to XYZ using D65 white point See http://en.wikipedia.org/wiki/CIE_1931_color_space, http://www.brucelindbloom.com/ and http://en.wikipedia.org/wiki/RGB_color_model.

Parameters
rgbrgb color in the [0 1]^3 range
Returns
CIE XYZ color (roughly in the [0 1]^3 range)

◆ rgb2ycbcr()

vec3 inviwo::color::rgb2ycbcr ( const vec3 &  rgb)

Convert from sRGB color to YCbCr.

The sRGB color is converted to to YCbCr (luminance, blue-yellow chroma, red-green chroma). The YCbCr color uses the full range and does not have a footroom/headroom (0-16 and 236-255).

See http://en.wikipedia.org/wiki/YCbCr

Parameters
rgbrgb color, [0, 1]^3
Returns
YCbCr color, Y in [0, 1], Cb in [-0.5, 0.5], Cr in [-0.5, 0.5]

◆ rgba2hex()

std::string inviwo::color::rgba2hex ( const vec4 &  rgba)

convert from rgba to 8-digit hexadecimal html color code

RGBA is converted to a 8 digit hexadecimal html color code with leading '#'

Parameters
rgbaRGBA color in [0 1]^3 range
Returns
html color code in the form of "#RRGGBBAA"

◆ xyY2XYZ()

vec3 inviwo::color::xyY2XYZ ( vec3  xyY)

Convert from xyY color space to XYZ.

See http://en.wikipedia.org/wiki/CIE_1931_color_space and http://www.brucelindbloom.com/

Parameters
xyYxyY color
Returns
CIE XYZ color (roughly in the [0 1]^3 range)

◆ XYZ2lab()

vec3 inviwo::color::XYZ2lab ( vec3  xyz,
vec3  whitePoint = getD65WhitePoint() 
)

Convert from XYZ to Lab color space See http://en.wikipedia.org/wiki/CIE_1931_color_space and http://www.brucelindbloom.com/.

Parameters
xyzcolor in the CIE XYZ color space (roughly in the [0 1]^3 range)
whitePointNormalized white point. Default white point is D65.
Returns
Lab color

◆ XYZ2Luv()

vec3 inviwo::color::XYZ2Luv ( const vec3 &  XYZ,
vec3  whitePointXYZ = getD65WhitePoint() 
)

Convert from CIE XYZ to CIE Luv.

The CIE Luv color value is converted to CIE XYZ color space using the reference white point.

See http://en.wikipedia.org/wiki/CIELUV, http://en.wikipedia.org/wiki/CIE_1931_color_space, and http://www.brucelindbloom.com/

Parameters
XYZCIE XYZ color (roughly in the [0 1]^3 range)
whitePointXYZNormalized white point. Default white point is D65.
Returns
CIE Luv color value, L in [0, 100], u and v in [-100, +100] (for typical images)

◆ XYZ2LuvChromaticity()

vec3 inviwo::color::XYZ2LuvChromaticity ( const vec3 &  XYZ,
vec3  whitePointXYZ = getD65WhitePoint() 
)

Convert from CIE XYZ color space to normalized chromaticity of CIE Luv, i.e. u' and v'.

See http://en.wikipedia.org/wiki/CIELUV, http://www.brucelindbloom.com/

Parameters
XYZCIE XYZ color (roughly in the [0 1]^3 range)
whitePointXYZNormalized white point. Default white point is D65.
Returns
CIE XYZ color (roughly in the [0 1]^3 range)

◆ XYZ2rgb()

vec3 inviwo::color::XYZ2rgb ( vec3  xyz)

Convert from CIE XYZ color to sRGB using D65 white point.

See http://en.wikipedia.org/wiki/CIE_1931_color_space, http://www.brucelindbloom.com/ and http://en.wikipedia.org/wiki/RGB_color_model

Parameters
xyzCIE XYZ color (roughly in the [0 1]^3 range)
Returns
sRGB color in the [0 1]^3 range

◆ XYZ2xyY()

vec3 inviwo::color::XYZ2xyY ( vec3  xyz)

Convert from CIE XYZ color space to normalized xyY, which is for example used in the chromaticity diagram.

See http://en.wikipedia.org/wiki/CIE_1931_color_space and http://www.brucelindbloom.com/

Parameters
xyzCIE XYZ color (roughly in the [0 1]^3 range)
Returns
xyY color, (x, y chromaticity, and Y lightness) in the [0 1]^3 range

◆ ycbcr2rgb()

vec3 inviwo::color::ycbcr2rgb ( const vec3 &  ycbcr)

Convert from YCbCr color to sRGB.

The YCbCr color (luminance, blue-yellow chroma, red-green chroma) is converted to sRGB without considering footroom and headroom.

See http://en.wikipedia.org/wiki/YCbCr

Parameters
ycbcrYCbCr color, Y in [0, 1], Cb in [-0.5, 0.5], Cr in [-0.5, 0.5]
Returns
rgb color, [0, 1]^3