Color spaces module

Management and conversion between color spaces

Contents

Classes

class dip::ColorSpaceConverter abstract
Abstract base class for conversion between two color spaces. more...
class dip::ColorSpaceManager
An object of this class is used to convert images between color spaces. more...

Aliases

using dip::xy = std::array<dfloat, 2>
A color, as (x,y) chromaticity coordinates, used to specify a white point for color spaces.
using dip::XYZ = std::array<dfloat, 3>
An XYZ triplet, used to specify a white point for color spaces.
using dip::XYZMatrix = std::array<dfloat, 9>
XYZ matrix (3x3 matrix, column-major order) for conversion between RGB and XYZ. Computed from a dip::XYZ triplet.

Functions

void dip::ApplyAlphaChannel(dip::Image const& in, dip::Image& out, dip::Image::Pixel const& background = {0}, dip::dfloat scaling = 255)
Apply the alpha channel in the sRGBA image in, using the background color background. more...

Alias documentation

using dip::XYZ = std::array<dfloat, 3>

An XYZ triplet, used to specify a white point for color spaces.

using dip::xy = std::array<dfloat, 2>

A color, as (x,y) chromaticity coordinates, used to specify a white point for color spaces.

using dip::XYZMatrix = std::array<dfloat, 9>

XYZ matrix (3x3 matrix, column-major order) for conversion between RGB and XYZ. Computed from a dip::XYZ triplet.

Function documentation

void dip::ApplyAlphaChannel( dip::Image const& in, dip::Image& out, dip::Image::Pixel const& background = {0}, dip::dfloat scaling = 255)

Apply the alpha channel in the sRGBA image in, using the background color background.

The alpha channel is expected to be in the range [0, scaling]. The output image is of the same data type as in, but will have 3 channels and be in he sRGB color space.

If in has two channels, it is assumed to be a gray-scale image with an alpha channel, and the output will be scalar. Otherwise, if in is not sRGBA, it is returned as-is.

The alpha channel is assumed to not be pre-multiplied.