Compare commits

...

3 Commits

Author SHA1 Message Date
715b5296c9
Compare PRNUs 2024-06-11 17:54:29 +02:00
c2cf139261
Correct pearsonr import 2024-06-11 17:53:34 +02:00
aa5c210539
Comment checkOriginalPoint 2024-06-11 17:52:50 +02:00
3 changed files with 16 additions and 9 deletions

View File

@ -29,12 +29,12 @@ for y in tqdm(range(SHAPE[0])):
def checkOriginalPoint(point):
print(f'distance = {getDistance(*point)} intensity = {image[tuple(point)]}')
for point in [CENTER, [0, 0], [CENTER[0], int(CENTER[1] + getDistance(0, 0) / 2)]]:
checkOriginalPoint(point)
#for point in [CENTER, [0, 0], [CENTER[0], int(CENTER[1] + getDistance(0, 0) / 2)]]:
# checkOriginalPoint(point)
pad = (SHAPE[1] - SHAPE[0]) // 2
cropImage = image[:, pad:-pad]
#plt.imshow(image, cmap = 'grey')
plt.imsave('vignetting.png', image * 2.55, cmap = 'grey', vmin = 0, vmax = 255)
plt.imsave('vignetting_odd.png', image * 2.55, cmap = 'grey', vmin = 0, vmax = 255)
plt.show()

View File

@ -6,7 +6,7 @@ import sys
sys.path.insert(0, '../')
from utils import isARawImage, Color, getColorChannel, mergeSingleColorChannelImagesAccordingToBayerFilter, iterativeMean
from utils import isARawImage, Color, getColorChannel, mergeSingleColorChannelImagesAccordingToBayerFilter, iterativeMean, getPearsonCorrelationDistance
FOLDERS = {
'Rafael 23/04/24': '../rafael/230424',
@ -34,7 +34,15 @@ def getEstimatedPrnu(folder):
estimatedPrnu.add(imageMergedColorChannels - meanImages.mean)
return estimatedPrnu.mean
estimatedPrnu = getEstimatedPrnu(FOLDERS['Rafael 23/04/24'])
estimatedPrnus = {folderName: getEstimatedPrnu(folder) for folderName, folder in FOLDERS.items()}
plt.imshow(estimatedPrnu)
# TODO: largest common crop
print(f'{corr(estimatedPrnus["Rafael 23/04/24"], estimatedPrnus["Rafael 23/04/24"])=}')
print(f'{corr(estimatedPrnus["Rafael 23/04/24"], estimatedPrnus["RAISE flat-field"])=}')
print(f'{corr(estimatedPrnus["RAISE flat-field"], estimatedPrnus["Rafael 23/04/24"])=}')
print(f'{corr(estimatedPrnus["Rafael 23/04/24"], estimatedPrnus["RAISE not flat-field"])=}')
print(f'{corr(estimatedPrnus["RAISE flat-field"], estimatedPrnus["RAISE not flat-field"])=}')
plt.imshow(estimatedPrnus['RAISE flat-field'])
plt.show()

View File

@ -10,7 +10,7 @@ import builtins as __builtin__
from scipy.ndimage import gaussian_filter
import os
from skimage.restoration import estimate_sigma
from scipy import fftpack
from scipy import fftpack, stats
import imageio
class Color(Enum):
@ -44,7 +44,7 @@ class Distance(Enum):
return self.name.replace('_', '').title()
def getPearsonCorrelationDistance(firstImage, secondImage):
pearsonCorrelation = scipy.stats.pearsonr(firstImage.flatten(), secondImage.flatten()).statistic
pearsonCorrelation = stats.pearsonr(firstImage.flatten(), secondImage.flatten()).statistic
if pearsonCorrelation < 0:
print('Negative Pearson correlation, investigate further!')
exit(1)
@ -161,7 +161,6 @@ def getColorChannel(imageFilePath, color):
def escapeFilePath(filePath):
return filePath.replace('/', '_')
def getNewIndex(index, offset):
newIndex = (index - offset) * 2 + offset
return newIndex