Compare commits
	
		
			2 Commits
		
	
	
		
			be83fcf154
			...
			115bab4b4c
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						
						
							
						
						115bab4b4c
	
				 | 
					
					
						|||
| 
						
						
							
						
						31da324702
	
				 | 
					
					
						
@@ -8,23 +8,33 @@ sys.path.insert(0, '../')
 | 
			
		||||
 | 
			
		||||
from utils import isARawImage, Color, getColorChannel, mergeSingleColorChannelImagesAccordingToBayerFilter, iterativeMean
 | 
			
		||||
 | 
			
		||||
folder = '../rafael/230424'
 | 
			
		||||
meanImages = iterativeMean()
 | 
			
		||||
filePaths = [f'{folder}/{file}' for file in os.listdir(folder) if isARawImage(file)]
 | 
			
		||||
FOLDERS = {
 | 
			
		||||
    'Rafael 23/04/24': '../rafael/230424',
 | 
			
		||||
    'RAISE flat-field': '../flat-field/nef',
 | 
			
		||||
    'RAISE not flat-field': '../not_flat-field/nef',
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
for filePath in tqdm(filePaths):
 | 
			
		||||
def getImageMergedColorChannels(filePath):
 | 
			
		||||
    imageColorChannels = {color: getColorChannel(filePath, color) for color in Color}
 | 
			
		||||
    imageMergedColorChannels = mergeSingleColorChannelImagesAccordingToBayerFilter(imageColorChannels)
 | 
			
		||||
    meanImages.add(imageMergedColorChannels)
 | 
			
		||||
    return imageMergedColorChannels
 | 
			
		||||
 | 
			
		||||
#print(meanImages.mean.shape)
 | 
			
		||||
def getEstimatedPrnu(folder):
 | 
			
		||||
    meanImages = iterativeMean()
 | 
			
		||||
    filePaths = [f'{folder}/{file}' for file in os.listdir(folder) if isARawImage(file)]
 | 
			
		||||
 | 
			
		||||
# 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)
 | 
			
		||||
    for filePath in tqdm(filePaths, 'Compute mean image'):
 | 
			
		||||
        imageMergedColorChannels = getImageMergedColorChannels(filePath)
 | 
			
		||||
        meanImages.add(imageMergedColorChannels)
 | 
			
		||||
 | 
			
		||||
plt.imshow(estimatedPrnu.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.show()
 | 
			
		||||
		Reference in New Issue
	
	Block a user