Ejemplo n.º 1
0
    def test_nan_oetf_BT709(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_709.\
oetf_BT709` definition nan support.
        """

        oetf_BT709(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
Ejemplo n.º 2
0
    def test_nan_oetf_BT709(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_709.\
oetf_BT709` definition nan support.
        """

        oetf_BT709(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
Ejemplo n.º 3
0
    def test_n_dimensional_oetf_BT709(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.bt_709.\
oetf_BT709` definition n-dimensional arrays support.
        """

        L = 0.18
        V = 0.409007728864150
        np.testing.assert_almost_equal(
            oetf_BT709(L),
            V,
            decimal=7)

        L = np.tile(L, 6)
        V = np.tile(V, 6)
        np.testing.assert_almost_equal(
            oetf_BT709(L),
            V,
            decimal=7)

        L = np.reshape(L, (2, 3))
        V = np.reshape(V, (2, 3))
        np.testing.assert_almost_equal(
            oetf_BT709(L),
            V,
            decimal=7)

        L = np.reshape(L, (2, 3, 1))
        V = np.reshape(V, (2, 3, 1))
        np.testing.assert_almost_equal(
            oetf_BT709(L),
            V,
            decimal=7)
Ejemplo n.º 4
0
    def test_oetf_BT709(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.bt_709.\
oetf_BT709` definition.
        """

        self.assertAlmostEqual(oetf_BT709(0.0), 0.0, places=7)

        self.assertAlmostEqual(oetf_BT709(0.18), 0.409007728864150, places=7)

        self.assertAlmostEqual(oetf_BT709(1.0), 1.0, places=7)
Ejemplo n.º 5
0
    def test_oetf_BT709(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_709.\
oetf_BT709` definition.
        """

        self.assertAlmostEqual(oetf_BT709(0.0), 0.0, places=7)

        self.assertAlmostEqual(oetf_BT709(0.015), 0.067500000000000, places=7)

        self.assertAlmostEqual(oetf_BT709(0.18), 0.409007728864150, places=7)

        self.assertAlmostEqual(oetf_BT709(1.0), 1.0, places=7)
Ejemplo n.º 6
0
    def test_domain_range_scale_oetf_BT709(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_709.\
oetf_BT709` definition domain and range scale support.
        """

        L = 0.18
        V = oetf_BT709(L)

        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_BT709(L * factor), V * factor, decimal=7)
Ejemplo n.º 7
0
def ootf_BT2100_PQ(E):
    """
    Defines *Recommendation ITU-R BT.2100* *Reference PQ* opto-optical transfer
    function (OOTF / OOCF).

    The OOTF maps relative scene linear light to display linear light.

    Parameters
    ----------
    E : numeric or array_like
        :math:`E = {R_S, G_S, B_S; Y_S; or I_S}` is the signal determined by
        scene light and scaled by camera exposure. The values :math:`E`,
        :math:`R_S`, :math:`G_S`, :math:`B_S`, :math:`Y_S`, :math:`I_S` are in
        the range [0, 1].

    Returns
    -------
    numeric or ndarray
        :math:`F_D` is the luminance of a displayed linear component
        (:math:`R_D`, :math:`G_D`, :math:`B_D`; :math:`Y_D`; or :math:`I_D`).

    References
    ----------
    -   :cite:`Borer2017a`
    -   :cite:`InternationalTelecommunicationUnion2016a`

    Examples
    --------
    >>> ootf_BT2100_PQ(0.1)  # doctest: +ELLIPSIS
    779.9883608...
    """

    E = np.asarray(E)

    return 100 * eotf_BT1886(oetf_BT709(59.5208 * E))
Ejemplo n.º 8
0
    def test_n_dimensional_oetf_BT709(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_709.\
oetf_BT709` definition n-dimensional arrays support.
        """

        L = 0.18
        V = oetf_BT709(L)

        L = np.tile(L, 6)
        V = np.tile(V, 6)
        np.testing.assert_almost_equal(oetf_BT709(L), V, decimal=7)

        L = np.reshape(L, (2, 3))
        V = np.reshape(V, (2, 3))
        np.testing.assert_almost_equal(oetf_BT709(L), V, decimal=7)

        L = np.reshape(L, (2, 3, 1))
        V = np.reshape(V, (2, 3, 1))
        np.testing.assert_almost_equal(oetf_BT709(L), V, decimal=7)
Ejemplo n.º 9
0
def ootf_BT2100_PQ(E):
    """
    Defines *Recommendation ITU-R BT.2100* *Reference PQ* opto-optical transfer
    function (OOTF / OOCF).

    The OOTF maps relative scene linear light to display linear light.

    Parameters
    ----------
    E : numeric or array_like
        :math:`E = {R_S, G_S, B_S; Y_S; or I_S}` is the signal determined by
        scene light and scaled by camera exposure.

    Returns
    -------
    numeric or ndarray
        :math:`F_D` is the luminance of a displayed linear component
        (:math:`R_D`, :math:`G_D`, :math:`B_D`; :math:`Y_D`; or :math:`I_D`).

    Notes
    -----

    +------------+-----------------------+---------------+
    | **Domain** | **Scale - Reference** | **Scale - 1** |
    +============+=======================+===============+
    | ``E``      | [0, 1]                | [0, 1]        |
    +------------+-----------------------+---------------+

    +------------+-----------------------+---------------+
    | **Range**  | **Scale - Reference** | **Scale - 1** |
    +============+=======================+===============+
    | ``F_D``    | [0, 1]                | [0, 1]        |
    +------------+-----------------------+---------------+

    References
    ----------
    :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2016a`

    Examples
    --------
    >>> ootf_BT2100_PQ(0.1)  # doctest: +ELLIPSIS
    779.9883608...
    """

    E = as_float_array(E)

    return 100 * eotf_BT1886(oetf_BT709(59.5208 * E))