class documentation

class Convert:

View In Hierarchy

Undocumented

Static Method apply More attractive syntax for transform
Static Method build_transform Build transform matrices between two spaces, each must be equal in N dimension. Can be photometric or colourimetric. e.g.:
Static Method sRGB_to_XYZ Converts an image or array of sRGB values to linear XYZ (no compression / adaptation or gamma)
Static Method XYZ_to_Linear Converts an image or array of XYZ values to an arbitrary colour space that is linear
Static Method XYZ_to_sRGB Converts an image or array of XYZ values to linear sRGB (no compression / adaptation or gamma)
Static Method XYZ_to_Yxy Convert between XYZ and Yxy (2d representation of tristimulus values)
Static Method Yxy_to_XYZ Convert between XYZ and Yxy (2d representation of tristimulus values)
@staticmethod
def apply(tri, matrix):

More attractive syntax for transform

Parameters
triTristimulus values (np.array Nx3)
matrixMatrix to transform (np.array 3x3)
Returns
transformed values (np.array Nx3)
@staticmethod
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_square_1First space tristimulus array (np.array Nx3)
tri_square_2Second space tristimulus array (np.array Nx3)
Returns
transform and inverse transform matrix (np.array Nx3)
@staticmethod
def sRGB_to_XYZ(sRGB):

Converts an image or array of sRGB values to linear XYZ (no compression / adaptation or gamma)

Parameters
sRGBlist 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):

Converts an image or array of XYZ values to an arbitrary colour space that is linear

Parameters
XYZlist or image of XYZ values (np.array Nx3 or IxJx3)
transformmatrix 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):

Converts an image or array of XYZ values to linear sRGB (no compression / adaptation or gamma)

Parameters
XYZlist or image of XYZ values (np.array Nx3 or IxJx3)
Returns
list or image of sRGB values (np.array Nx3 or IxJx3)
@staticmethod
def XYZ_to_Yxy(XYZ):

Convert between XYZ and Yxy (2d representation of tristimulus values)

Parameters
XYZimage of XYZ values (np.array IxJx3)
Returns
image of Yxy values (np.array IxJx3)
@staticmethod
def Yxy_to_XYZ(Yxy):

Convert between XYZ and Yxy (2d representation of tristimulus values)

Parameters
Yxylist or image of Yxy values (np.array Nx3 or IxJx3)
Returns
list or image of Yxy values (np.array Nx3 or IxJx3)