コード例 #1
0
    def test_domain_range_scale_RGB_to_HSL(self):
        """
        Tests :func:`colour.models.rgb.deprecated.RGB_to_HSL` definition domain
        and range scale support.
        """

        RGB = np.array([0.45620519, 0.03081071, 0.04091952])
        HSL = RGB_to_HSL(RGB)

        d_r = (('reference', 1), (1, 1), (100, 100))
        for scale, factor in d_r:
            with domain_range_scale(scale):
                np.testing.assert_almost_equal(
                    RGB_to_HSL(RGB * factor), HSL * factor, decimal=7)
コード例 #2
0
    def test_n_dimensional_RGB_to_HSL(self):
        """
        Tests :func:`colour.models.rgb.deprecated.RGB_to_HSL` definition
        n-dimensional arrays support.
        """

        RGB = np.array([0.45620519, 0.03081071, 0.04091952])
        HSL = RGB_to_HSL(RGB)

        RGB = np.tile(RGB, (6, 1))
        HSL = np.tile(HSL, (6, 1))
        np.testing.assert_almost_equal(RGB_to_HSL(RGB), HSL, decimal=7)

        RGB = np.reshape(RGB, (2, 3, 3))
        HSL = np.reshape(HSL, (2, 3, 3))
        np.testing.assert_almost_equal(RGB_to_HSL(RGB), HSL, decimal=7)
コード例 #3
0
ファイル: test_deprecated.py プロジェクト: ajun73/Work_Code
    def test_n_dimensional_RGB_to_HSL(self):
        """
        Tests :func:`colour.models.rgb.deprecated.RGB_to_HSL` definition
        n-dimensional arrays support.
        """

        RGB = np.array([0.25000000, 0.60000000, 0.05000000])
        HSL = np.array([0.27272727, 0.84615385, 0.325])
        np.testing.assert_almost_equal(RGB_to_HSL(RGB), HSL, decimal=7)

        RGB = np.tile(RGB, (6, 1))
        HSL = np.tile(HSL, (6, 1))
        np.testing.assert_almost_equal(RGB_to_HSL(RGB), HSL, decimal=7)

        RGB = np.reshape(RGB, (2, 3, 3))
        HSL = np.reshape(HSL, (2, 3, 3))
        np.testing.assert_almost_equal(RGB_to_HSL(RGB), HSL, decimal=7)
コード例 #4
0
ファイル: test_deprecated.py プロジェクト: ajun73/Work_Code
    def test_RGB_to_HSL(self):
        """
        Tests :func:`colour.models.rgb.deprecated.RGB_to_HSL` definition.
        """

        np.testing.assert_almost_equal(
            RGB_to_HSL(np.array([0.25000000, 0.60000000, 0.05000000])),
            np.array([0.27272727, 0.84615385, 0.325]),
            decimal=7)

        np.testing.assert_almost_equal(
            RGB_to_HSL(np.array([0.00000000, 0.00000000, 0.00000000])),
            np.array([0.00000000, 0.00000000, 0.00000000]),
            decimal=7)

        np.testing.assert_almost_equal(
            RGB_to_HSL(np.array([1.00000000, 1.00000000, 1.00000000])),
            np.array([0.00000000, 0.00000000, 1.00000000]),
            decimal=7)
コード例 #5
0
    def test_RGB_to_HSL(self):
        """
        Tests :func:`colour.models.rgb.deprecated.RGB_to_HSL` definition.
        """

        np.testing.assert_almost_equal(
            RGB_to_HSL(np.array([0.45620519, 0.03081071, 0.04091952])),
            np.array([0.99603944, 0.87347144, 0.24350795]),
            decimal=7)

        np.testing.assert_almost_equal(
            RGB_to_HSL(np.array([0.00000000, 0.00000000, 0.00000000])),
            np.array([0.00000000, 0.00000000, 0.00000000]),
            decimal=7)

        np.testing.assert_almost_equal(
            RGB_to_HSL(np.array([1.00000000, 1.00000000, 1.00000000])),
            np.array([0.00000000, 0.00000000, 1.00000000]),
            decimal=7)
コード例 #6
0
ファイル: test_deprecated.py プロジェクト: ajun73/Work_Code
    def test_nan_RGB_to_HSL(self):
        """
        Tests :func:`colour.models.rgb.deprecated.RGB_to_HSL` definition nan
        support.
        """

        cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]
        cases = set(permutations(cases * 3, r=3))
        for case in cases:
            RGB = np.array(case)
            RGB_to_HSL(RGB)