1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
import numpy as np
from colour import *
from colour.difference import delta_E_CIE1976
from colour.models import RGB_COLOURSPACES
from colour.recovery import RGB_to_sd_Jakob2019, Jakob2019Interpolator
from gsoc_common import *
colourspace = RGB_COLOURSPACES["sRGB"]
if __name__ == "__main__":
RGB = np.array([0.1668, 0.000, 0.0334])
matched_sd, error = RGB_to_sd_Jakob2019(
RGB,
colourspace,
#coefficients_0=(57.94046366, -39.65092867, 2.48839434),
return_error=True,
use_feedback=True,
)
print("Error is %g" % error)
XYZ = RGB_to_XYZ(
RGB,
colourspace.whitepoint,
D65_xy,
colourspace.RGB_to_XYZ_matrix,
)
print("Target was %s %s" % (colourspace.name, RGB))
print("...XYZ = %s" % XYZ)
print("...Lab = %s" % XYZ_to_Lab(XYZ, D65_xy))
plot_comparison(XYZ, matched_sd, "target", error, D65)
|