-
Hi, Do you guys have any idea on how to visualize an "ab" plane of CIE Lab with corresponding "L"? Best, |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 22 replies
-
Hi @hminle, We do not have anything readily available for that and while it is not easy to do that for arbitrary gamuts as it requires mesh geometry intersection, it is trivial to do for RGB colourspaces: from colour.colorimetry import CCS_ILLUMINANTS, SDS_ILLUMINANTS
from colour.geometry import primitive_cube
from colour.models import Lab_to_XYZ, XYZ_to_Lab, XYZ_to_sRGB, sRGB_to_XYZ
from colour.plotting import XYZ_to_plotting_colourspace, artist
from colour.utilities import as_int, full, orient, tstack
from colour.volume import is_within_visible_spectrum, solid_RoschMacAdam
illuminant = 'D65'
sd_n = SDS_ILLUMINANTS[illuminant]
xy_n = CCS_ILLUMINANTS['CIE 1931 2 Degree Standard Observer'][
illuminant]
vertices, faces, outline = primitive_cube(1, 1, 1, 32, 32, 32)
XYZ_vertices = sRGB_to_XYZ(
vertices['position'] + 0.5,
apply_cctf_decoding=False)
Lab_vertices = XYZ_to_Lab(XYZ_vertices, xy_n)
extent = np.max(
np.abs([np.min(Lab_vertices[..., 1:]),
np.max(Lab_vertices[..., 1:])]))
extent = np.around(extent * 1.1 / 100, 1) * 100
samples = 2048
L = 50
ii, jj = np.meshgrid(
np.linspace(-extent, extent, samples), np.linspace(extent, -extent,
samples))
ij = tstack([ii, jj])
Lab_slice = full([samples, samples, 3], L)
Lab_slice[..., 1:] = ij
normal = [1, 0, 0]
XYZ_slice = Lab_to_XYZ(Lab_slice, xy_n)
RGB_slice = XYZ_to_plotting_colourspace(XYZ_slice, xy_n)
XYZ_mask = XYZ_to_sRGB(XYZ_slice, apply_cctf_encoding=False)
RGB_slice[np.any(XYZ_mask < 0, axis=-1)] = 1
RGB_slice[np.any(XYZ_mask > 1, axis=-1)] = 1
figure, axes = artist()
image = axes.imshow(
RGB_slice,
interpolation='bilinear',
extent=(-extent, extent, -extent, extent),
clip_path=None); |
Beta Was this translation helpful? Give feedback.
-
Hi @hminle Well if the vertical is ±a* then sRGB is exceeding ProPhoto in green, that's crazy. Unfortunately I don't know Ken's code well enough to suggest a fix. But I'd suggest looking someplace where ProPhoto is being clipped. |
Beta Was this translation helpful? Give feedback.
-
Hi @KelSolaar , Is there anyway I can visualize 2 colour spaces (sRGB and ProPhoto RGB) in one Lab slice? |
Beta Was this translation helpful? Give feedback.
Hi @hminle,
We do not have anything readily available for that and while it is not easy to do that for arbitrary gamuts as it requires mesh geometry intersection, it is trivial to do for RGB colourspaces: