User:OrenBochman/Cleaning Up

For more about image cleanup in general, see Commons:Images for cleanup.

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 analog 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.

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. This tutorial shows how to do this using some widely available tools.

Tutorial for Gimp edit

First we have to install all the necessary software. All you need is available for free on Internet.

  • Install Gimp, if you don't have it. Then, respective of your operating system:

Linux edit

You have to download and install:

  • 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
  • the fftw library: 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 http://people.via.ecp.fr/~remi/soft/gimp/gimp_plugin_en.php3#fourier. There is no package for Debian/Ubuntu, you have to install it from the source.

Windows edit


First open the image; it will be in RGB format. We want to be able to manipulate the RGB layers separately (unless the image is grayscale or monochrome, then the decomposition of channels to layers can be skipped and the manipulations done directly to the image). In order to do so, right-click on the image and choose ImageModeDecompose (see screenshot on right). For the latest version of GIMP, right-click and select ColorsComponentsDecompose. Gimp will create another gray-scale image having the RGB as different layers
 
Open the image
Choose RGB and press OK (see screenshot on right). This way you will get the decomposed picture.
 
Choose RGB
Select the window with the new picture, go to the layers window (if you can't see it go to FileDialogsLayers and it will appear) and hide all but one layer clicking on the eye to remove it. Then select the remaining layer. On the screenshot on the right I have isolated the blue layer. Now you can work on one layer without influencing the others. It is also recommended to apply "Remove transparency" from the layer's right-click menu to each layer, as transparency is not needed and only distracts when editing.


Let us convert it to its spectrum using the FFT plugin: right-click on the picture and go to FiltersGenericFFT Forward (see again in the screenshot on right). Now you can manipulate the spectrum of the picture. Do as suggested in the previous section of the tutorial with an important exception: use a specific shade of gray (128, 128, 128 red-green-blue, equivalently 808080 in hex) instead of black to erase the bright spots.
 
Let's move to the frequency domain
After you have finished editing you have to convert it back to the standard domain performing the inverse FFT. Right-click on the picture and choose FiltersGenericFFT Inverse as shown in the picture on the right. Do the same for all the three layers.
 
and now let's come back to the spacial domain
After you have edited all the layers (remember to perform the inverse FFT on all of them!) you have to get your RGB picture back. Right-click on the picture and choose ImageModeCompose (see screenshot on right). Here is your picture!
 
Let's come back to the RGB picture

See also edit