pypindou.color.space
Color-space helpers used by quantizers.
The quantizers operate on RGB arrays but can compute distances either directly in RGB or in CIE Lab. Lab is the default for image-to-pattern generation because it is usually closer to perceived color difference.
Example:
>>> import numpy as np
>>> convert_colors(np.array([[255, 255, 255]], dtype=np.uint8), color_space="rgb").tolist()
[[255.0, 255.0, 255.0]]
ColorSpace
- pypindou.color.space.ColorSpace
Literal['rgb', 'lab'] 的别名
as_color_array
convert_colors
- pypindou.color.space.convert_colors(rgb, color_space='lab')[源代码]
Convert RGB values in
0..255to the requested distance space.- 参数:
rgb (numpy.ndarray) -- RGB values with shape
(n, 3).color_space (ColorSpace, optional) -- Target distance space, defaults to
"lab".
- 返回:
Converted color array.
- 返回类型:
numpy.ndarray
- 抛出:
ValueError -- If
color_spaceis unsupported.