GIMP/Remove Coherent Noise
Interference or other regular patterns overlaid on an image can be introduced by a variety of sources, including:
- Electromagnetic interference in the environment of the device collecting the image;
- Noise in a transmitted image such as a television still due to analogue transmission interference or degradation of media;
- The texture of the paper that the image was printed on, particularly if it was printed in a cheap magazine or newspaper.
Attempting to remove these by ordinary image space techniques such as replicating the pattern and subtracting it would be extremely difficult and unlikely to be completely successful. Sometimes interference can be hidden by downscaling or blurring, but this is rarely a satisfactory solution. Sometimes convolutions can be used, but this is an advanced technique.
Since regular patterns have a very small bandwidth in the image's spectrum, a simple and effective technique for dealing with these problems is to identify the interfering features in the power spectrum image produced by Fourier analysis, eliminate them, and convert back to image space.
In order to fully understand what you are doing here, you should know the basic principles of Fourier analysis; anyway, following this step-by-step how-to will let you removing any unwanted regular pattern over the picture you want.
Installing all the necessary softwareEdit
This guide is Linux-oriented, mainly on Ubuntu Linux. Since Gimp is multi-platform, this section could be generalized to any OS. Please do it if you know how to do it
First we have to install all the necessary software. All you need is available for free on Internet.
On Linux, you have to download and install:
- Gimp (obviously!) www.gimp.org
- The gimptool utility: it should be within Gimp. Several Linux distributions put it in a different package. On Debian and Ubuntu it is called libgimp2.0-dev
- fftw, a library to calculate the Fast Fourier Transform of any signal. You can get it from www.fftw.org. It is available on Ubuntu and Debian repositories as fftw3 and fftw3-dev
- the Fourier Gimp plug-in, you can get it from . There is no package for Debian/Ubuntu, you have to install it from the source.
On Windows, to install the Fourier Gimp plug-in download the "Binaries for Windows" from http://people.via.ecp.fr/~remi/soft/gimp/gimp_plugin_en.php3#fourier and extract its contents into the Gimp plug-ins directory (.gimp-2.x\plug-ins in your user directory or C:\Program Files\GIMP-2.x\lib\gimp\2.0\plug-ins).
An example of coherent noiseEdit
On the right, you see the picture of a flower with a coherent noise pattern on it. One might get a picture like this using a scanner. It is evident that the disturbance we want to remove is all over the picture, so it would be very difficult to remove with traditional means, such as blurring, sharpening or cloning. It is regular pattern, so it should be easy to remove in the frequency domain. Unfortunately, removing the coherent noise will cause the removal of some information that is contained in the same frequencies as the pattern. It is very difficult to preserve that information, and it will not be considered in this tutorial.
Edit the imageEdit
First open the image with Gimp. If it's coloured, it will be in RGB format and you'll have to manipulate the RGB layers separately. In order to do so, right-click on the image and choose "Image > Mode > Decompose" (see screen-shot on left). Gimp will create another gray-scale image having the RGB as different layers
(With GIMP 2.6.4 "Decompose" can be found at: "Colors > Components > Decompose...".)
Choose RGB and press OK (see screenshot on right). This way you will get the decomposed picture.
Select the window with the new picture, go to the layers window (if you can't see it, go to "File > Dialogs > Layers" and it will appear) and hide all but one layer, by clicking on the eyes. Then select the remaining layer. In the screen-shot on the left, I have isolated the blue layer. Now you can work on one layer without influencing the others. Let us convert it to its spectrum using the FFT plug-in: right-click on the picture and go to "Filters > Generic > FFT Forward" (see again the screen-shot on left). Now you can manipulate the spectrum of the blue layer of the picture. Note: strictly speaking, the Fourier transform of a signal is made of amplitude and phase; Gimp will show you only the amplitude, and that is the only thing you can edit, but it is enough for our purpose.
Looking at the spectrum you should be able to see bright small spots. Those represent the spectrum of the noise you want to remove. Since it was very regular, its power will be very concentrated in the frequency domain. In the picture on the right, you can see the spectrum of the red layer, with two blinking arrows pointing where those spots are. The red layer was chosen just because the spots were more evident (that also means that most of the noise was contained in the red layer). All you have to do now is to delete them. If you were thinking about using the Erase tool, that's not such a good idea, because deleting the information completely will cause a sharp change in the spectrum, thus introducing even more coherent noise. You have to delete them smoothly. One way is to use the Blur tool - since it has an "averaging" effect; if you use it on the bright spots, you will actually decrease its magnitude without deleting them completely. Another possibility is to use the paintbrush tool with a mid-grey colour (808080 in hexadecimal notation). You can not know exactly where the noise ends and where the information you want to keep starts. You might have to experiment a bit to get a good result.
After you have finished deleting the spots, you have to convert it back to the image space domain by performing the inverse FFT. Right-click on the picture and choose "Filters > Generic > FFT Inverse" as shown in the picture on the left. Do the same for all the three layers.
After editing all the layers (remember to perform the inverse FFT on all of them!), you must mix them to get your RGB picture back. Right-click on the picture and choose "Image > Mode > Compose" (see screen-shot on right). Here is your picture!
The result is on the left. There is still some noise, but the picture is much better than the original!