Created by image-processing mathematician David Tschumperlé at the GREYC lab in Caen, France, the GREYCstoration algorithm enhances an image by looking for local variations in pixel intensity and regularizing them, while preserving the image's large-scale features -- thus avoiding the blurring effects seen with other filters.
The most straightforward use of the algorithm is to remove noise, such as CCD noise from a digital original or scanned image, or excessive film grain. But the technique can be applied to other visual artifacts as well, including compression artifacts like JPEG-compression "checkerboarding" or "color banding" in gradients. Akin to these problems are the block artifacts that sometimes result when enlarging an image, and indeed GREYCstoration can work small wonders as a post-resizing filter.
Down with noise
To get started, you can download the code as source or in binary form for Windows or Linux from the GREYCstoration page, or as part of the Cimg library. The current release is 2.0, with the software licensed under the CeCILL license, an explicitly GPL-compatible free software license written to conform with French law.
You run the basic package from the command line (though plugins have been written for the GIMP, Krita, and Digikam). If you download the binary, make sure you have execute permission set, and type
greycstoration_linux -h -restore to see a list of options.
The command has six parameters:
dt-- strength of the smoothing factor (default: 50)
p-- contour preservation (default: 0.8)
a-- smoothing anisotropy (default: 0.8)
alpha-- noise scale (default: 0.5)
sigma-- geometry regularity (default: 1)
iter-- number of iterations (default: 1)
The precise meaning of these parameters is fairly technical; if you're really interested, you can read Tschumperlé's research paper at the GREYCstoration site. Or read Victor Stinner's wiki pages (though they are translated from French, which can at times inhibit clarity in English).
But it is easier to just take a test image and play around, observing the results of your changes. For example, on this test image (a blurry, noisy camera-phone picture with extra noise added via the GIMP), I used
greycstoration_linux -restore before.jpg -dt 280 -p .7 -a .9 -sigma 2 -alpha .9.
Before and After denoising with GREYCstoration - click to enlarge
No need to worry about accidentally overwriting your original; GREYCstoration shows you its results in a pop-up window, which you must explicitly save. You can also toggle back and forth between the original and processed views to compare and run multiple iterations before saving -- though you cannot alter the algorithm parameters between iterations.
The GREYCstoration page has some example images, and Skinner has put together an enlightening comparison between GREYCstoration and two commercial denoising Photoshop add-on products, Noise Ninja and Denoise Deluxe.
If that were all GREYCstoration did, it would be a worthy addition to the open source graphics toolbox, but there's more. The inpainting function of the tool allows you to mask off part of an image and tell GREYCstoration to fill in the blank areas, using its best guess from the surrounding data. The results are incredible.
To use the inpainting feature, create a black-and-white mask marking what part of the image you want to remove. Then execute GREYCstoration with the
-inpaint flag and specify the mask with
-m. In this example, I used
greycstoration_linux -inpaint bee.jpg -m mask.png, leaving all parameters at their defaults. With some tweaking, I'm confident you'd never even know the bee was there.
Subject removed from a photograph with GREYCstoration inpainting - click to enlarge
Inpainting requires many iterations, and (depending on CPU speed and the size of the image) could take several minutes to finish. But it is interesting to watch the preview window alter your image progressively as it works.
There are even more examples at the GREYCstoration site, including some with practical uses, such as removing subtitles from a video frame. Several examples involve removing 50 percent of the pixels from an image and having GREYCstoration paint them back in. My favorite is the parrot photo, where a chain link fence between the subject and the camera is completely removed.
As with any image-editing tool, choosing a "best in class" depends partly on subjective factors, which vary from person to person. But I found GREYCstoration's results more pleasing than those of Noise Ninja and Denoise Deluxe. Certainly, GREYCstoration belongs in your graphics toolkit, as it produces effects superior to the GIMP's built-in noise reduction methods, and inpainting opens up completely new possibilities.