Replies: 2 comments 2 replies
-
Hi @ademmler, We do not have such functions but we have spectral to XYZ ( Cheers, Thomas |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi Thomas, thx for the hint. I am new to Python and Colour but I have created a first trial - see below. #----------------- first trial ------------------------------------#
import numpy as np
import colour
from colour import MSDS_CMFS, SDS_ILLUMINANTS, SpectralShape,SpectralDistribution
from colour.colorimetry import sd_to_XYZ_integration
from colour.utilities import numpy_print_options
from colour.plotting import *
PLOT = True
#Set a view thigs first
np.set_printoptions(suppress=True, precision=4)
# Define the LAB values
Lab_values = np.array([90, 10, 50])
print("Input LAB values:", Lab_values)
# Convert LAB to Spectral
XYZ_values = colour.Lab_to_XYZ(Lab_values)
cmfs = (
MSDS_CMFS["CIE 1931 2 Degree Standard Observer"]
.copy()
.align(SpectralShape(400, 700, 10))
)
illuminant = SDS_ILLUMINANTS["D50"].copy().align(cmfs.shape)
sd = colour.XYZ_to_sd(
XYZ_values, method="Jakob 2019", cmfs=cmfs, illuminant=illuminant
)
# Convert Spectral to LAB
XYZ_values2 = colour.sd_to_XYZ(sd, cmfs, illuminant, use_practice_range=False)
#print("Output XYZ values:", XYZ_values2/100)
Lab_values2 = colour.XYZ_to_Lab(XYZ_values2/100)
print("Output LAB values:", Lab_values2)
if PLOT:
print("Spectral values:", sd)
plot_single_sd(sd) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
I am reading the documentation and I am woundering if there is functions for:
LAB2Spectral and Spectral2LAB computation?
Beta Was this translation helpful? Give feedback.
All reactions