def test_nan_oetf_ARIBSTDB67(self): """ Tests :func:`colour.models.rgb.transfer_functions.arib_std_b67.\ oetf_ARIBSTDB67` definition nan support. """ oetf_ARIBSTDB67(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
def test_nan_oetf_ARIBSTDB67(self): """ Tests :func:`colour.models.rgb.transfer_functions.arib_std_b67.\ oetf_ARIBSTDB67` definition nan support. """ oetf_ARIBSTDB67(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
def test_domain_range_scale_oetf_ARIBSTDB67(self): """ Tests :func:`colour.models.rgb.transfer_functions.arib_std_b67.\ oetf_ARIBSTDB67` definition domain and range scale support. """ E = 0.18 E_p = oetf_ARIBSTDB67(E) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( oetf_ARIBSTDB67(E * factor), E_p * factor, decimal=7)
def test_domain_range_scale_oetf_ARIBSTDB67(self): """ Tests :func:`colour.models.rgb.transfer_functions.arib_std_b67.\ oetf_ARIBSTDB67` definition domain and range scale support. """ E = 0.18 E_p = oetf_ARIBSTDB67(E) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( oetf_ARIBSTDB67(E * factor), E_p * factor, decimal=7)
def test_oetf_ARIBSTDB67(self): """ Tests :func:`colour.models.rgb.transfer_functions.arib_std_b67.\ oetf_ARIBSTDB67` definition. """ self.assertAlmostEqual(oetf_ARIBSTDB67(0.0), 0.0, places=7) self.assertAlmostEqual( oetf_ARIBSTDB67(0.18), 0.212132034355964, places=7) self.assertAlmostEqual(oetf_ARIBSTDB67(1.0), 0.5, places=7) self.assertAlmostEqual( oetf_ARIBSTDB67(64.0), 1.302858098046995, places=7)
def test_oetf_ARIBSTDB67(self): """ Tests :func:`colour.models.rgb.transfer_functions.arib_std_b67.\ oetf_ARIBSTDB67` definition. """ self.assertAlmostEqual(oetf_ARIBSTDB67(0.0), 0.0, places=7) self.assertAlmostEqual( oetf_ARIBSTDB67(0.18), 0.212132034355964, places=7) self.assertAlmostEqual(oetf_ARIBSTDB67(1.0), 0.5, places=7) self.assertAlmostEqual( oetf_ARIBSTDB67(64.0), 1.302858098046995, places=7)
def oetf_BT2100_HLG(E): """ Defines *Recommendation ITU-R BT.2100* *Reference HLG* opto-electrical transfer function (OETF / OECF). The OETF maps relative scene linear light into the non-linear *HLG* signal value. Parameters ---------- E : numeric or array_like :math:`E` is the signal for each colour component :math:`{R_S, G_S, B_S}` proportional to scene linear light and scaled by camera exposure, normalized to the range [0, 1]. Returns ------- numeric or ndarray :math:`E` is the resulting non-linear signal :math:`{R', G', B'}` in the range [0, 1]. References ---------- - :cite:`Borer2017a` - :cite:`InternationalTelecommunicationUnion2016a` Examples -------- >>> oetf_BT2100_HLG(0.18 / 12) # doctest: +ELLIPSIS 0.2121320... """ return oetf_ARIBSTDB67(12 * E)
def test_n_dimensional_oetf_ARIBSTDB67(self): """ Tests :func:`colour.models.rgb.transfer_functions.arib_std_b67.\ oetf_ARIBSTDB67` definition n-dimensional arrays support. """ E = 0.18 E_p = oetf_ARIBSTDB67(E) E = np.tile(E, 6) E_p = np.tile(E_p, 6) np.testing.assert_almost_equal(oetf_ARIBSTDB67(E), E_p, decimal=7) E = np.reshape(E, (2, 3)) E_p = np.reshape(E_p, (2, 3)) np.testing.assert_almost_equal(oetf_ARIBSTDB67(E), E_p, decimal=7) E = np.reshape(E, (2, 3, 1)) E_p = np.reshape(E_p, (2, 3, 1)) np.testing.assert_almost_equal(oetf_ARIBSTDB67(E), E_p, decimal=7)
def test_n_dimensional_oetf_ARIBSTDB67(self): """ Tests :func:`colour.models.rgb.transfer_functions.arib_std_b67.\ oetf_ARIBSTDB67` definition n-dimensional arrays support. """ E = 0.18 E_p = oetf_ARIBSTDB67(E) E = np.tile(E, 6) E_p = np.tile(E_p, 6) np.testing.assert_almost_equal(oetf_ARIBSTDB67(E), E_p, decimal=7) E = np.reshape(E, (2, 3)) E_p = np.reshape(E_p, (2, 3)) np.testing.assert_almost_equal(oetf_ARIBSTDB67(E), E_p, decimal=7) E = np.reshape(E, (2, 3, 1)) E_p = np.reshape(E_p, (2, 3, 1)) np.testing.assert_almost_equal(oetf_ARIBSTDB67(E), E_p, decimal=7)
def eotf_reverse_BT2100_HLG(F_D, L_B=0, L_W=1000, gamma=None): """ Defines *Recommendation ITU-R BT.2100* *Reference HLG* reverse electro-optical transfer function (EOTF / EOCF). Parameters ---------- F_D : numeric or array_like Luminance :math:`F_D` of a displayed linear component :math:`{R_D, G_D, B_D}` or :math:`Y_D` or :math:`I_D`, in :math:`cd/m^2`. L_B : numeric, optional :math:`L_B` is the display luminance for black in :math:`cd/m^2`. L_W : numeric, optional :math:`L_W` is nominal peak luminance of the display in :math:`cd/m^2` for achromatic pixels. gamma : numeric, optional System gamma value, 1.2 at the nominal display peak luminance of :math:`1000 cd/m^2`. Returns ------- numeric or ndarray :math:`E'` denotes a non-linear colour value :math:`{R', G', B'}` or :math:`{L', M', S'}` in *HLG* space. Notes ----- +------------+-----------------------+---------------+ | **Domain** | **Scale - Reference** | **Scale - 1** | +============+=======================+===============+ | ``F_D`` | [0, 1] | [0, 1] | +------------+-----------------------+---------------+ +------------+-----------------------+---------------+ | **Range** | **Scale - Reference** | **Scale - 1** | +============+=======================+===============+ | ``E_p`` | [0, 1] | [0, 1] | +------------+-----------------------+---------------+ References ---------- :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2016a` Examples -------- >>> eotf_reverse_BT2100_HLG(6.476039825649814) # doctest: +ELLIPSIS 0.2121320... """ return oetf_ARIBSTDB67(ootf_reverse_BT2100_HLG(F_D, L_B, L_W, gamma) * 12)
def eotf_reverse_BT2100_HLG(F_D, L_B=0, L_W=1000, gamma=None): """ Defines *Recommendation ITU-R BT.2100* *Reference HLG* reverse electro-optical transfer function (EOTF / EOCF). Parameters ---------- F_D : numeric or array_like Luminance :math:`F_D` of a displayed linear component :math:`{R_D, G_D, B_D}` or :math:`Y_D` or :math:`I_D`, in :math:`cd/m^2`. L_B : numeric, optional :math:`L_B` is the display luminance for black in :math:`cd/m^2`. L_W : numeric, optional :math:`L_W` is nominal peak luminance of the display in :math:`cd/m^2` for achromatic pixels. gamma : numeric, optional System gamma value, 1.2 at the nominal display peak luminance of :math:`1000 cd/m^2`. Returns ------- numeric or ndarray :math:`E'` denotes a non-linear colour value :math:`{R', G', B'}` or :math:`{L', M', S'}` in *HLG* space. Notes ----- +------------+-----------------------+---------------+ | **Domain** | **Scale - Reference** | **Scale - 1** | +============+=======================+===============+ | ``F_D`` | [0, 1] | [0, 1] | +------------+-----------------------+---------------+ +------------+-----------------------+---------------+ | **Range** | **Scale - Reference** | **Scale - 1** | +============+=======================+===============+ | ``E_p`` | [0, 1] | [0, 1] | +------------+-----------------------+---------------+ References ---------- :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2016a` Examples -------- >>> eotf_reverse_BT2100_HLG(6.476039825649814) # doctest: +ELLIPSIS 0.2121320... """ return oetf_ARIBSTDB67(ootf_reverse_BT2100_HLG(F_D, L_B, L_W, gamma) * 12)
def oetf_BT2100_HLG(E): """ Defines *Recommendation ITU-R BT.2100* *Reference HLG* opto-electrical transfer function (OETF / OECF). The OETF maps relative scene linear light into the non-linear *HLG* signal value. Parameters ---------- E : numeric or array_like :math:`E` is the signal for each colour component :math:`{R_S, G_S, B_S}` proportional to scene linear light and scaled by camera exposure. Returns ------- numeric or ndarray :math:`E'` is the resulting non-linear signal :math:`{R', G', B'}`. Notes ----- +------------+-----------------------+---------------+ | **Domain** | **Scale - Reference** | **Scale - 1** | +============+=======================+===============+ | ``E`` | [0, 1] | [0, 1] | +------------+-----------------------+---------------+ +------------+-----------------------+---------------+ | **Range** | **Scale - Reference** | **Scale - 1** | +============+=======================+===============+ | ``E_p`` | [0, 1] | [0, 1] | +------------+-----------------------+---------------+ References ---------- :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2016a` Examples -------- >>> oetf_BT2100_HLG(0.18 / 12) # doctest: +ELLIPSIS 0.2121320... """ return oetf_ARIBSTDB67(12 * E)