Compare commits

..

No commits in common. "715b5296c9b702829e51d93d33a890043b52642a" and "2bfedf54ad34b070e44203d6c29b63193dca4f6f" have entirely different histories.

3 changed files with 9 additions and 16 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_odd.png', image * 2.55, cmap = 'grey', vmin = 0, vmax = 255)
plt.imsave('vignetting.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, getPearsonCorrelationDistance
from utils import isARawImage, Color, getColorChannel, mergeSingleColorChannelImagesAccordingToBayerFilter, iterativeMean
FOLDERS = {
'Rafael 23/04/24': '../rafael/230424',
@ -34,15 +34,7 @@ def getEstimatedPrnu(folder):
estimatedPrnu.add(imageMergedColorChannels - meanImages.mean)
return estimatedPrnu.mean
estimatedPrnus = {folderName: getEstimatedPrnu(folder) for folderName, folder in FOLDERS.items()}
estimatedPrnu = getEstimatedPrnu(FOLDERS['Rafael 23/04/24'])
# 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.imshow(estimatedPrnu)
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, stats
from scipy import fftpack
import imageio
class Color(Enum):
@ -44,7 +44,7 @@ class Distance(Enum):
return self.name.replace('_', '').title()
def getPearsonCorrelationDistance(firstImage, secondImage):
pearsonCorrelation = stats.pearsonr(firstImage.flatten(), secondImage.flatten()).statistic
pearsonCorrelation = scipy.stats.pearsonr(firstImage.flatten(), secondImage.flatten()).statistic
if pearsonCorrelation < 0:
print('Negative Pearson correlation, investigate further!')
exit(1)
@ -161,6 +161,7 @@ def getColorChannel(imageFilePath, color):
def escapeFilePath(filePath):
return filePath.replace('/', '_')
def getNewIndex(index, offset):
newIndex = (index - offset) * 2 + offset
return newIndex