[Feature Request] FFT denoise

so not sure who started it ether pixls or gmic twitter account posted some video about the fft plugin and it made me start tinkering.
I found that on a few of my photos that have bad pixel noise or in the case of one very odd grid pattern at the pixel level, that if I do a black out around the edge of the upper fft output section doing an elipse in the center (likely aiming for 50% blackout) I get rid of those noises
salvaged that one with the grid pattern even.
so it would be nice if there was a filter that would let you just choose the elipse size (maybe allow for other shapes?) and do all the boring work behind the scenes.
mixing this with wavelets I think could be very useful.
I can provide example pictures if requested tomorrow.

Asking the right questions :slight_smile:. See: Cleaning of scanned photo overlaid with pattern for more inspiration. There may be other threads.

It has also been discussed in the ImageMagick:

Also, have you tried all of the existing filters? There are already some that use FFT which may fulfill your needs. Search:

1 Like

Iā€™ve been playing with an automatic pattern removal filter in GMIC. Iā€™ll see if I can get it together.

1 Like

Iā€™m not sure I get the idea right.
From a mathematical point of view, doing what you describe is roughly equivalent to:

  1. Applying a low-pass filter (e.g. gaussian blur) on your image, and put it as a new layer.
  2. Blend the original + filtered image together, with an opacity of 50%

And for this, FFT may be not the best solution, as low-pass filtering is more profitably achieved with separable recursive filters rather than 2d FFT.

so a mask that i make would look like this (cropped the lower colored noise sections)

trying the blur sorta works but I do loose fine detail
so example image, no processing aside darktable if you zoom in you can see the odd grid pattern


using gaussian blur at a setting of 1

and using fft mask seen above

and of course aside the box pattern it likely also got rid of hot pixel type issues also
so if math is same it seems it not fully the same
and yes considering the wave effect going on in this id prob increase the diameter of the elipse

using a gradient I hadnt considered that Ill have to do more testing now

I did try the bandpass one but it didnā€™t produce same results that Iā€™m seeing

Using a gradient is a little different when using gmic rather than a regular FFT plugin.

Constrain the area with a selection but make sure you turn the selection off before invoking FFT inverse.

This ancient video https://youtu.be/30XaCfM2QGg describes

Unfortunately, this would remove a lot of the detail as well. You need to be careful with what you do in this space since it is very sensitive to even the slightest change.

seems to work well for me. getting to close to center causes problems with detail no question.
Iā€™ll also note that using a gradient goes for detail loss really easily seems hard edge is better

@Magnade Sorry, I am not sure if I follow. I think a soft edge is better. If you havenā€™t already, I suggest you try it on different images. What works for one image might not work for others. E.g., the mountain image doesnā€™t appear to have many (complex) details to begin with besides the pattern.

I have tried on several and I seem to get similiar distortions
one thing i havent tried yet is selection feathering using a radial gradiant at least is a waste to me

I have been using the FFT alot lately, digitally restoring a photo book. Really beginning to hate dust and screens.

Hard edges on the power spectrum produce ringing around contrast edges and the outer edge of the image. Making changes too close to the center also produce ringing.

The best luck in removing high frequency ā€œjunkā€ is to use the blend tool. Select the top section to keep the fill constrained to the power section. The setting I am using are (black) FG to transparent ,reverse selected, radial shape, no repeat, and offset of 25. You have to protect the center of the power spectrum.

How far to drag from center? Depends on the image and what you are looking for. Start with center to top edge. Select none. Inverse FFT. Donā€™t like - Undo history to ā€œselectionā€ and try ending the gradient a little further from the top edge. repeat until you get something you like.

Extending my method from Cleaning of scanned photo overlaid with pattern (see post #2), this is my method to remove the pattern. I might eventually write a filter or a more official tutorial for it. List of steps (wow, it took me such a long time to write this; props to all tutorial writers!):

A. Original image.

B. Split details (wavelets). The important thing is to make it so that only the last detail scale has the offending pattern. Crop:
image

C. Fourier transform (fftpolar) of this last detail scale. We are interested in editing the spectrum. Normalized for web viewing:

As you can see, the contrast is quite low. To make it easier to edit in GIMP 2.9.x, we could change the gamma and normalize to 0-1. Just remember to reverse this transformation! Normalized for web viewing:

D. GIMP 2.9.x. Now use the clone tool to remove the 4 lines that extend to the edge of the spectrum. Where the lines touch the edges, there are also small noise clouds. Remove them too.

Why is it lighter? If you recall, you need to reverse the previous gamma and range correction!

E. Finally, you need to reinsert this spectrum back into the workflow. Replace the old one with this new spectrum and then reverse all of your steps.
a) Reverse the Fourier transform.
b) Reverse the split details procedure. For some reason, this new detail scale is too strong now, so one thing you need to do is shrink its influence. For the mountain image, reducing its range to 75% is ideal.

Without reduction:

Good copy:

2 Likes

I have added a filter to my Testing ā†’ Iain Fergusson called iain_remove_pattern as a proof of concept.

GMIC_remove_pattern_screen

Results:

remove_pattern

4 Likes

I tried this filter on win7 Gimp 2.9 GMIC 2.2 Pre and received an error. I have attached a screenshot. I am using the SAMJ portable.

Tried it again in my Bodhi Linux VM [Ubuntu based] and the same error showed up. Any suggestions?

GMIC_Err

Thatā€™s my fault. I changed a few things from my local version to the community version and I didnā€™t make all the changes I needed.

This issue should be fixed now. Hopefully thatā€™s the last one :slight_smile:

Works fine. Thank you for all of your work!!!

so from what I see on preview I like the output of this when pre-blur and smoothness is set to 1.
but it seems I found a bug also
below is the output i get when I run it with those options
not using recover details btw if I do the red/yellow bits disappear and seem to be replaced with black
now if i lower radius I can see this effect also in the preview
gmic is 2.2.0, I didnā€™t get a chance to try this before now so not sure if it worked on previous version

This seems to be a problem with the underlying command ā€˜guidedā€™. A similar problem occurs when using Smooth [guided] and radius and smoothness are both set to 1

@David_Tschumperle I think we found a bug.

I hope this gets fixed sometime soon, would love to expierment with this plugin more