From 90df8a7cb9c9ec150a9c4ab9d55c43f52ea833c5 Mon Sep 17 00:00:00 2001 From: Benjamin Loison <12752145+Benjamin-Loison@users.noreply.github.com> Date: Tue, 16 Apr 2024 01:06:59 +0200 Subject: [PATCH] Verify `raw.raw_pattern` as `raw.color_desc` does not seem enough As got: ```bash python3 extract_noise.py ``` ``` Denoising images: 0%| | 0/8156 [00:00 treatImage(imageFileName) File "/home/benjamin/robust_image_source_identification_on_modern_smartphones/datasets/raise/extract_noise.py", line 46, in treatImage assert np.array_equal(raw.raw_pattern, np.array([[3, 2], [0, 1]], dtype = np.uint8)) AssertionError ``` --- datasets/raise/extract_noise.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/datasets/raise/extract_noise.py b/datasets/raise/extract_noise.py index 3aa552a..1fb0cb1 100755 --- a/datasets/raise/extract_noise.py +++ b/datasets/raise/extract_noise.py @@ -37,14 +37,16 @@ def treatImage(imageFileName): global mean, numberOfImagesInMean imageFilePath = f'{imagesFolderPath}/{imageFileName}' if imageFileName.endswith('.NEF'): - imageFileName = 'r01b6aed6t.NEF' + imageFileName = 'ra2c888f8t.NEF' imageFilePath = f'{imagesFolderPath}/{imageFileName}' + print(imageFilePath) with rawpy.imread(imageFilePath) as raw: colorDesc = raw.color_desc.decode('ascii') assert colorDesc == 'RGBG' + assert np.array_equal(raw.raw_pattern, np.array([[3, 2], [0, 1]], dtype = np.uint8)) rawImageVisible = raw.raw_image_visible.copy() - centerY = 628 - centerX = 3_014 + centerY = 2263 + centerX = 237 RANGE = 5 rawImageVisible = rawImageVisible.astype(np.float64) rawImageVisibleShape = rawImageVisible.shape