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)
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())
def test_data_noncontiguous(self): data = np.zeros((10, 10)) view = data[:,1] with self.assertRaises(ValueError): tiffutils.save_dng(view, self.name)
def test_data_none(self): with self.assertRaises(TypeError): tiffutils.save_dng(None, self.name)
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())
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)
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)
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)
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)