transforms
Color transformation functions for VSUP.
This module provides functions for converting between different color spaces and applying uncertainty-based transformations to colors using CIELAB color space. The transformations modify the color properties (saturation/chroma and lightness) based on the uncertainty value, making it easier to understand the reliability of the data while maintaining the ability to distinguish values.
The module provides three transformation modes:
- USL: Uncertainty affects both saturation and lightness
- US: Uncertainty affects saturation only
- UL: Uncertainty affects lightness only
ul_transform(colors, uncertainty, lmax=1.0)
Transform colors by mapping uncertainty to lightness only.
This function modifies the input colors based on uncertainty by: 1. Keeping saturation (chroma) constant 2. Increasing lightness as uncertainty increases
The transformation is performed in CIELAB color space, which provides better perceptual uniformity than RGB or HSV.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
colors
|
array - like
|
Input RGB colors in range [0, 1] |
required |
uncertainty
|
array - like
|
Uncertainty values in range [0, 1] |
required |
lmax
|
float
|
Maximum lightness (0 to 1). The maximum lightness will be 100 * lmax. Controls how white the colors become at high uncertainty. Default is 1.0. |
1.0
|
Returns:
Type | Description |
---|---|
ndarray
|
Transformed RGB colors in range [0, 1] |
Source code in vsup/transforms.py
us_transform(colors, uncertainty, smin=0.0)
Transform colors by mapping uncertainty to saturation only.
This function modifies the input colors based on uncertainty by: 1. Reducing saturation (chroma) as uncertainty increases 2. Keeping lightness constant
The transformation is performed in CIELAB color space, which provides better perceptual uniformity than RGB or HSV.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
colors
|
array - like
|
Input RGB colors in range [0, 1] |
required |
uncertainty
|
array - like
|
Uncertainty values in range [0, 1] |
required |
smin
|
float
|
Minimum saturation/chroma (0 to 1). Higher values ensure colors remain visible even at high uncertainty. Default is 0.0. |
0.0
|
Returns:
Type | Description |
---|---|
ndarray
|
Transformed RGB colors in range [0, 1] |
Source code in vsup/transforms.py
usl_transform(colors, uncertainty, smin=0.0, lmax=1.0)
Transform colors by mapping uncertainty to both saturation and lightness.
This function modifies the input colors based on uncertainty by: 1. Reducing saturation (chroma) as uncertainty increases 2. Increasing lightness as uncertainty increases
The transformation is performed in CIELAB color space, which provides better perceptual uniformity than RGB or HSV.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
colors
|
array - like
|
Input RGB colors in range [0, 1] |
required |
uncertainty
|
array - like
|
Uncertainty values in range [0, 1] |
required |
smin
|
float
|
Minimum saturation/chroma (0 to 1). Higher values ensure colors remain visible even at high uncertainty. Default is 0.0. |
0.0
|
lmax
|
float
|
Maximum lightness (0 to 1). The maximum lightness will be 100 * lmax. Controls how white the colors become at high uncertainty. Default is 1.0. |
1.0
|
Returns:
Type | Description |
---|---|
ndarray
|
Transformed RGB colors in range [0, 1] |
Source code in vsup/transforms.py
handler: python options: show_root_heading: false show_source: false