qualpal::colorDifferenceMatrix
C++ · cpp · 4.1.0
Overloads
colorDifferenceMatrix
Source: include/qualpal/color_difference.h
Matrix<double> Generate a color difference matrix for XYZ colors with runtime metric selection.
Computes the pairwise color differences between all colors in the input vector, using the specified color difference metric (selected at runtime via MetricType). Internally converts XYZ colors to the appropriate color space for the selected metric.
Parameters
colors
Vector of colors::XYZ colors to compare.
metric_type
Color difference metric to use (DIN99d, CIEDE2000, or CIE76).
max_memory
Maximum memory (in GB) allowed for the matrix (default: 1.0).
white_point
Reference white point for XYZ to Lab/DIN99d conversions (default: D65).
Returns
Matrix<double> Symmetric matrix of pairwise color differences [size: n x n].
Throws
std::invalid_argument
if the metric type is unsupported or input is invalid.
std::runtime_error
if the estimated matrix size exceeds max_memory.
See also
colorDifferenceMatrix
Source: include/qualpal/color_difference.h
Matrix<double> Generate a symmetric color difference matrix for a set of colors.
Computes the pairwise perceptual color differences between all colors in the input vector, using the specified color difference metric (e.g., DIN99d, CIEDE2000, CIE76). The result is a symmetric matrix where element (i, j) is the distance between colors[i] and colors[j].
Template parameters
ColorType
Any color class convertible to the required color space (e.g., colors::RGB, colors::HSL, colors::XYZ, colors::Lab, colors::DIN99d).
Metric
Color difference metric functor (defaults to metrics::DIN99d).
Parameters
colors
Vector of colors to compare.
metric
Color difference metric to use (optional; default is DIN99d).
max_memory
Maximum memory (in GB) allowed for the matrix (default: 1.0).
Returns
Matrix<double> Symmetric matrix of pairwise color differences [size: n x n].
Throws
std::invalid_argument
if fewer than one color is provided.
std::runtime_error
if the estimated matrix size exceeds max_memory.
