diff options
Diffstat (limited to 'test_interpolator.py')
-rw-r--r-- | test_interpolator.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test_interpolator.py b/test_interpolator.py new file mode 100644 index 0000000..21a50c5 --- /dev/null +++ b/test_interpolator.py @@ -0,0 +1,27 @@ +import numpy as np, struct +from colour import * +from colour.difference import delta_E_CIE1976 +from colour.models import eotf_inverse_sRGB +from colour.recovery import Jakob2019Interpolator +from gsoc_common import D65, D65_xy, jakob_hanika, model_sd, plot_comparison + +# This script tests if the interpolator correctly handles multi-dimensional +# inputs. +if __name__ == "__main__": + interp = Jakob2019Interpolator() + interp.read_file("data/srgb.coeff") + + RGBs = np.random.random((7, 6, 5, 4, 3)) + ccs = interp.coeffs(RGBs) + + RGB = eotf_inverse_sRGB(RGBs[0, 0, 0, 0, :]) + XYZ = sRGB_to_XYZ(RGB) + Lab = XYZ_to_Lab(XYZ, D65_xy) + cc = ccs[0, 0, 0, 0, :] + + matched_sd = model_sd(cc, primed=False) + matched_XYZ = sd_to_XYZ(matched_sd, illuminant=D65) + matched_Lab = XYZ_to_Lab(matched_XYZ, D65_xy) + error = delta_E_CIE1976(Lab, matched_Lab) + + plot_comparison(XYZ, matched_sd, "Model", error, D65) |