Add necessary denoiser
argument
This commit is contained in:
parent
82b14a8724
commit
9d33abcea3
@ -58,7 +58,7 @@ def getImageFilePath(imageFileName):
|
||||
def treatImage(imageFileName, computeExtremes = False, color = None):
|
||||
global estimatedPrnuIterativeMean
|
||||
imageFilePath = getImageFilePath(imageFileName)
|
||||
imageNpArray = getImageNpArray(imageFilePath, computeExtremes, color)
|
||||
imageNpArray = getImageNpArray(imageFilePath, computeExtremes, color, DENOISER)
|
||||
if imageNpArray is None:
|
||||
return
|
||||
if DENOISER != 'mean':
|
||||
@ -80,7 +80,7 @@ if (minColor is None or maxColor is None) and DENOISER != 'mean':
|
||||
print(f'{maxColor=}')
|
||||
|
||||
if DENOISER == 'mean':
|
||||
colorMeans = getColorMeans(imagesFileNames, COLORS)
|
||||
colorMeans = getColorMeans(imagesFileNames, COLORS, DENOISER)
|
||||
for color in Color:
|
||||
colorMeans[color] = colorMeans[color]
|
||||
fileName = f'mean_{imagesFolderPathFileName}_{color}'
|
||||
|
@ -132,18 +132,18 @@ def updateExtremes(imageNpArray, minColor, maxColor):
|
||||
def print(*toPrint):
|
||||
__builtin__.print(datetime.now(), *toPrint)
|
||||
|
||||
def getColorMeans(imagesFileNames, colors = Color):
|
||||
def getColorMeans(imagesFileNames, colors, denoiser):
|
||||
colorMeans = {}
|
||||
for color in colors:
|
||||
colorIterativeMean = iterativeMean()
|
||||
for imageFileName in tqdm(imagesFileNames, f'Computing mean of {color} colored images'):
|
||||
imageNpArray = getImageNpArray(imageFileName, False, color)
|
||||
imageNpArray = getImageNpArray(imageFileName, False, color, denoiser)
|
||||
imageNpArray = gaussian_filter(imageNpArray, sigma = 5)
|
||||
colorIterativeMean.add(imageNpArray)
|
||||
colorMeans[color] = colorIterativeMean.mean
|
||||
return colorMeans
|
||||
|
||||
def getImageNpArray(imageFilePath, computeExtremes, color):
|
||||
def getImageNpArray(imageFilePath, computeExtremes, color, denoiser):
|
||||
global minColor, maxColor
|
||||
imageNpArray = getColorChannel(imageFilePath, color)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user