Plot an exhaustive curve to make sure that results are not just by chance
This commit is contained in:
parent
631ed6de34
commit
aafb7ebc92
@ -14,19 +14,16 @@ sys.path.insert(0, '../../algorithms/distance/')
|
||||
from rms_diff import rmsDiffNumpy
|
||||
|
||||
NUMBER_OF_SUBGROUPS = 2
|
||||
fig, axes = plt.subplots(NUMBER_OF_SUBGROUPS, 1)
|
||||
fig.suptitle(f'PRNU estimation and comparison for {NUMBER_OF_SUBGROUPS} subgroups with different number of flat-images')
|
||||
|
||||
IMAGES_FOLDER = 'flat-field/TIF'
|
||||
imagesFileNames = os.listdir(IMAGES_FOLDER)
|
||||
numberOfImagesPerSubgroup = len(imagesFileNames) // NUMBER_OF_SUBGROUPS
|
||||
|
||||
numberOfImagesThresholds = [1, 5, 50]
|
||||
numberOfImagesThresholds = range(1, numberOfImagesPerSubgroup + 1)
|
||||
|
||||
# Assume random image order to not introduce a bias.
|
||||
subgroupsPrnuEstimatesNpArray = []
|
||||
for subgroupIndex in range(NUMBER_OF_SUBGROUPS):
|
||||
axis = axes[subgroupIndex]
|
||||
imagesPrnuEstimateNpArray = []
|
||||
for imageFileName in tqdm(imagesFileNames[numberOfImagesPerSubgroup * subgroupIndex : numberOfImagesPerSubgroup * (subgroupIndex + 1)]):
|
||||
imagePath = f'{IMAGES_FOLDER}/{imageFileName}'
|
||||
@ -36,17 +33,18 @@ for subgroupIndex in range(NUMBER_OF_SUBGROUPS):
|
||||
imagesPrnuEstimateNpArray += [imagePrnuEstimateNpArray]
|
||||
|
||||
subgroupPrnuEstimateNpArray = []
|
||||
# Not efficient mean computation.
|
||||
for numberOfImagesIndex, numberOfImages in enumerate(numberOfImagesThresholds):
|
||||
subgroupPrnuEstimateNpArray += [np.array(imagesPrnuEstimateNpArray[:numberOfImages]).mean(axis = 0)]
|
||||
subgroupsPrnuEstimatesNpArray += [subgroupPrnuEstimateNpArray]
|
||||
|
||||
'''
|
||||
axis[numberOfImagesIndex].set_title(f'PRNU estimate for subgroup {subgroupIndex} with ')
|
||||
axis[numberOfImagesIndex].imshow(cameraPrnuEstimateNpArray)
|
||||
'''
|
||||
|
||||
rmss = []
|
||||
for numberOfImagesIndex, numberOfImages in enumerate(numberOfImagesThresholds):
|
||||
rms = rmsDiffNumpy(subgroupsPrnuEstimatesNpArray[0][numberOfImagesIndex], subgroupsPrnuEstimatesNpArray[1][numberOfImagesIndex])
|
||||
print(numberOfImages, round(rms, 4))
|
||||
rmss += [rms]
|
||||
|
||||
#plt.show()
|
||||
plt.title('RMS between both subgroups estimated PRNUs for a given number of images among them')
|
||||
plt.xlabel('Number of images of each subgroup')
|
||||
plt.ylabel('RMS between both subgroups estimated PRNUs')
|
||||
plt.plot(rmss)
|
||||
plt.show()
|
Loading…
Reference in New Issue
Block a user