def test_n_dimensional_YcCbcCrc_to_RGB(self): """ Tests :func:`colour.models.rgb.ycbcr.YcCbcCrc_to_RGB` definition n-dimensional arrays support. """ YcCbcCrc = np.array([0.37020379, 0.41137200, 0.77704674]) RGB = YcCbcCrc_to_RGB(YcCbcCrc) RGB = np.tile(RGB, 4) RGB = np.reshape(RGB, (4, 3)) YcCbcCrc = np.tile(YcCbcCrc, 4) YcCbcCrc = np.reshape(YcCbcCrc, (4, 3)) np.testing.assert_almost_equal(YcCbcCrc_to_RGB(YcCbcCrc), RGB, decimal=7) RGB = np.tile(RGB, 4) RGB = np.reshape(RGB, (4, 4, 3)) YcCbcCrc = np.tile(YcCbcCrc, 4) YcCbcCrc = np.reshape(YcCbcCrc, (4, 4, 3)) np.testing.assert_almost_equal(YcCbcCrc_to_RGB(YcCbcCrc), RGB, decimal=7) RGB = np.tile(RGB, 4) RGB = np.reshape(RGB, (4, 4, 4, 3)) YcCbcCrc = np.tile(YcCbcCrc, 4) YcCbcCrc = np.reshape(YcCbcCrc, (4, 4, 4, 3)) np.testing.assert_almost_equal(YcCbcCrc_to_RGB(YcCbcCrc), RGB, decimal=7)
def test_n_dimensional_YcCbcCrc_to_RGB(self): """ Tests :func:`colour.models.rgb.ycbcr.YcCbcCrc_to_RGB` definition n-dimensional arrays support. """ YcCbcCrc = np.array([0.69943807, 0.38814348, 0.61264549]) RGB = np.array([0.75767423, 0.50177402, 0.25466201]) np.testing.assert_almost_equal(YcCbcCrc_to_RGB(YcCbcCrc), RGB, decimal=7) RGB = np.tile(RGB, 4) RGB = np.reshape(RGB, (4, 3)) YcCbcCrc = np.tile(YcCbcCrc, 4) YcCbcCrc = np.reshape(YcCbcCrc, (4, 3)) np.testing.assert_almost_equal(YcCbcCrc_to_RGB(YcCbcCrc), RGB, decimal=7) RGB = np.tile(RGB, 4) RGB = np.reshape(RGB, (4, 4, 3)) YcCbcCrc = np.tile(YcCbcCrc, 4) YcCbcCrc = np.reshape(YcCbcCrc, (4, 4, 3)) np.testing.assert_almost_equal(YcCbcCrc_to_RGB(YcCbcCrc), RGB, decimal=7) RGB = np.tile(RGB, 4) RGB = np.reshape(RGB, (4, 4, 4, 3)) YcCbcCrc = np.tile(YcCbcCrc, 4) YcCbcCrc = np.reshape(YcCbcCrc, (4, 4, 4, 3)) np.testing.assert_almost_equal(YcCbcCrc_to_RGB(YcCbcCrc), RGB, decimal=7)
def test_domain_range_scale_YcCbcCrc_to_RGB(self): """ Test :func:`colour.models.rgb.prismatic.YcCbcCrc_to_RGB` definition domain and range scale support. """ YcCbcCrc = np.array([0.69943807, 0.38814348, 0.61264549]) RGB = YcCbcCrc_to_RGB(YcCbcCrc) d_r = (("reference", 1), ("1", 1), ("100", 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( YcCbcCrc_to_RGB(YcCbcCrc * factor), RGB * factor, decimal=7 )
def test_YcCbcCrc_to_RGB(self): """ Tests :func:`colour.models.rgb.ycbcr.YCbCr_to_RGB` definition. """ np.testing.assert_almost_equal( YcCbcCrc_to_RGB(np.array([0.37020379, 0.41137200, 0.77704674])), np.array([0.45620519, 0.03081071, 0.04091952]), decimal=7) np.testing.assert_almost_equal( YcCbcCrc_to_RGB(np.array([1689, 2048, 2048]), in_bits=12, in_legal=True, in_int=True, is_12_bits_system=True), np.array([0.18009037, 0.18009037, 0.18009037]), decimal=7)
def test_YcCbcCrc_to_RGB(self): """ Tests :func:`colour.models.rgb.ycbcr.YCbCr_to_RGB` definition. """ np.testing.assert_almost_equal( YcCbcCrc_to_RGB(np.array([1689, 2048, 2048]), in_bits=12, in_legal=True, in_int=True, is_12_bits_system=True), np.array([0.18009037, 0.18009037, 0.18009037]), decimal=7) np.testing.assert_almost_equal( YcCbcCrc_to_RGB(np.array([0.678, 0.4, 0.6])), np.array([0.69100667, 0.47450469, 0.25583733]), decimal=7)
def test_nan_YcCbcCrc_to_RGB(self): """ Tests :func:`colour.models.rgb.ycbcr.YcCbcCrc_to_RGB` 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: YcCbcCrc = np.array(case) YcCbcCrc_to_RGB(YcCbcCrc)