Compare commits
No commits in common. "115bab4b4cc487c2e5e14b66ae3c5308ab538957" and "be83fcf154ba144045e296f2f0e6d0d8deb58ca4" have entirely different histories.
115bab4b4c
...
be83fcf154
@ -8,33 +8,23 @@ sys.path.insert(0, '../')
|
||||
|
||||
from utils import isARawImage, Color, getColorChannel, mergeSingleColorChannelImagesAccordingToBayerFilter, iterativeMean
|
||||
|
||||
FOLDERS = {
|
||||
'Rafael 23/04/24': '../rafael/230424',
|
||||
'RAISE flat-field': '../flat-field/nef',
|
||||
'RAISE not flat-field': '../not_flat-field/nef',
|
||||
}
|
||||
folder = '../rafael/230424'
|
||||
meanImages = iterativeMean()
|
||||
filePaths = [f'{folder}/{file}' for file in os.listdir(folder) if isARawImage(file)]
|
||||
|
||||
def getImageMergedColorChannels(filePath):
|
||||
for filePath in tqdm(filePaths):
|
||||
imageColorChannels = {color: getColorChannel(filePath, color) for color in Color}
|
||||
imageMergedColorChannels = mergeSingleColorChannelImagesAccordingToBayerFilter(imageColorChannels)
|
||||
return imageMergedColorChannels
|
||||
meanImages.add(imageMergedColorChannels)
|
||||
|
||||
def getEstimatedPrnu(folder):
|
||||
meanImages = iterativeMean()
|
||||
filePaths = [f'{folder}/{file}' for file in os.listdir(folder) if isARawImage(file)]
|
||||
#print(meanImages.mean.shape)
|
||||
|
||||
for filePath in tqdm(filePaths, 'Compute mean image'):
|
||||
imageMergedColorChannels = getImageMergedColorChannels(filePath)
|
||||
meanImages.add(imageMergedColorChannels)
|
||||
# Is not there anything clever than this to do? See [Robust_image_source_identification_on_modern_smartphones/issues/72](https://gitea.lemnoslife.com/Benjamin_Loison/Robust_image_source_identification_on_modern_smartphones/issues/72).
|
||||
estimatedPrnu = iterativeMean()
|
||||
for filePath in tqdm(filePaths):
|
||||
imageColorChannels = {color: getColorChannel(filePath, color) for color in Color}
|
||||
imageMergedColorChannels = mergeSingleColorChannelImagesAccordingToBayerFilter(imageColorChannels)
|
||||
estimatedPrnu.add(imageMergedColorChannels - meanImages.mean)
|
||||
|
||||
# Is not there anything clever than this to do? See [Robust_image_source_identification_on_modern_smartphones/issues/72](https://gitea.lemnoslife.com/Benjamin_Loison/Robust_image_source_identification_on_modern_smartphones/issues/72).
|
||||
estimatedPrnu = iterativeMean()
|
||||
for filePath in tqdm(filePaths, 'Compute estimated PRNU'):
|
||||
imageMergedColorChannels = getImageMergedColorChannels(filePath)
|
||||
estimatedPrnu.add(imageMergedColorChannels - meanImages.mean)
|
||||
return estimatedPrnu.mean
|
||||
|
||||
estimatedPrnu = getEstimatedPrnu(FOLDERS['Rafael 23/04/24'])
|
||||
|
||||
plt.imshow(estimatedPrnu)
|
||||
plt.imshow(estimatedPrnu.mean)
|
||||
plt.show()
|
Loading…
Reference in New Issue
Block a user