Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::color Namespace Reference

Functions

IVW_CORE_API vec4 hex2rgba (std::string str)
 convert from hexadecimal html color code to RGBA
 
IVW_CORE_API std::string rgba2hex (const vec4 &rgba)
 convert from rgba to 8-digit hexadecimal html color code
 
IVW_CORE_API std::string rgb2hex (const vec3 &rgb)
 convert from rgb to 6-digit hexadecimal html color code
 
IVW_CORE_API vec3 getD65WhitePoint ()
 reference white point D65 in CIE XYZ color space
 
IVW_CORE_API vec3 hsv2rgb (vec3 hsv)
 Convert from HSV to RGB color.
 
IVW_CORE_API vec3 rgb2hsv (vec3 rgb)
 Convert from RGB to HSV color.
 
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/.
 
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/.
 
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.
 
IVW_CORE_API vec3 XYZ2rgb (vec3 xyz)
 Convert from CIE XYZ color to sRGB using D65 white point.
 
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.
 
IVW_CORE_API vec3 xyY2XYZ (vec3 xyY)
 Convert from xyY color space to XYZ.
 
IVW_CORE_API vec3 rgb2lab (vec3 rgb)
 Convert from sRGB color to Lab using D65 white point.
 
IVW_CORE_API vec3 lab2rgb (vec3 lab)
 Convert from Lab color to sRGB using D65 white point.
 
IVW_CORE_API vec3 rgb2ycbcr (const vec3 &rgb)
 Convert from sRGB color to YCbCr.
 
IVW_CORE_API vec3 ycbcr2rgb (const vec3 &ycbcr)
 Convert from YCbCr color to sRGB.
 
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.
 
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'.
 
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.
 
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'.
 
IVW_CORE_API vec3 XYZ2Luv (const vec3 &XYZ, vec3 whitePointXYZ=getD65WhitePoint())
 Convert from CIE XYZ to CIE Luv.
 
IVW_CORE_API vec3 Luv2XYZ (const vec3 &Luv, vec3 whitePointXYZ=getD65WhitePoint())
 Convert from CIE Luv to CIE XYZ.
 
IVW_CORE_API vec3 lighter (const vec3 &rgb, float factor=1.5f)
 Return a lighter color by adjusting the brightness.
 
IVW_CORE_API vec4 lighter (const vec4 &rgba, float factor=1.5f)
 
IVW_CORE_API uvec3 lighter (const uvec3 &rgb, float factor=1.5f)
 
IVW_CORE_API vec3 darker (const vec3 &rgb, float factor=2.0f)
 Return a darker color by adjusting the brightness.
 
IVW_CORE_API vec4 darker (const vec4 &rgba, float factor=2.0f)
 
IVW_CORE_API uvec3 darker (const uvec3 &rgb, float factor=2.0f)
 

Detailed Description

color

Function Documentation

◆ darker() [1/3]

IVW_CORE_API uvec3 inviwo::color::darker ( const uvec3 & rgb,
float factor = 2.0f )

◆ darker() [2/3]

IVW_CORE_API vec3 inviwo::color::darker ( const vec3 & rgb,
float factor = 2.0f )

Return a darker color by adjusting the brightness.

The brightness is modified by dividing rgb input in HSV colorspace by factor. A factor

‍1.0 will return a darker color, e.g. a factor of 2 yields a color with half the brightness. Instead of using a factor < 1.0, consider using darker(). Factors <= 0 result in unspecified results.

Parameters
rgbrgb color, [0, 1]^3
factorscaling factor of the brightness
Returns
lighter/darker rgb color

See https://doc.qt.io/qt-5/qcolor.html#lighter

◆ darker() [3/3]

IVW_CORE_API vec4 inviwo::color::darker ( const vec4 & rgba,
float factor = 2.0f )

◆ getD65WhitePoint()

IVW_CORE_API 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()

IVW_CORE_API 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()

IVW_CORE_API 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()

IVW_CORE_API 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()

IVW_CORE_API 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)

◆ lighter() [1/3]

IVW_CORE_API uvec3 inviwo::color::lighter ( const uvec3 & rgb,
float factor = 1.5f )

◆ lighter() [2/3]

IVW_CORE_API vec3 inviwo::color::lighter ( const vec3 & rgb,
float factor = 1.5f )

Return a lighter color by adjusting the brightness.

The brightness is modified by multiplying rgb input in HSV colorspace with factor. A factor

‍1.0 will return a lighter color, e.g. a 50% increase is achieved by a factor of 1.5. Instead of using a factor < 1.0, consider using darker(). Factors <= 0 result in unspecified results.

Parameters
rgbrgb color, [0, 1]^3
factorscaling factor of the brightness
Returns
lighter/darker rgb color

See https://doc.qt.io/qt-5/qcolor.html#lighter

◆ lighter() [3/3]

IVW_CORE_API vec4 inviwo::color::lighter ( const vec4 & rgba,
float factor = 1.5f )

◆ Luv2XYZ()

IVW_CORE_API 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()

IVW_CORE_API 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()

IVW_CORE_API 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()

IVW_CORE_API 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()

IVW_CORE_API 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()

IVW_CORE_API 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()

IVW_CORE_API 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()

IVW_CORE_API 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()

IVW_CORE_API 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()

IVW_CORE_API 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()

IVW_CORE_API 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()

IVW_CORE_API 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()

IVW_CORE_API 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()

IVW_CORE_API 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()

IVW_CORE_API 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()

IVW_CORE_API 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()

IVW_CORE_API 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