Esempio n. 1
0
    def test_calibration_illuminant2(self):
        tiffutils.save_dng(self.reference, self.name,
                           calibration_illuminant2=tiffutils.ILLUMINANT_D65)

        meta = GExiv2.Metadata(self.name)
        illuminant2 = float(meta['Exif.Image.CalibrationIlluminant2'])
        self.assertEquals(illuminant2, tiffutils.ILLUMINANT_D65)
Esempio n. 2
0
    def test_color_matrix2(self):
        matrix = np.array([
           [1, 0, 0],
           [0, 1, 0],
           [0, 0, 1]])

        tiffutils.save_dng(self.reference, self.name,
                           color_matrix2=matrix)

        meta = GExiv2.Metadata(self.name)
        color_matrix2 = str_to_array(meta['Exif.Image.ColorMatrix2'],
                                     matrix.shape)

        self.assertTrue((color_matrix2==matrix).all())
Esempio n. 3
0
 def test_data_noncontiguous(self):
     data = np.zeros((10, 10))
     view = data[:,1]
     with self.assertRaises(ValueError):
         tiffutils.save_dng(view, self.name)
Esempio n. 4
0
 def test_data_none(self):
     with self.assertRaises(TypeError):
         tiffutils.save_dng(None, self.name)
Esempio n. 5
0
 def test_data_compressed(self):
     tiffutils.save_dng(self.reference, self.name, compression=True)
     data, cfa = tiffutils.load_dng(self.name)
     self.assertTrue((data==self.reference).all())
Esempio n. 6
0
    def test_calibration_illumimant2_omitted(self):
        tiffutils.save_dng(self.reference, self.name)

        meta = GExiv2.Metadata(self.name)
        self.assertTrue('Exif.Image.CalibrationIllumimant2' not in meta)
Esempio n. 7
0
    def test_color_matrix2_bad(self):
        matrix = np.array([True, False, True])

        with self.assertRaises(ValueError):
            tiffutils.save_dng(self.reference, self.name,
                               color_matrix2=matrix)
Esempio n. 8
0
    def test_color_matrix2_omitted(self):
        tiffutils.save_dng(self.reference, self.name)

        meta = GExiv2.Metadata(self.name)
        self.assertTrue('Exif.Image.ColorMatrix2' not in meta)
Esempio n. 9
0
 def test_cfa(self):
     tiffutils.save_dng(self.reference, self.name,
                        cfa_pattern=tiffutils.CFA_BGGR)
     data, cfa = tiffutils.load_dng(self.name)
     self.assertEquals(cfa, tiffutils.CFA_BGGR)