ColorSpaceConverter class
Base class for conversion between two color spaces.
Contents
- Reference
Classes that convert between color spaces must derive from this and overload all the pure virtual functions.
See dip::ColorSpaceManager
for how to use these converters.
Functions
- auto InputColorSpace() const -> dip::String pure virtual
- Returns the source color space name.
- auto OutputColorSpace() const -> dip::String pure virtual
- Returns the destination color space name.
- auto Cost() const -> dip::uint virtual
- Returns the cost of the conversion. This cost includes computational cost as well as precision loss.
- void Convert(dip::ConstLineIterator& input, dip::LineIterator& output) const pure virtual
- This is the method that performs the conversion for one image line.
- void SetWhitePoint(dip::XYZ const& whitePoint, dip::XYZMatrix const& matrix, dip::XYZMatrix const& inverseMatrix) virtual
- This method is called to set the white point used by the converter. Does nothing by default.
Function documentation
dip::uint Cost() const virtual
Returns the cost of the conversion. This cost includes computational cost as well as precision loss.
Called by dip::ColorSpaceManager::Convert
.
The cost is used to avoid pathways such as “RGB” → “grey” → “Lab” instead of “RGB” → “XYZ” → “Yxy” → “Lab”. Conversion to grey therefore must always have a high cost. It is not necessary to define this method, the default implementation returns a cost of 1.
void Convert(dip::ConstLineIterator& input, dip::LineIterator& output) const pure virtual
This is the method that performs the conversion for one image line.
Called by dip::ColorSpaceManager::Convert
.
input
and output
point to buffers with the number of tensor elements expected for the two color
spaces, as determined by the InputColorSpace
and OutputColorSpace
method.
void SetWhitePoint(dip::XYZ const& whitePoint, dip::XYZMatrix const& matrix, dip::XYZMatrix const& inverseMatrix) virtual
This method is called to set the white point used by the converter. Does nothing by default.
Called by dip::ColorSpaceManager::SetWhitePoint
.
matrix
and inverseMatrix
are computed from whitePoint
by the caller, to avoid multiple converter
functions doing the same computations.