Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
luca-bondi committed Jan 9, 2019
2 parents 117c0ec + 79eb3ed commit 6632270
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion example.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def main():
stats_pce = prnu.stats(pce_rot, gt)

print('AUC on CC {:.2f}, expected {:.2f}'.format(stats_cc['auc'], 0.98))
print('AUC on PCE {:.2f}, expected {:.2f}'.format(stats_pce['auc'], 0.83))
print('AUC on PCE {:.2f}, expected {:.2f}'.format(stats_pce['auc'], 0.81))


if __name__ == '__main__':
Expand Down
4 changes: 2 additions & 2 deletions prnu/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def noise_extract(im: np.ndarray, levels: int = 4, sigma: float = 5) -> np.ndarr
wlet = None
while wlet is None and levels > 0:
try:
wlet = pywt.wavedec2(im[:, :, ch], 'db8', level=levels)
wlet = pywt.wavedec2(im[:, :, ch], 'db4', level=levels)
except ValueError:
levels -= 1
wlet = None
Expand All @@ -99,7 +99,7 @@ def noise_extract(im: np.ndarray, levels: int = 4, sigma: float = 5) -> np.ndarr
wlet[0][...] = 0

# Invert wavelet transform ---
wrec = pywt.waverec2(wlet, 'db8')
wrec = pywt.waverec2(wlet, 'db4')
try:
W[:, :, ch] = wrec
except ValueError:
Expand Down
6 changes: 3 additions & 3 deletions test/test_prnu.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_crosscorr2d(self):
peak_height = cc[max_y, max_x]

self.assertSequenceEqual((peak_y, peak_x), (y_os, x_os))
self.assertTrue(np.allclose(peak_height, 662901.0))
self.assertTrue(np.allclose(peak_height, 666995.0))

def test_pce(self):
im = np.asarray(Image.open('data/prnu1.jpg'))[:500, :400]
Expand All @@ -72,10 +72,10 @@ def test_pce(self):
pce2 = prnu.pce(cc2)

self.assertSequenceEqual(pce1['peak'], (im.shape[0] - y_os - 1, im.shape[1] - x_os - 1))
self.assertTrue(np.allclose(pce1['pce'], 134791.14398835122))
self.assertTrue(np.allclose(pce1['pce'], 134611.58644973233))

self.assertSequenceEqual(pce2['peak'], (y_os - 1, x_os - 1))
self.assertTrue(np.allclose(pce2['pce'], 134797.4600680655))
self.assertTrue(np.allclose(pce2['pce'], 134618.03404934643))

def test_gt(self):
cams = ['a', 'b', 'c', 'd']
Expand Down

0 comments on commit 6632270

Please sign in to comment.