Open source algorithms for image denoising and interpolation.

Image Team, GREYC Lab (UMR CNRS 6072)
6 Bd du Marechal Juin, 14050 Caen Cedex / France.

This project has been superseeded by G'MIC
(GREYC's Magic for Image Computing)







[ Home ] [ Demonstration ] [ Download ] [ User's Guide ] [ Forum ]

::Additional Ressources

See this external link (Thanks to Eli Bressert).

Spanish translation of the GREYCstoration guide. (Thanks to 'Kurtsik').

Additional French guide on the use of GREYCstoration. (Thanks to 'Sebastien Sauvage').

::Algorithm Overview

The GREYCstoration algorithm has three different modes (restoration, inpainting and resizing) which have their own parameters. Anyway, all these modes are based on the same idea : locally smooth the image preferably along the image structures. The main parameters of the algorithm basically tunes how the image structure geometry must be retrieved, and how the smoothing must be done then, regarding to this retrieved geometry. You can also tell the algorithm to perform several passes of smoothing (iterations).

This is a very simple idea but the possibility to finely tune the parameters allows a lot of different image regularization behaviors, and as you can see in the demo section, it can deal with a large number of interesting issues. Actually, imagine the GREYCstoration algorithm as a human operator that is allowed to process an image only by using a so-called blur tool, trying to locally apply it along the right direction(s) with the right intensity, and doing that until the image is regularized enough. GREYCstoration try to perform this task as automatically as possible, for all image pixels. In the followings, we detail the main parameters of the GREYCstoration algorithm and explain how it may affect the obtained results.

::Image restoration

Usually, image restoration means denoising, or deblocking. Just remember that GREYCstoration performs by applying local oriented smoothing on the image. If your problem cannot be solved by this kind of technique, don't wait too much from GREYCstoration ! For instance, removing Salt & Pepper noise from images will be much more efficient with a simple median filter, since it is particularly well adapted for this kind of noise. Unfortunately, noise usually encountered in natural images is more difficult to remove, and GREYCstoration may perhaps help you in such cases.

To run the restoration mode, you must invoke GREYCstoration with the option -restore followed by the image file you want to process :
./greycstoration -restore noisy_image.jpg

Default parameters have been set to deal with image containing few noise. It may be inadequate for very noisy images (noise won't be removed enough) or for image with very low noise (resulting images will appear oversmoothed). It is very important that you try different set of parameters when restoring an image, since it is almost sure that default parameters won't perform very well. This is illustrated below. Compare the result obtained with the default parameters (middle image) to the one obtained with 'finely' tuned parameters (right image) :


From left to right : Original image, image restored with greycstoration -restore obelix.png, image restored with greycstoration -restore obelix.png -p 0.7 -a 0.73 -dt 10 -iter 50 -sigma 0.5 -alpha 0.3

Contrary to other PDE-based denoising techniques, the GREYCstoration algorithm has been designed to be very flexible and very different results can be obtained with different set of parameters. Let us describe now what are the main parameters that you absolutely have to tune for the restoration mode. Those parameters can be divided into two groups : the parameters that tells how to retrieve the geometry of the image structures, and the parameters that tells how to smooth the image, according to this geometry :

Parameters related to the image geometry :
  • -alpha float_number: This parameter is mathematically defined as the standard deviation of a blurring gaussian kernel applied to the original image before estimating its geometry. In other words, it defines a kind of scale under which details won't be considered as structures but much more as noise. This parameter higly depends on the level of noise present on your image. Remember that increasing too much this parameter will tell GREYCstoration to smooth more structures. It can be nice for special visual effects though. Default value of alpha is 0.8, which is relatively low (many details should be preserved). The figure below shows an example of results obtained with increasing alpha. Note how the details are ignored for high values of alpha :


    From left to right : Original image, image restored with defaults parameters, image restored with -alpha 6, image restored with -alpha 12

  • -sigma float_number: This parameter is mathematically defined as the standard deviation of a blurring gaussian kernel applied to the field of structure tensors, which are matrices that describe locally the image structure geometry. Like alpha, it can be seen as a scale but not on the image itself, but on its structures. Basically, sigma will tell GREYCstoration how smooth should be the geometry of the image structures, after being retrieved. Default value of sigma is 0.5, which is relatively low (many details should be preserved). The figure below shows an example of results obtained with increasing sigma.


    From left to right : Original image, image restored with defaults parameters, image restored with -sigma 3, image restored with -sigma 6

One the image structure have been determined, the GREYCstoration algorithm must apply the smoothing on the processed image. Basically, it try to smooth the image along the directions of the main structures but this can be tuned by the parameters described below.

Parameters related to the smoothing behavior :
  • -p float_number : This parameter tells GREYCstoration about structure preservation. Once the local structures of the image have been detected, GREYCstoration have to decide how much he will smooth image pixels. Basically, it decreases the smoothing when the local structure is contrasted. The p parameter simply tells how this decreasing must be considered. When p is high, even low-contrasted structures will be preserved. Do not set p too high or the noise may be preserved. On the contrary, when p is low, the structures have to be very contrasted to avoid local smoothing. Do not set p too low or existing image structures will be over-smoothed. As you can see, there is a (sometimes difficult) trade-off to find when setting the parameter p. Default value for p is 0.8 and typical values range from 0 to 5. The figure below shows an example of results obtained with increasing p.


    From left to right : Original image, images restored with -p 0, -p 0.8 (default), -p 1.5 and -p 3

  • -a float_number : This parameters set the anisotropy level of the considered smoothing. It ranges from 0 (which means 'purely isotropic') to 1 (which means 'purely anisotropic'). The anisotropy notion relates to the way the performed smoothing orientation will extend locally in space : a purely isotropic smoothing (-p 0) will be performed in all possible directions, while a purely anisotropic smoothing (-p 1) will be performed only along the directions of the structures. Values of p between 0 and 1 tells GREYCstoration to smooth the image mainly along the structure directions, but with a certain percentage of tolerance. Default value for a if 0.8 (which is already very anisotropic). The figure below shows an example of results obtained with increasing a.


    From left to right : Original image, images restored with -a 0, -a 0.3, -a 0.8 (default), and -a 1

  • -iter integer_number : This parameters simply tells GREYCstoration to perform several iterations instead of a single one. Repeat smoothing until the image is denoised enough. Note that this can be done interactively when the result is displayed by the GREYCstoration program (use key I). The figure below shows an example of results obtained with increasing iterations. Note that for restoration purpose, the number of iterations is seldom high : 1 to 5 iterations are usually necessary to get an acceptable result. Default value is 1 iteration.


    From left to right : Original image, images restored with -iter 1 (default), -iter 10 and -iter 100

  • -dt float_number : This parameter represents the average amount of smoothing that is performed. GREYCstoration performs a spatial averaging of pixel values, and dt represents a kind of dimension of the area where the smoothing is computed. It is related to the PDE time step. Default value is 50. The figure below shows an example of results obtained with increasing dt. Prefer using a larger dt than using multiple iterations when possible (at least until undesirable artefacts appear), it will speed up the whole process.


    From left to right : Original image, images restored with -dt 10, -dt 50 (default) and -dt 150

Choosing parameters for real cases :

Let us show how we can set 'correct' parameters for real cases. Here are some examples :

  • The following image (on the left) is a snapshot from a very low-quality webcam. There are some Poisson noise, as well as block effect due to the JPEG compression done by the webcam. The image is a bit blurred also.


    The middle image is the result obtained by GREYCstoration with the default parameters? Not too bad at a first glance. Anyway, some block effect remains, as well as noise. The blur also remains, but it won't be removed by GREYCstoration by the way (it does perform only local smoothing, no edge enhancement). As the image is already a little bit blurry, its structure geometry should certainly be quite smooth too. This knowledge can be introduced in GREYCstoration by increasing parameters alpha (set to 1 instead of 0.8) and sigma (set to 1.5 instead of 0.8), as described above. Finally, more smoothing is needed, so we increase the dt parameter (set to 120 instead of the default value 80). The right image shows the result obtained with greycstoration -restore reno.png -sigma 1.5 -dt 120 -alpha 1. And here is a comparison between the original and restored image :

  • Here is another example with an image containing 'scanner' noise. The default parameters performs badly here (middle image), since the considered noise has a relatively big pattern. Note that in this image, the structures are quite simple, basically the image is composed from constant colors and straight contours.



    In this case, we can allow a very low anisotropy (so wet set a to 0.1), and as the default parameters leads to image undersmoothing, we apply two iterations, each with a strength of 100 :
    greycstoration -restore moule_original.png -a 0.1 -dt 100 -iter 2 -o moule_tuned.png

::Image inpainting

The inpainting function will try to draw missing parts of a photo. Especially useful to remove and hide unwanted parts! To tell GREYCstoration which regions you'd like to inpaint, make a 'mask' picture : it is a black and white one, where the white pixels denote the unwanted parts. With The Gimp for example :

  • load your picture
  • create a new transparent layer from the layer dialog (CTRL+L)
  • select the white color and draw unwanted parts with the pencil
  • delete the layer containing the original picture and add a black one
  • move the black layer to the bottom and flatten the image
  • save it as mask.png
Then launch from the command line : GREYCstoration_XXX_YYY -inpaint my_picture.jpg -m mask.png A preview window will open, showing the algorithm progress in realtime. When you think the picture is good enough, close the window : it will open again and you'll find instructions in the console window. (Thanks to Romain Behar for this short description).

::Image resizing

Resizing mode is fully functional, but documentation is missing....