Add show_mean_noise.py

This commit is contained in:
Benjamin Loison 2024-04-03 22:18:18 +02:00
parent b354f59ac5
commit 606821d45e
Signed by: Benjamin_Loison
SSH Key Fingerprint: SHA256:BtnEgYTlHdOg1u+RmYcDE0mnfz1rhv5dSbQ2gyxW8B8
2 changed files with 10 additions and 2 deletions

View File

@ -0,0 +1,7 @@
import numpy as np
import matplotlib.pyplot as plt
npArray = np.load('mean.npy')
npArrayMin = npArray.min()
print(f'{npArrayMin=}')
plt.imsave('np_array.png', npArray - npArrayMin)

View File

@ -3,6 +3,7 @@ import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm
from skimage.restoration import denoise_tv_chambolle
from skimage import img_as_float
import sys
sys.path.insert(0, '../../algorithms/image_utils/')
@ -28,8 +29,8 @@ for subgroupIndex in range(NUMBER_OF_SUBGROUPS):
imagesPrnuEstimateNpArray = []
for imageFileName in tqdm(imagesFileNames[numberOfImagesPerSubgroup * subgroupIndex : numberOfImagesPerSubgroup * (subgroupIndex + 1)]):
imagePath = f'{IMAGES_FOLDER}/{imageFileName}'
imagePil = Image.open(imagePath).convert('F')
imageNpArray = np.array(imagePil)
imagePil = Image.open(imagePath)
imageNpArray = img_as_float(np.array(imagePil))
imagePrnuEstimateNpArray = imageNpArray - denoise_tv_chambolle(imageNpArray, weight=0.2, channel_axis=-1)
imagesPrnuEstimateNpArray += [imagePrnuEstimateNpArray]