Use a low-pass filter denoiser #69

Open
opened 2024-05-10 01:07:24 +02:00 by Benjamin_Loison · 6 comments

Someone asked this as the Stack Overflow question 54641616.

How to quantify the cutoff frequency (I mean how to deduce the circle diameter)?

Related to #70.

Someone asked this as [the Stack Overflow question 54641616](https://stackoverflow.com/q/54641616). How to quantify the cutoff frequency (I mean how to deduce the circle diameter)? Related to #70.
Benjamin_Loison added the
enhancement
medium priority
quick
labels 2024-05-10 01:07:24 +02:00
Author
Owner

With Rafael 23/04/24:

mean_rafael_230424_low_pass_multiple_colors

With Rafael 23/04/24: ![mean_rafael_230424_low_pass_multiple_colors](/attachments/1869707b-f704-4054-bed9-9c3478c7c223)
Author
Owner

image

fft-then-ifft

fft-then-ifft_old

![image](/attachments/87a52a87-6272-459f-b318-75d2863c1ba2) ![fft-then-ifft](/attachments/637c255f-a81b-4d39-b784-43adbc38309b) ![fft-then-ifft_old](/attachments/8288eb0b-cf03-45a4-89ca-5794e8c9f664)
Author
Owner

The Stack Overflow answer 43346070 seems to be nice for square images. We can shift this square to the middle of the rectangle but does not seem very clean. Other answers to the associated question do not seem to treat the rectangle case.

Finally used the Stack Overflow answer 62949902.

[The Stack Overflow answer 43346070](https://stackoverflow.com/a/43346070) seems to be nice for square images. We can shift this square to the middle of the rectangle but does not seem very clean. Other answers to the associated question do not seem to treat the rectangle case. Finally used [the Stack Overflow answer 62949902](https://stackoverflow.com/a/62949902).
Author
Owner

fft-then-ifft

Interesting blurring without artifacts.

![fft-then-ifft](/attachments/4f315c7e-2446-44b2-826b-9463ba09e997) Interesting blurring without artifacts.
Author
Owner
diff --git a/datasets/raise/utils.py b/datasets/raise/utils.py
index 6c699a0..973b4d1 100644
--- a/datasets/raise/utils.py
+++ b/datasets/raise/utils.py
@@ -73,6 +73,9 @@ def denoise(imageNpArray, denoiser):
 
             # Unsure that doing such *normalization* is appropriate.
             rectangleLowPassNpArray /= rectangleLowPassNpArray.max()
+            import matplotlib.pyplot as plt
+            plt.imsave('rectangle_low_pass.png', rectangleLowPassNpArray)
+            exit(1)
 
             # multiply both the images
             filtered = np.multiply(fft1, rectangleLowPassNpArray)

rectangle_low_pass

New corrected PRNU:

mean_rafael_230424_low_pass_multiple_colors

```diff diff --git a/datasets/raise/utils.py b/datasets/raise/utils.py index 6c699a0..973b4d1 100644 --- a/datasets/raise/utils.py +++ b/datasets/raise/utils.py @@ -73,6 +73,9 @@ def denoise(imageNpArray, denoiser): # Unsure that doing such *normalization* is appropriate. rectangleLowPassNpArray /= rectangleLowPassNpArray.max() + import matplotlib.pyplot as plt + plt.imsave('rectangle_low_pass.png', rectangleLowPassNpArray) + exit(1) # multiply both the images filtered = np.multiply(fft1, rectangleLowPassNpArray) ``` ![rectangle_low_pass](/attachments/132b8eb3-5be8-46f0-ac95-6631d7815699) New corrected PRNU: ![mean_rafael_230424_low_pass_multiple_colors](/attachments/51d41864-64b0-4488-9e15-8f500f0de883)
Author
Owner

Related to PRNU_extraction/issues/6. In this context I noticed this 2 very suspicious lines:

datasets/raise/utils.py Lines 99 to 101 in 7f7e78cafb
ifft2 = np.maximum(0, np.minimum(ifft2, 255))
imageDenoisedNpArray = ifft2.astype(np.uint8)

See PRNU_extraction/commit/1c9fa298defe3dd65b868606d06e1d661915d653.

Related to [PRNU_extraction/issues/6](https://codeberg.org/Benjamin_Loison/PRNU_extraction/issues/6). In this context I noticed this 2 very suspicious lines: https://gitea.lemnoslife.com/Benjamin_Loison/Robust_image_source_identification_on_modern_smartphones/src/commit/7f7e78cafb8f6d5807755b9801b0dcd2d8290776/datasets/raise/utils.py#L99-L101 See [PRNU_extraction/commit/1c9fa298defe3dd65b868606d06e1d661915d653](https://codeberg.org/Benjamin_Loison/PRNU_extraction/commit/1c9fa298defe3dd65b868606d06e1d661915d653).
Sign in to join this conversation.
No description provided.