Beispiel #1
0
    def test__setattr__(self):
        """
        Tests :attr:`colour_hdri.utilities.image.ImageStack.__getattr__`
        method.
        """

        image_stack = ImageStack().from_files(self._test_jpg_images)

        self.assertTupleEqual(image_stack.data.shape, (426, 640, 3, 3))

        image_stack.data = np.random.random((20, 10, 3, 3))

        self.assertTupleEqual(image_stack.data.shape, (20, 10, 3, 3))

        np.testing.assert_almost_equal(
            image_stack.f_number, np.array([8, 8, 8]), decimal=7)

        image_stack.f_number = np.array([1, 2, 3])

        np.testing.assert_almost_equal(
            image_stack.f_number, np.array([1, 2, 3]), decimal=7)

        self.assertEqual(image_stack[0].metadata.f_number, 1)

        self.assertListEqual(list(image_stack.black_level), [None, None, None])

        image_stack.black_level = np.array([2048, 2048, 2048])

        np.testing.assert_almost_equal(
            image_stack.black_level, np.array([2048, 2048, 2048]), decimal=7)

        self.assertEqual(image_stack[0].metadata.black_level, 2048)
Beispiel #2
0
    def test_from_files(self):
        """
        Tests :attr:`colour_hdri.utilities.image.ImageStack.test_from_files`
        method.
        """

        image_stack = ImageStack().from_files(reversed(self._test_jpg_images))
        self.assertListEqual(list(image_stack.path), self._test_jpg_images)
Beispiel #3
0
    def setUp(self):
        """
        Initialises common tests attributes.
        """

        self._test_jpg_images = filter_files(FROBISHER_001_DIRECTORY,
                                             ('jpg', ))

        self._image_stack = ImageStack().from_files(self._test_jpg_images)
Beispiel #4
0
    def test__delitem__(self):
        """
        Tests :attr:`colour_hdri.utilities.image.ImageStack.__delitem__`
        method.
        """

        image_stack = ImageStack().from_files(self._test_jpg_images)

        del image_stack[0]

        self.assertEqual(len(image_stack), 2)
Beispiel #5
0
    def test__setitem__(self):
        """
        Tests :attr:`colour_hdri.utilities.image.ImageStack.__setitem__`
        method.
        """

        image_stack = ImageStack()
        image = Image(self._test_jpg_images[0])
        image.read_data()
        image.read_metadata()
        image_stack.insert(0, image)

        self.assertEqual(image_stack[0], image)