def test_radiance_image(self):
        """
        Tests :func:`colour_hdri.generation.\
radiance.image_stack_to_radiance_image` definition.
        """

        image_stack = ImageStack.from_files(JPG_IMAGES)
        image_stack.data = RGB_COLOURSPACES['sRGB'].EOCF(
            image_stack.data)
        np.testing.assert_almost_equal(
            image_stack_to_radiance_image(image_stack),
            np.load(os.path.join(
                GENERATION_DIRECTORY,
                'test_radiance_image_linear.npy')),
            decimal=7)

        # Lower precision for unit tests under *travis-ci*.
        image_stack = ImageStack.from_files(JPG_IMAGES)
        np.testing.assert_allclose(
            image_stack_to_radiance_image(
                image_stack,
                camera_response_functions=(
                    camera_response_functions_Debevec1997(image_stack))),
            np.load(os.path.join(
                GENERATION_DIRECTORY,
                'test_radiance_image_crfs.npy')),
            rtol=0.00001,
            atol=0.00001)
Esempio n. 2
0
    def test_radiance_image(self):
        """
        Tests :func:`colour_hdri.generation.\
radiance.image_stack_to_radiance_image` definition.
        """

        image_stack = ImageStack.from_files(JPG_IMAGES)
        image_stack.data = RGB_COLOURSPACES['sRGB'].cctf_decoding(
            image_stack.data)

        # Lower precision for unit tests under *travis-ci*.
        np.testing.assert_allclose(image_stack_to_radiance_image(image_stack),
                                   np.load(
                                       os.path.join(
                                           GENERATION_DIRECTORY,
                                           'test_radiance_image_linear.npy')),
                                   rtol=0.0001,
                                   atol=0.0001)

        # Lower precision for unit tests under *travis-ci*.
        image_stack = ImageStack.from_files(JPG_IMAGES)
        np.testing.assert_allclose(image_stack_to_radiance_image(
            image_stack,
            camera_response_functions=(
                camera_response_functions_Debevec1997(image_stack))),
                                   np.load(
                                       os.path.join(
                                           GENERATION_DIRECTORY,
                                           'test_radiance_image_crfs.npy')),
                                   rtol=0.0001,
                                   atol=0.0001)
    def test_camera_response_function_Debevec1997(self):
        """
        Tests :func:`colour_hdri.calibration.debevec1997.\
camera_response_functions_Debevec1997` definition.
        """

        # Lower precision for unit tests under *travis-ci*.
        np.testing.assert_allclose(
            camera_response_functions_Debevec1997(
                ImageStack.from_files(JPG_IMAGES)),
            np.load(os.path.join(
                CALIBRATION_DIRECTORY,
                'test_camera_response_function_Debevec1997_crfs.npy')),
            rtol=0.00001,
            atol=0.00001)
Esempio n. 4
0
    def test_camera_response_function_Debevec1997(self):
        """
        Tests :func:`colour_hdri.calibration.debevec1997.\
camera_response_functions_Debevec1997` definition.
        """

        # Lower precision for unit tests under *travis-ci*.
        np.testing.assert_allclose(
            camera_response_functions_Debevec1997(
                ImageStack.from_files(JPG_IMAGES)),
            np.load(
                os.path.join(
                    CALIBRATION_DIRECTORY,
                    'test_camera_response_function_Debevec1997_crfs.npy')),
            rtol=0.00001,
            atol=0.00001)