qualpal 3.3.0
|
Qualitative color palette generation library. More...
Namespaces | |
namespace | colors |
Color representation classes for various color spaces. | |
namespace | metrics |
Color difference metrics for perceptual color comparison. | |
Classes | |
class | FixedMatrix |
Fixed-size matrix class with compile-time dimensions. More... | |
class | Matrix |
Dynamic matrix class with runtime-determined dimensions. More... | |
struct | PaletteAnalysis |
Holds analysis results for a color palette under a specific vision condition. More... | |
class | Qualpal |
Builder for qualitative color palette generation. More... | |
class | Threads |
Centralized management of thread settings for parallel computations. More... | |
Typedefs | |
using | PaletteAnalysisMap = std::map< std::string, PaletteAnalysis > |
Map from vision deficiency type to palette analysis results. | |
Enumerations | |
enum class | ColorspaceType { HSL , LCHab } |
Supported cylindrical color spaces for input colors. More... | |
Functions | |
PaletteAnalysisMap | analyzePalette (const std::vector< colors::RGB > &colors, const metrics::MetricType &metric=metrics::MetricType::CIEDE2000, const std::map< std::string, double > &cvd={ { "deutan", 1.0 }, { "protan", 1.0 }, { "tritan", 1.0 } }, const std::optional< colors::RGB > &bg=std::nullopt, double max_memory=1.0) |
Analyze a color palette for normal and simulated color vision deficiencies (CVD). | |
template<typename ColorType , typename Metric = metrics::DIN99d> | |
Matrix< double > | colorDifferenceMatrix (const std::vector< ColorType > &colors, const Metric &metric=Metric{}, const double max_memory=1) |
Generate a symmetric color difference matrix for a set of colors. | |
Matrix< double > | colorDifferenceMatrix (const std::vector< colors::XYZ > &colors, const metrics::MetricType &metric_type, const double max_memory=1) |
Generate a color difference matrix for XYZ colors with runtime metric selection. | |
Qualitative color palette generation library.
using qualpal::PaletteAnalysisMap = typedef std::map<std::string, PaletteAnalysis> |
Map from vision deficiency type to palette analysis results.
The key is a string representing the vision type:
The value is a PaletteAnalysis struct with results for that vision type.
|
strong |
PaletteAnalysisMap qualpal::analyzePalette | ( | const std::vector< colors::RGB > & | colors, |
const metrics::MetricType & | metric = metrics::MetricType::CIEDE2000 , |
||
const std::map< std::string, double > & | cvd = { { "deutan", 1.0 }, { "protan", 1.0 }, { "tritan", 1.0 } } , |
||
const std::optional< colors::RGB > & | bg = std::nullopt , |
||
double | max_memory = 1.0 |
||
) |
Analyze a color palette for normal and simulated color vision deficiencies (CVD).
Computes color difference matrices and minimum color distances for the input palette, for normal vision as well as common color vision deficiencies ("deutan", "protan", "tritan") at the specified severity. Results are returned as a map keyed by vision type.
For each vision type:
colors | Vector of RGB colors to analyze. Each channel should be in [0, 1]. |
metric | Color difference metric to use (e.g., CIEDE2000, DIN99d, CIE76). |
cvd | Map of CVD type ("deutan", "protan", "tritan") to severity [0, 1]. If a type is omitted or severity is 0, simulation is skipped for that type. |
bg | Optional background color to include in the analysis (RGB in [0, 1]). |
max_memory | Maximum memory (in GB) allowed for the difference matrix computation. |
std::invalid_argument | if input parameters are invalid. |
Matrix< double > qualpal::colorDifferenceMatrix | ( | const std::vector< colors::XYZ > & | colors, |
const metrics::MetricType & | metric_type, | ||
const double | max_memory = 1 |
||
) |
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.
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). |
std::invalid_argument | if the metric type is unsupported or input is invalid. |
std::runtime_error | if the estimated matrix size exceeds max_memory. |
Matrix< double > qualpal::colorDifferenceMatrix | ( | const std::vector< ColorType > & | colors, |
const Metric & | metric = Metric{} , |
||
const double | max_memory = 1 |
||
) |
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].
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). |
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). |
std::invalid_argument | if fewer than one color is provided. |
std::runtime_error | if the estimated matrix size exceeds max_memory. |
Definition at line 65 of file color_difference.h.