#59: Should make split_and_compare_prnus_of_subgroups.py
compatible with RAW images
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
#!/usr/bin/python3
|
||||
#!/usr/bin/env python
|
||||
|
||||
from PIL import Image
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
from tqdm import tqdm
|
||||
from utils import denoise, iterativeMean, getColorChannel, escapeFilePath, Color
|
||||
from skimage import img_as_float
|
||||
from utils import denoise, iterativeMean, getColorChannel, escapeFilePath, Color, mergeSingleColorChannelImagesAccordingToBayerFilter
|
||||
import sys
|
||||
import os
|
||||
from random import shuffle
|
||||
@@ -16,7 +14,7 @@ from rms_diff import rmsDiffNumpy
|
||||
|
||||
NUMBER_OF_SUBGROUPS = 2
|
||||
DENOISER = 'wavelet'
|
||||
IMAGES_FOLDER = 'flat-field/TIF'
|
||||
IMAGES_FOLDER = 'flat-field/NEF'
|
||||
|
||||
setting = escapeFilePath(IMAGES_FOLDER) + f'_{DENOISER}'
|
||||
|
||||
@@ -33,9 +31,13 @@ for subgroupImageIndex in tqdm(range(numberOfImagesPerSubgroup), 'Subgroup image
|
||||
imageIndex = (subgroupIndex * NUMBER_OF_SUBGROUPS) + subgroupImageIndex
|
||||
imageFileName = imagesFileNames[imageIndex]
|
||||
imageFilePath = f'{IMAGES_FOLDER}/{imageFileName}'
|
||||
imageNpArray = getColorChannel(imageFilePath, Color.GREEN_RIGHT)
|
||||
singleColorChannelImages = {color: getColorChannel(imageFilePath, color) for color in Color}
|
||||
multipleColorsImage = mergeSingleColorChannelImagesAccordingToBayerFilter(singleColorChannelImages)
|
||||
|
||||
imagePrnuEstimateNpArray = imageNpArray - denoise(imageNpArray, DENOISER)
|
||||
singleColorChannelDenoisedImages = {color: denoise(singleColorChannelImages[color], DENOISER) for color in Color}
|
||||
multipleColorsDenoisedImage = mergeSingleColorChannelImagesAccordingToBayerFilter(singleColorChannelDenoisedImages)
|
||||
|
||||
imagePrnuEstimateNpArray = multipleColorsImage - multipleColorsDenoisedImage
|
||||
subgroupIterativeMean = subgroupsIterativeMean[subgroupIndex]
|
||||
subgroupIterativeMean.add(imagePrnuEstimateNpArray)
|
||||
if subgroupIndex == NUMBER_OF_SUBGROUPS - 1:
|
||||
|
Reference in New Issue
Block a user