Add and use getImageCrop
This commit is contained in:
@@ -132,12 +132,14 @@ def updateExtremes(imageNpArray, minColor, maxColor):
|
||||
def print(*toPrint):
|
||||
__builtin__.print(datetime.now(), *toPrint)
|
||||
|
||||
def getColorMeans(imagesFileNames, colors, denoiser):
|
||||
def getColorMeans(imagesFileNames, colors, denoiser, singleColorChannelCropResolution = None):
|
||||
colorMeans = {}
|
||||
for color in colors:
|
||||
colorIterativeMean = iterativeMean()
|
||||
for imageFileName in tqdm(imagesFileNames, f'Computing mean of {color} colored images'):
|
||||
imageNpArray = getImageNpArray(imageFileName, False, color, denoiser)
|
||||
if singleColorChannelCropResolution is not None:
|
||||
imageNpArray = getImageCrop(imageNpArray, singleColorChannelCropResolution)
|
||||
imageNpArray = gaussian_filter(imageNpArray, sigma = 5)
|
||||
colorIterativeMean.add(imageNpArray)
|
||||
colorMeans[color] = colorIterativeMean.mean
|
||||
@@ -156,3 +158,7 @@ def getImageNpArray(imageFilePath, computeExtremes, color, denoiser):
|
||||
# Pay attention to range of values expected by the denoiser.
|
||||
# Indeed if provide the thousands valued raw image, then the denoiser only returns values between 0 and 1 and making the difference between both look pointless.
|
||||
return imageNpArray
|
||||
|
||||
def getImageCrop(image, cropResolution):
|
||||
imageCrop = image[:cropResolution[0], :cropResolution[1]]
|
||||
return imageCrop
|
||||
|
||||
Reference in New Issue
Block a user