예제 #1
0
    def test_demosaicing_CFA_Bayer_Malvar2004(self):
        """
        Tests :func:`colour_demosaicing.bayer.demosaicing.malvar2004.\
demosaicing_CFA_Bayer_Malvar2004` definition.
        """

        for pattern in ('RGGB', 'BGGR', 'GRBG', 'GBRG'):
            CFA = os.path.join(BAYER_DIRECTORY, 'Lighthouse_CFA_{0}.exr')
            RGB = os.path.join(BAYER_DIRECTORY,
                               'Lighthouse_Malvar2004_{0}.exr')

            np.testing.assert_almost_equal(demosaicing_CFA_Bayer_Malvar2004(
                read_image(str(CFA.format(pattern)))[..., 0], pattern),
                                           read_image(str(
                                               RGB.format(pattern))),
                                           decimal=7)
    def test_demosaicing_CFA_Bayer_Malvar2004(self):
        """
        Tests :func:`colour_demosaicing.bayer.demosaicing.malvar2004.\
demosaicing_CFA_Bayer_Malvar2004` definition.
        """

        for pattern in ('RGGB', 'BGGR', 'GRBG', 'GBRG'):
            np.testing.assert_almost_equal(
                demosaicing_CFA_Bayer_Malvar2004(
                    colour.read_image(
                        str(os.path.join(
                            BAYER_DIRECTORY,
                            'Lighthouse_CFA_{0}.exr'.format(pattern)))),
                    pattern),
                colour.read_image(
                    str(os.path.join(
                        BAYER_DIRECTORY,
                        'Lighthouse_Malvar2004_{0}.exr'.format(pattern)))),
                decimal=7)