Compare commits
No commits in common. "d8c7b8b0efed023790a4d360573a4db3dea64a56" and "fcbccb3b5cf1e6a5803a70024d5c97248b23cab0" have entirely different histories.
d8c7b8b0ef
...
fcbccb3b5c
@ -58,21 +58,6 @@ def getImageFilePath(camera, cameraImageIndex):
|
||||
imageFilePath = f'{IMAGES_CAMERAS_FOLDER[camera]}/{imageFileName}'
|
||||
return imageFilePath
|
||||
|
||||
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 multipleColorsImage
|
||||
|
||||
def getImagePrnuEstimateNpArray(singleColorChannelImages, multipleColorsImage):
|
||||
singleColorChannelDenoisedImages = {color: denoise(singleColorChannelImages[color], DENOISER) for color in Color}
|
||||
multipleColorsDenoisedImage = mergeSingleColorChannelImagesAccordingToBayerFilter(singleColorChannelDenoisedImages)
|
||||
imagePrnuEstimateNpArray = multipleColorsImage - multipleColorsDenoisedImage
|
||||
return imagePrnuEstimateNpArray
|
||||
|
||||
from utils import silentTqdm
|
||||
#tqdm = silentTqdm
|
||||
|
||||
@ -85,25 +70,31 @@ for computeExtremes in tqdm(([True] if minColor is None or maxColor is None else
|
||||
print('Extracting noise of testing images')
|
||||
for camera in tqdm(IMAGES_CAMERAS_FOLDER, 'Camera'):
|
||||
for cameraTestingImageIndex in tqdm(range(numberOfTestingImages), 'Camera testing image index'):
|
||||
print(f'{camera=} {numberOfTrainingImages + cameraTestingImageIndex=}')
|
||||
imageFilePath = getImageFilePath(camera, numberOfTrainingImages + cameraTestingImageIndex)
|
||||
print(f'{imageFilePath=}')
|
||||
|
||||
singleColorChannelImages = getSingleColorChannelImages(camera, numberOfTrainingImages + cameraTestingImageIndex)
|
||||
multipleColorsImage = getMultipleColorsImage(singleColorChannelImages)
|
||||
|
||||
imagePrnuEstimateNpArray = getImagePrnuEstimatedNpArray(singleColorChannelImages, multipleColorsImage)
|
||||
# Should make a function
|
||||
singleColorChannelImages = {color: rescaleIfNeeded(getColorChannel(imageFilePath, color)[:minimalColorChannelCameraResolution[0],:minimalColorChannelCameraResolution[1]], minColor, maxColor) for color in Color}
|
||||
multipleColorsImage = mergeSingleColorChannelImagesAccordingToBayerFilter(singleColorChannelImages)
|
||||
singleColorChannelDenoisedImages = {color: denoise(singleColorChannelImages[color], DENOISER) for color in Color}
|
||||
multipleColorsDenoisedImage = mergeSingleColorChannelImagesAccordingToBayerFilter(singleColorChannelDenoisedImages)
|
||||
imagePrnuEstimateNpArray = multipleColorsImage - multipleColorsDenoisedImage
|
||||
|
||||
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 = getSingleColorChannelImages(camera, cameraTrainingImageIndex)
|
||||
multipleColorsImage = getMultipleColorsImage(singleColorChannelImages)
|
||||
imageFilePath = getImageFilePath(camera, cameraTrainingImageIndex)
|
||||
singleColorChannelImages = {color: rescaleIfNeeded(getColorChannel(imageFilePath, color)[:minimalColorChannelCameraResolution[0],:minimalColorChannelCameraResolution[1]], minColor, maxColor) for color in Color}
|
||||
multipleColorsImage = mergeSingleColorChannelImagesAccordingToBayerFilter(singleColorChannelImages)
|
||||
|
||||
if computeExtremes:
|
||||
minColor, maxColor = updateExtremes(multipleColorsImage, minColor, maxColor)
|
||||
continue
|
||||
|
||||
imagePrnuEstimateNpArray = getImagePrnuEstimatedNpArray(singleColorChannelImages, multipleColorsImage)
|
||||
singleColorChannelDenoisedImages = {color: denoise(singleColorChannelImages[color], DENOISER) for color in Color}
|
||||
multipleColorsDenoisedImage = mergeSingleColorChannelImagesAccordingToBayerFilter(singleColorChannelDenoisedImages)
|
||||
|
||||
imagePrnuEstimateNpArray = multipleColorsImage - multipleColorsDenoisedImage
|
||||
cameraIterativeMean = camerasIterativeMean[camera]
|
||||
cameraIterativeMean.add(imagePrnuEstimateNpArray)
|
||||
if cameraIndex == numberOfCameras - 1:
|
||||
|
Loading…
Reference in New Issue
Block a user