Ejemplo n.º 1
0
    def test_RGB_to_RGB_matrix(self):
        """
        Tests :func:`colour.models.rgb.rgb_colourspace.RGB_to_RGB_matrix`
        definition.
        """

        aces_2065_1_colourspace = RGB_COLOURSPACES['ACES2065-1']
        aces_cg_colourspace = RGB_COLOURSPACES['ACEScg']
        sRGB_colourspace = RGB_COLOURSPACES['sRGB']

        np.testing.assert_almost_equal(
            RGB_to_RGB_matrix(aces_2065_1_colourspace, sRGB_colourspace),
            np.array(
                [[2.52164943, -1.13688855, -0.38491759],
                 [-0.27521355, 1.36970515, -0.09439245],
                 [-0.01592501, -0.14780637, 1.16380582]]),
            decimal=7)  # yapf: disable

        np.testing.assert_almost_equal(
            RGB_to_RGB_matrix(sRGB_colourspace, aces_2065_1_colourspace),
            np.array(
                [[0.43958564, 0.38392940, 0.17653274],
                 [0.08953957, 0.81474984, 0.09568361],
                 [0.01738718, 0.10873911, 0.87382059]]),
            decimal=7)  # yapf: disable

        np.testing.assert_almost_equal(
            RGB_to_RGB_matrix(aces_2065_1_colourspace, aces_cg_colourspace,
                              'Bradford'),
            np.array(
                [[1.45143932, -0.23651075, -0.21492857],
                 [-0.07655377, 1.17622970, -0.09967593],
                 [0.00831615, -0.00603245, 0.99771630]]),
            decimal=7)  # yapf: disable
Ejemplo n.º 2
0
    def test_RGB_to_RGB_matrix(self):
        """
        Tests :func:`colour.models.rgb.rgb_colourspace.RGB_to_RGB_matrix`
        definition.
        """

        aces_2065_1_colourspace = RGB_COLOURSPACES['ACES2065-1']
        aces_cg_colourspace = RGB_COLOURSPACES['ACEScg']
        sRGB_colourspace = RGB_COLOURSPACES['sRGB']

        np.testing.assert_almost_equal(
            RGB_to_RGB_matrix(aces_2065_1_colourspace, sRGB_colourspace),
            np.array([
                [2.52164943, -1.13688855, -0.38491759],
                [-0.27521355, 1.36970515, -0.09439245],
                [-0.01592501, -0.14780637, 1.16380582],
            ]),
            decimal=7)

        np.testing.assert_almost_equal(
            RGB_to_RGB_matrix(sRGB_colourspace, aces_2065_1_colourspace),
            np.array([
                [0.43958564, 0.38392940, 0.17653274],
                [0.08953957, 0.81474984, 0.09568361],
                [0.01738718, 0.10873911, 0.87382059],
            ]),
            decimal=7)

        np.testing.assert_almost_equal(
            RGB_to_RGB_matrix(aces_2065_1_colourspace, aces_cg_colourspace,
                              'Bradford'),
            np.array([
                [1.45143932, -0.23651075, -0.21492857],
                [-0.07655377, 1.17622970, -0.09967593],
                [0.00831615, -0.00603245, 0.99771630],
            ]),
            decimal=7)

        np.testing.assert_almost_equal(
            RGB_to_RGB_matrix(aces_2065_1_colourspace, sRGB_colourspace,
                              'Bradford'),
            np.array([
                [2.52140089, -1.13399575, -0.38756186],
                [-0.27621406, 1.37259557, -0.09628236],
                [-0.01532020, -0.15299256, 1.16838720],
            ]),
            decimal=7)

        np.testing.assert_almost_equal(
            RGB_to_RGB_matrix(aces_2065_1_colourspace, sRGB_colourspace, None),
            np.array([
                [2.55809607, -1.11933692, -0.39181451],
                [-0.27771575, 1.36589396, -0.09353075],
                [-0.01711199, -0.14854588, 1.08104848],
            ]),
            decimal=7)