class documentation
class Convert:
Undocumented
| Static Method | apply |
More attractive syntax for transform |
| Static Method | build |
Build transform matrices between two spaces, each must be equal in N dimension. Can be photometric or colourimetric. e.g.: |
| Static Method | s |
Converts an image or array of sRGB values to linear XYZ (no compression / adaptation or gamma) |
| Static Method | |
Converts an image or array of XYZ values to an arbitrary colour space that is linear |
| Static Method | |
Converts an image or array of XYZ values to linear sRGB (no compression / adaptation or gamma) |
| Static Method | |
Convert between XYZ and Yxy (2d representation of tristimulus values) |
| Static Method | |
Convert between XYZ and Yxy (2d representation of tristimulus values) |
@staticmethod
def apply(tri, matrix):
def apply(tri, matrix):
More attractive syntax for transform
| Parameters | |
| tri | Tristimulus values (np.array Nx3) |
| matrix | Matrix to transform (np.array 3x3) |
| Returns | |
| transformed values (np.array Nx3) | |
@staticmethod
def build_transform(tri_square_1, tri_square_2):
def build_transform(tri_square_1, tri_square_2):
Build transform matrices between two spaces, each must be equal in N dimension. Can be photometric or colourimetric. e.g.:
Identity matrix (Max RGB) Specific Values
A = [1, 0, 0; X = [Xr1, Xr2, Xr3;
0, 1, 0; Xg2, Xg2, Xg3;
0, 0, 1 ]; Xb1, Xb2, Xb3;]
Solves mA = X
return m m^-1
| Parameters | |
| tri | First space tristimulus array (np.array Nx3) |
| tri | Second space tristimulus array (np.array Nx3) |
| Returns | |
| transform and inverse transform matrix (np.array Nx3) | |
@staticmethod
def sRGB_to_XYZ(sRGB):
def sRGB_to_XYZ(sRGB):
Converts an image or array of sRGB values to linear XYZ (no compression / adaptation or gamma)
| Parameters | |
| s | list or image of sRGB values (np.array Nx3 or IxJx3) |
| Returns | |
| list or image of XYZ values (np.array Nx3 or IxJx3) | |
@staticmethod
def XYZ_to_Linear(XYZ, transform):
def XYZ_to_Linear(XYZ, transform):
Converts an image or array of XYZ values to an arbitrary colour space that is linear
| Parameters | |
| XYZ | list or image of XYZ values (np.array Nx3 or IxJx3) |
| transform | matrix to go from XYZ -> Space (np.matrix 3x3) |
| Returns | |
| list or image of Space values (np.array Nx3 or IxJx3) | |
@staticmethod
def XYZ_to_sRGB(XYZ):
def XYZ_to_sRGB(XYZ):
Converts an image or array of XYZ values to linear sRGB (no compression / adaptation or gamma)
| Parameters | |
| XYZ | list or image of XYZ values (np.array Nx3 or IxJx3) |
| Returns | |
| list or image of sRGB values (np.array Nx3 or IxJx3) | |