Use same color scale

This commit is contained in:
Benjamin Loison 2024-05-16 09:55:36 +02:00
parent da5b19f047
commit 99fb31bbd1
Signed by: Benjamin_Loison
SSH Key Fingerprint: SHA256:BtnEgYTlHdOg1u+RmYcDE0mnfz1rhv5dSbQ2gyxW8B8

View File

@ -23,6 +23,7 @@ multipleColorsImage = mergeSingleColorChannelImagesAccordingToBayerFilter(single
image = multipleColorsImage
fft1 = fftpack.fftshift(fftpack.fft2(image))
originalFft1 = fft1.copy()
def removePeriodicPatterns(fft1Part):
@ -47,10 +48,12 @@ def removePeriodicPatterns(fft1Part):
fixedImage = interpolate_replace_nans(fft1Part, kernel)
return fixedImage
'''
realFixedImage = removePeriodicPatterns(np.real(fft1).copy())
imaginaryFixedImage = removePeriodicPatterns(np.imag(fft1).copy())
fixedImage = realFixedImage + 1j * imaginaryFixedImage
#fixedImage = realFixedImage
'''
fixedImage = removePeriodicPatterns(abs(fft1))
figure, axes = plt.subplots(1, 2, sharex = True, sharey = True)
@ -58,9 +61,14 @@ plt.suptitle('Attenuating FFT significant lines')
axes[0].set_title('Original FFT')
#originalFft1Abs = abs(originalFft1)
#minValue = np.min()
axes[0].imshow(np.log10(abs(originalFft1)))
firstImage = np.log10(abs(originalFft1))
secondImage = np.log10(abs(fixedImage))
images = [firstImage, secondImage]
vMin = np.min(images)
vMax = np.max(images)
axes[0].imshow(firstImage, vmin = vMin, vmax = vMax)
axes[1].set_title('FFT with significant lines attenuated')
axes[1].imshow(np.log10(abs(fixedImage)))
axes[1].imshow(secondImage, vmin = vMin, vmax = vMax)
plt.tight_layout()
plt.show()
#plt.imsave('fft.png', np.log10(fixedImage))