diff --git a/datasets/raise/attribute_source_camera.py b/datasets/raise/attribute_source_camera.py index 934a813..e7f5f7e 100755 --- a/datasets/raise/attribute_source_camera.py +++ b/datasets/raise/attribute_source_camera.py @@ -58,11 +58,14 @@ def getImageFilePath(camera, cameraImageIndex): imageFilePath = f'{IMAGES_CAMERAS_FOLDER[camera]}/{imageFileName}' return imageFilePath -def getSingleColorChannelAndMultipleColorsImage(camera, cameraImageIndex): +def getSingleColorChannelImages(camera, cameraImageIndex): imageFilePath = getImageFilePath(camera, cameraImageIndex) singleColorChannelImages = {color: rescaleIfNeeded(getColorChannel(imageFilePath, color)[:minimalColorChannelCameraResolution[0],:minimalColorChannelCameraResolution[1]], minColor, maxColor) for color in Color} + return singleColorChannelImages + +def getMultipleColorsImage(singleColorChannelImages): multipleColorsImage = mergeSingleColorChannelImagesAccordingToBayerFilter(singleColorChannelImages) - return singleColorChannelImages, multipleColorsImage + return multipleColorsImage from utils import silentTqdm #tqdm = silentTqdm @@ -78,7 +81,8 @@ for computeExtremes in tqdm(([True] if minColor is None or maxColor is None else for cameraTestingImageIndex in tqdm(range(numberOfTestingImages), 'Camera testing image index'): print(f'{camera=} {numberOfTrainingImages + cameraTestingImageIndex=}') - singleColorChannelImages, multipleColorsImage = getSingleColorChannelAndMultipleColorsImage(camera, numberOfTrainingImages + cameraTestingImageIndex) + singleColorChannelImages = getSingleColorChannelImages(camera, numberOfTrainingImages + cameraTestingImageIndex) + multipleColorsImage = getMultipleColorsImage(singleColorChannelImages) # Should make a function singleColorChannelDenoisedImages = {color: denoise(singleColorChannelImages[color], DENOISER) for color in Color} @@ -88,7 +92,8 @@ for computeExtremes in tqdm(([True] if minColor is None or maxColor is None else cameraTestingImagesNoise[camera] = cameraTestingImagesNoise.get(camera, []) + [imagePrnuEstimateNpArray] for cameraTrainingImageIndex in tqdm(range(minimumNumberOfImagesCameras if computeExtremes else numberOfTrainingImages), 'Camera training image index'): for cameraIndex, camera in enumerate(tqdm(IMAGES_CAMERAS_FOLDER, 'Camera')): - singleColorChannelImages, multipleColorsImage = getSingleColorChannelAndMultipleColorsImage(camera, cameraTrainingImageIndex) + singleColorChannelImages = getSingleColorChannelImages(camera, cameraTrainingImageIndex) + multipleColorsImage = getMultipleColorsImage(singleColorChannelImages) if computeExtremes: minColor, maxColor = updateExtremes(multipleColorsImage, minColor, maxColor)