Simplify and clean split_and_compare_prnus_of_subgroups.py
This commit is contained in:
parent
ee7353cfde
commit
e9dc28dc2a
@ -5,6 +5,7 @@ from tqdm import tqdm
|
||||
from utils import denoise
|
||||
from skimage import img_as_float
|
||||
import sys
|
||||
import os
|
||||
|
||||
sys.path.insert(0, '../../algorithms/distance/')
|
||||
|
||||
@ -12,19 +13,18 @@ from rms_diff import rmsDiffNumpy
|
||||
|
||||
NUMBER_OF_SUBGROUPS = 1
|
||||
DENOISER = 'wavelet'
|
||||
|
||||
IMAGES_FOLDER = 'flat-field/TIF'
|
||||
|
||||
imagesFileNames = os.listdir(IMAGES_FOLDER)
|
||||
numberOfImagesPerSubgroup = len(imagesFileNames) // NUMBER_OF_SUBGROUPS
|
||||
|
||||
# 1
|
||||
numberOfImagesThresholds = range(numberOfImagesPerSubgroup, numberOfImagesPerSubgroup + 1)
|
||||
|
||||
# Assume random image order to not introduce a bias.
|
||||
subgroupsPrnuEstimatesNpArray = []
|
||||
for subgroupIndex in range(NUMBER_OF_SUBGROUPS):
|
||||
for subgroupIndex in tqdm(range(NUMBER_OF_SUBGROUPS), 'Subgroup'):
|
||||
imagesPrnuEstimateNpArray = []
|
||||
for imageFileName in tqdm(imagesFileNames[numberOfImagesPerSubgroup * subgroupIndex : numberOfImagesPerSubgroup * (subgroupIndex + 1)]):
|
||||
subgroupImagesFileNames = imagesFileNames[numberOfImagesPerSubgroup * subgroupIndex : numberOfImagesPerSubgroup * (subgroupIndex + 1)]
|
||||
for imageFileName in tqdm(subgroupImagesFileNames, f'Image of subgroup {subgroupIndex}'):
|
||||
imagePath = f'{IMAGES_FOLDER}/{imageFileName}'
|
||||
imagePil = Image.open(imagePath)
|
||||
imageNpArray = img_as_float(np.array(imagePil))
|
||||
@ -39,7 +39,7 @@ for subgroupIndex in range(NUMBER_OF_SUBGROUPS):
|
||||
subgroupsPrnuEstimatesNpArray += [subgroupPrnuEstimateNpArray]
|
||||
|
||||
rmss = []
|
||||
for numberOfImagesIndex, numberOfImages in enumerate(numberOfImagesThresholds):
|
||||
for numberOfImagesIndex in range(len(numberOfImagesThresholds)):
|
||||
rms = rmsDiffNumpy(subgroupsPrnuEstimatesNpArray[0][numberOfImagesIndex], subgroupsPrnuEstimatesNpArray[1][numberOfImagesIndex])
|
||||
rmss += [rms]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user