From 99fb31bbd1a5819e8b9519135a92c071955652f1 Mon Sep 17 00:00:00 2001 From: Benjamin Loison Date: Thu, 16 May 2024 09:55:36 +0200 Subject: [PATCH] Use same color scale --- datasets/raise/fft/remove_period_patterns.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/datasets/raise/fft/remove_period_patterns.py b/datasets/raise/fft/remove_period_patterns.py index 50639f5..a98ecf1 100644 --- a/datasets/raise/fft/remove_period_patterns.py +++ b/datasets/raise/fft/remove_period_patterns.py @@ -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))