def test_nan_oetf_BT601(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_601.\
oetf_BT601` definition nan support.
        """

        oetf_BT601(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
Beispiel #2
0
    def test_nan_oetf_BT601(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_601.\
oetf_BT601` definition nan support.
        """

        oetf_BT601(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
Beispiel #3
0
    def test_oetf_BT601(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_601.\
oetf_BT601` definition.
        """

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

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

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

        self.assertAlmostEqual(oetf_BT601(1.0), 1.0, places=7)
    def test_oetf_BT601(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_601.\
oetf_BT601` definition.
        """

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

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

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

        self.assertAlmostEqual(oetf_BT601(1.0), 1.0, places=7)
Beispiel #5
0
    def test_domain_range_scale_oetf_BT601(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_601.\
oetf_BT601` definition domain and range scale support.
        """

        L = 0.18
        E = oetf_BT601(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_BT601(L * factor), E * factor, decimal=7)
    def test_domain_range_scale_oetf_BT601(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_601.\
oetf_BT601` definition domain and range scale support.
        """

        L = 0.18
        E = oetf_BT601(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_BT601(L * factor), E * factor, decimal=7)
Beispiel #7
0
def oetf_BT709(L):
    """
    Defines *Recommendation ITU-R BT.709-6* opto-electronic transfer function
    (OETF / OECF).

    Parameters
    ----------
    L : numeric or array_like
        *Luminance* :math:`L` of the image.

    Returns
    -------
    numeric or ndarray
        Corresponding electrical signal :math:`V`.

    References
    ----------
    -   :cite:`InternationalTelecommunicationUnion2015i`

    Examples
    --------
    >>> oetf_BT709(0.18)  # doctest: +ELLIPSIS
    0.4090077...
    """

    return oetf_BT601(L)
Beispiel #8
0
    def test_n_dimensional_oetf_BT601(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_601.\
oetf_BT601` definition n-dimensional arrays support.
        """

        L = 0.18
        E = oetf_BT601(L)

        L = np.tile(L, 6)
        E = np.tile(E, 6)
        np.testing.assert_almost_equal(oetf_BT601(L), E, decimal=7)

        L = np.reshape(L, (2, 3))
        E = np.reshape(E, (2, 3))
        np.testing.assert_almost_equal(oetf_BT601(L), E, decimal=7)

        L = np.reshape(L, (2, 3, 1))
        E = np.reshape(E, (2, 3, 1))
        np.testing.assert_almost_equal(oetf_BT601(L), E, decimal=7)
    def test_n_dimensional_oetf_BT601(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_601.\
oetf_BT601` definition n-dimensional arrays support.
        """

        L = 0.18
        E = oetf_BT601(L)

        L = np.tile(L, 6)
        E = np.tile(E, 6)
        np.testing.assert_almost_equal(oetf_BT601(L), E, decimal=7)

        L = np.reshape(L, (2, 3))
        E = np.reshape(E, (2, 3))
        np.testing.assert_almost_equal(oetf_BT601(L), E, decimal=7)

        L = np.reshape(L, (2, 3, 1))
        E = np.reshape(E, (2, 3, 1))
        np.testing.assert_almost_equal(oetf_BT601(L), E, decimal=7)
Beispiel #10
0
def oetf_BT709(L):
    """
    Defines *Recommendation ITU-R BT.709-6* opto-electronic transfer function
    (OETF / OECF).

    Parameters
    ----------
    L : numeric or array_like
        *Luminance* :math:`L` of the image.

    Returns
    -------
    numeric or ndarray
        Corresponding electrical signal :math:`V`.

    Notes
    -----

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

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

    References
    ----------
    :cite:`InternationalTelecommunicationUnion2015i`

    Examples
    --------
    >>> oetf_BT709(0.18)  # doctest: +ELLIPSIS
    0.4090077...
    """

    return oetf_BT601(L)
Beispiel #11
0
def oetf_BT709(L: FloatingOrArrayLike) -> FloatingOrNDArray:
    """
    Define *Recommendation ITU-R BT.709-6* opto-electronic transfer function
    (OETF).

    Parameters
    ----------
    L
        *Luminance* :math:`L` of the image.

    Returns
    -------
    :class:`numpy.floating` or :class:`numpy.ndarray`
        Corresponding electrical signal :math:`V`.

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

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

    References
    ----------
    :cite:`InternationalTelecommunicationUnion2015i`

    Examples
    --------
    >>> oetf_BT709(0.18)  # doctest: +ELLIPSIS
    0.4090077...
    """

    return oetf_BT601(L)