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<?, ?it/s]/mnt/HDD0/raise/nef/ra2c888f8t.NEF
Denoising images:   0%|                                                                                           | 0/8156 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "/home/benjamin/robust_image_source_identification_on_modern_smartphones/datasets/raise/extract_noise.py", line 73, in <module>
    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
```
This commit is contained in:
Benjamin Loison 2024-04-16 01:06:59 +02:00
parent 120eaf563f
commit 90df8a7cb9
No known key found for this signature in database

View File

@ -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